All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Julia Suvorova <jusual@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [PULL 07/20] hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine type
Date: Mon, 15 Nov 2021 11:38:01 -0500	[thread overview]
Message-ID: <20211115163607.177432-8-mst@redhat.com> (raw)
In-Reply-To: <20211115163607.177432-1-mst@redhat.com>

From: Julia Suvorova <jusual@redhat.com>

To solve issues [1-2] the Hot Plug Capable bit in PCIe Slots will be
turned on, while the switch to ACPI Hot-plug will be done in the
DSDT table.

Introducing 'x-keep-native-hpc' property disables the HPC bit only
in 6.1 and as a result keeps the forced 'reserve-io' on
pcie-root-ports in 6.1 too.

[1] https://gitlab.com/qemu-project/qemu/-/issues/641
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2006409

Signed-off-by: Julia Suvorova <jusual@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20211112110857.3116853-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/acpi/ich9.h |  1 +
 hw/acpi/ich9.c         | 18 ++++++++++++++++++
 hw/i386/pc.c           |  2 ++
 hw/i386/pc_q35.c       |  7 ++++++-
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index f04f1791bd..7ca92843c6 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -56,6 +56,7 @@ typedef struct ICH9LPCPMRegs {
     AcpiCpuHotplug gpe_cpu;
     CPUHotplugState cpuhp_state;
 
+    bool keep_pci_slot_hpc;
     bool use_acpi_hotplug_bridge;
     AcpiPciHpState acpi_pci_hotplug;
     MemHotplugState acpi_memory_hotplug;
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 1ee2ba2c50..ebe08ed831 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -419,6 +419,20 @@ static void ich9_pm_set_acpi_pci_hotplug(Object *obj, bool value, Error **errp)
     s->pm.use_acpi_hotplug_bridge = value;
 }
 
+static bool ich9_pm_get_keep_pci_slot_hpc(Object *obj, Error **errp)
+{
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+
+    return s->pm.keep_pci_slot_hpc;
+}
+
+static void ich9_pm_set_keep_pci_slot_hpc(Object *obj, bool value, Error **errp)
+{
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+
+    s->pm.keep_pci_slot_hpc = value;
+}
+
 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
 {
     static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
@@ -428,6 +442,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
     pm->disable_s4 = 0;
     pm->s4_val = 2;
     pm->use_acpi_hotplug_bridge = true;
+    pm->keep_pci_slot_hpc = true;
 
     object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
                                    &pm->pm_io_base, OBJ_PROP_FLAG_READ);
@@ -454,6 +469,9 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
     object_property_add_bool(obj, ACPI_PM_PROP_ACPI_PCIHP_BRIDGE,
                              ich9_pm_get_acpi_pci_hotplug,
                              ich9_pm_set_acpi_pci_hotplug);
+    object_property_add_bool(obj, "x-keep-pci-slot-hpc",
+                             ich9_pm_get_keep_pci_slot_hpc,
+                             ich9_pm_set_keep_pci_slot_hpc);
 }
 
 void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2592a82148..a2ef40ecbc 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -98,6 +98,7 @@ GlobalProperty pc_compat_6_1[] = {
     { TYPE_X86_CPU, "hv-version-id-build", "0x1bbc" },
     { TYPE_X86_CPU, "hv-version-id-major", "0x0006" },
     { TYPE_X86_CPU, "hv-version-id-minor", "0x0001" },
+    { "ICH9-LPC", "x-keep-pci-slot-hpc", "false" },
 };
 const size_t pc_compat_6_1_len = G_N_ELEMENTS(pc_compat_6_1);
 
@@ -107,6 +108,7 @@ GlobalProperty pc_compat_6_0[] = {
     { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" },
     { TYPE_X86_CPU, "x-vendor-cpuid-only", "off" },
     { "ICH9-LPC", ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, "off" },
+    { "ICH9-LPC", "x-keep-pci-slot-hpc", "true" },
 };
 const size_t pc_compat_6_0_len = G_N_ELEMENTS(pc_compat_6_0);
 
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index fc34b905ee..e1e100316d 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -137,6 +137,7 @@ static void pc_q35_init(MachineState *machine)
     DriveInfo *hd[MAX_SATA_PORTS];
     MachineClass *mc = MACHINE_GET_CLASS(machine);
     bool acpi_pcihp;
+    bool keep_pci_slot_hpc;
 
     /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
      * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
@@ -242,7 +243,11 @@ static void pc_q35_init(MachineState *machine)
                                           ACPI_PM_PROP_ACPI_PCIHP_BRIDGE,
                                           NULL);
 
-    if (acpi_pcihp) {
+    keep_pci_slot_hpc = object_property_get_bool(OBJECT(lpc),
+                                                 "x-keep-pci-slot-hpc",
+                                                 NULL);
+
+    if (!keep_pci_slot_hpc && acpi_pcihp) {
         object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
                                    "false", true);
     }
-- 
MST



  parent reply	other threads:[~2021-11-15 16:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 16:37 [PULL 00/20] pci,pc,virtio: bugfixes Michael S. Tsirkin
2021-11-15 16:37 ` [PULL 01/20] net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs() Michael S. Tsirkin
2021-11-15 16:37 ` [PULL 02/20] softmmu/qdev-monitor: fix use-after-free in qdev_set_id() Michael S. Tsirkin
2021-11-15 16:37 ` [PULL 03/20] vhost: Rename last_index to vq_index_end Michael S. Tsirkin
2021-11-15 16:37 ` [PULL 04/20] vhost: Fix last vq queue index of devices with no cvq Michael S. Tsirkin
2021-11-15 16:37 ` [PULL 05/20] hw/mem/pc-dimm: Restrict NUMA-specific code to NUMA machines Michael S. Tsirkin
2021-11-15 16:37 ` [PULL 06/20] pcie: rename 'native-hotplug' to 'x-native-hotplug' Michael S. Tsirkin
2021-11-15 16:38 ` Michael S. Tsirkin [this message]
2021-11-15 16:38 ` [PULL 08/20] bios-tables-test: Allow changes in DSDT ACPI tables Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 09/20] hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 10/20] tests: bios-tables-test update expected blobs Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 11/20] virtio: use virtio accessor to access packed descriptor flags Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 12/20] virtio: use virtio accessor to access packed event Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 13/20] vdpa: Replace qemu_open_old by qemu_open at Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 14/20] vdpa: Check for existence of opts.vhostdev Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 15/20] pci: implement power state Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 16/20] pcie: implement slot power control for pcie root ports Michael S. Tsirkin
2021-11-15 16:38 ` [PULL 17/20] pcie: add power indicator blink check Michael S. Tsirkin
2021-11-15 16:39 ` [PULL 18/20] pcie: factor out pcie_cap_slot_unplug() Michael S. Tsirkin
2021-11-15 16:39 ` [PULL 19/20] pcie: fast unplug when slot power is off Michael S. Tsirkin
2021-11-15 16:39 ` [PULL 20/20] pcie: expire pending delete Michael S. Tsirkin
2021-11-16 19:32   ` Igor Mammedov
2021-11-17  8:30     ` Gerd Hoffmann
2021-11-15 22:43 ` [PULL 00/20] pci,pc,virtio: bugfixes Philippe Mathieu-Daudé
2021-11-16  8:50   ` Richard Henderson
2021-11-16  8:55 ` Richard Henderson

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=20211115163607.177432-8-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jusual@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.