[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/26] hw: acpi: reduced: Add PCI hotplug support
From: |
Samuel Ortiz |
Subject: |
[Qemu-devel] [PATCH 26/26] hw: acpi: reduced: Add PCI hotplug support |
Date: |
Mon, 22 Oct 2018 20:36:56 +0200 |
From: Sebastien Boeuf <address@hidden>
In order to support PCI hotplug through a hardware-reduced GED, we need
to modify the GED device definition in the DSDT table, so that a PCI hotplug
related interrupt will trigger a new PCI scan.
We also need to modify the DSDT PCI bus definition in order to make sure
a PCI scan of all available slots can be performed when an interrupt
comes in.
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Igor Mammedov <address@hidden>
Signed-off-by: Sebastien Boeuf <address@hidden>
Signed-off-by: Jing Liu <address@hidden>
---
hw/acpi/aml-build.c | 8 +++++++-
hw/acpi/reduced.c | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 752642a67a..99f04a3e71 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -2510,7 +2510,7 @@ void build_append_pci_bus_devices(Aml *parent_scope,
PCIBus *bus,
void acpi_dsdt_add_pci_bus(Aml *dsdt, AcpiPciBus *pci_host)
{
- Aml *dev, *pci_scope;
+ Aml *dev, *pci_scope, *hp_scope;
dev = aml_device("\\_SB.PCI0");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
@@ -2522,6 +2522,12 @@ void acpi_dsdt_add_pci_bus(Aml *dsdt, AcpiPciBus
*pci_host)
aml_append(dev, build_osc_method(0x1F));
aml_append(dsdt, dev);
+ /* PCIHP */
+ hp_scope = aml_scope("\\_SB.PCI0");
+ build_acpi_pci_hotplug(hp_scope);
+ build_append_pci_bus_devices(hp_scope, pci_host->pci_bus, false);
+ aml_append(dsdt, hp_scope);
+
pci_scope = build_pci_host_bridge(dsdt, pci_host);
aml_append(dsdt, pci_scope);
}
diff --git a/hw/acpi/reduced.c b/hw/acpi/reduced.c
index fac19a978a..7faccdc634 100644
--- a/hw/acpi/reduced.c
+++ b/hw/acpi/reduced.c
@@ -331,6 +331,8 @@ void acpi_reduced_setup(MachineState *machine,
AcpiConfiguration *conf)
static Aml *ged_event_aml(GedEvent *event)
{
+ Aml *method;
+
if (!event) {
return NULL;
}
@@ -343,6 +345,11 @@ static Aml *ged_event_aml(GedEvent *event)
/* We run a complete memory SCAN when getting a memory hotplug event */
return aml_call0("\\_SB.MHPC." MEMORY_SLOT_SCAN_METHOD);
case GED_PCI_HOTPLUG:
+ /* Take the PCI lock and trigger a PCI rescan */
+ method = aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF);
+ aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
+ aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
+ return method;
case GED_NVDIMM_HOTPLUG:
return aml_notify(aml_name("\\_SB.NVDR"), aml_int(0x80));
default:
--
2.17.2
- [Qemu-devel] [PATCH 19/26] hw: acpi: reduced: Add MCFG support, (continued)
- [Qemu-devel] [PATCH 19/26] hw: acpi: reduced: Add MCFG support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 18/26] hw: acpi: Initial hardware-reduced support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 20/26] hw: acpi: reduced: Generic Event Device support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 21/26] hw: acpi: reduced: Add memory hotplug support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 24/26] hw: acpi: reduced: Add SRAT table, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 23/26] hw: acpi: reduced: Add reboot support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 25/26] hw: acpi: reduced: Add NFIT support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 22/26] hw: acpi: reduced: Add shutdown support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 26/26] hw: acpi: reduced: Add PCI hotplug support,
Samuel Ortiz <=
- Re: [Qemu-devel] [PATCH 00/27] ACPI hardware-reduced support, Michael S. Tsirkin, 2018/10/22
- Re: [Qemu-devel] [PATCH 00/27] ACPI hardware-reduced support, Peter Maydell, 2018/10/23
- Re: [Qemu-devel] [PATCH 00/27] ACPI hardware-reduced support, Paolo Bonzini, 2018/10/23