All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, mst@redhat.com
Subject: [PATCH 3/4] acpi: pcihp: disable power control on PCIe slot
Date: Thu, 24 Feb 2022 12:44:10 -0500	[thread overview]
Message-ID: <20220224174411.3296848-4-imammedo@redhat.com> (raw)
In-Reply-To: <20220224174411.3296848-1-imammedo@redhat.com>

Previous patch [1] fixed unconditional power handling on a PCIe
slot, and make it honor PCI_EXP_SLTCAP_PCP capability.

Use COMPAT_PROP_PCP to disable power control (PCI_EXP_SLTCAP_PCP)
on PCIe slot when its plug callbacks are wired to ACPI pcihp,
which effectively leaves stop always powered.

PS:
See [1] for detailed description of the issue [2] and how it's
being addressed.

1) "pcie: update slot power status only is power control is enabled"

2)
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2053584
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/pcihp.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 6befd23e16..bc47d1bf64 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -32,6 +32,7 @@
 #include "hw/pci/pci_bridge.h"
 #include "hw/pci/pci_host.h"
 #include "hw/pci/pcie_port.h"
+#include "hw/pci-bridge/xio3130_downstream.h"
 #include "hw/i386/acpi-build.h"
 #include "hw/acpi/acpi.h"
 #include "hw/pci/pci_bus.h"
@@ -329,6 +330,15 @@ void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev,
                                  GINT_TO_POINTER(pdev->acpi_index),
                                  g_cmp_uint32, NULL);
     }
+
+    /*
+     * since acpi_pcihp manages hotplug, disable PCI-E power control on slot
+     */
+    if (object_dynamic_cast(OBJECT(dev), TYPE_PCIE_ROOT_PORT) ||
+        object_dynamic_cast(OBJECT(dev), TYPE_XIO3130_DOWNSTREAM)) {
+        object_property_set_bool(OBJECT(dev), COMPAT_PROP_PCP, false,
+                                 &error_abort);
+    }
 }
 
 void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
-- 
2.31.1



  parent reply	other threads:[~2022-02-24 17:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 17:44 [PATCH 0/4] Fix broken PCIe device after migration Igor Mammedov
2022-02-24 17:44 ` [PATCH 1/4] pci: expose TYPE_XIO3130_DOWNSTREAM name Igor Mammedov
2022-02-24 17:44 ` [PATCH 2/4] pcie: update slot power status only is power control is enabled Igor Mammedov
2022-02-24 18:05   ` Michael S. Tsirkin
2022-02-25  8:18     ` Igor Mammedov
2022-02-25  9:51       ` Michael S. Tsirkin
2022-02-25 10:05   ` Michael S. Tsirkin
2022-02-25 10:12   ` Gerd Hoffmann
2022-02-25 10:35     ` Michael S. Tsirkin
2022-02-25 13:02     ` Igor Mammedov
2022-02-25 13:08       ` Michael S. Tsirkin
2022-02-25 13:35         ` Igor Mammedov
2022-02-25 13:48           ` Michael S. Tsirkin
2022-02-25 15:39             ` Igor Mammedov
2022-02-28  7:39               ` Gerd Hoffmann
2022-02-28  8:55                 ` Igor Mammedov
2022-02-24 17:44 ` Igor Mammedov [this message]
2022-02-24 17:44 ` [PATCH 4/4] q35: compat: keep hotplugged PCIe device broken after migration for 6.2-older machine types Igor Mammedov
2022-02-24 18:11   ` Michael S. Tsirkin
2022-02-25  8:25     ` Igor Mammedov
2022-02-24 18:08 ` [PATCH 0/4] Fix broken PCIe device after migration Michael S. Tsirkin
2022-02-25  9:01   ` Igor Mammedov
2022-02-25  9:58 ` Michael S. Tsirkin
2022-02-25 13:18   ` Igor Mammedov
2022-02-25 13:50     ` Michael S. Tsirkin
2022-02-25 15:50       ` Igor Mammedov
2022-02-27 10:22         ` Michael S. Tsirkin
2022-02-28  7:49       ` Gerd Hoffmann
2022-02-25 14:32     ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220224174411.3296848-4-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.