aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-08-04 13:53:38 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-08-04 13:53:38 +0100
commitf17d05569a5443691edd823f65c2d833a3598ae6 (patch)
treebcad7a2affc431168f3625f769f57a2297d9fbaf
parent700d82c9bc6c1c53d5f501fc2d099d28da0cef7a (diff)
parent62a4db5522cbbd8b5309a2949c22f00e5b0138e3 (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc,pci: bugfixes Small bugfixes all over the place. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 03 Aug 2021 21:32:43 BST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: Drop _DSM 5 from expected DSDTs on ARM Revert "acpi/gpex: Inform os to keep firmware resource map" arm/acpi: allow DSDT changes acpi: x86: pcihp: add support hotplug on multifunction bridges hw/pcie-root-port: Fix hotplug for PCI devices requiring IO Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/i386/acpi-build.c44
-rw-r--r--hw/pci-bridge/gen_pcie_root_port.c5
-rw-r--r--hw/pci-host/gpex-acpi.c20
-rw-r--r--tests/data/acpi/microvm/DSDT.pciebin3031 -> 3023 bytes
-rw-r--r--tests/data/acpi/virt/DSDTbin5204 -> 5196 bytes
-rw-r--r--tests/data/acpi/virt/DSDT.memhpbin6565 -> 6557 bytes
-rw-r--r--tests/data/acpi/virt/DSDT.numamembin5204 -> 5196 bytes
-rw-r--r--tests/data/acpi/virt/DSDT.pxbbin7695 -> 7679 bytes
8 files changed, 37 insertions, 32 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 17836149fe..a33ac8b91e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -374,7 +374,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
Aml *dev, *notify_method = NULL, *method;
QObject *bsel;
PCIBus *sec;
- int i;
+ int devfn;
bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL);
if (bsel) {
@@ -384,23 +384,31 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED);
}
- for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
+ for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) {
DeviceClass *dc;
PCIDeviceClass *pc;
- PCIDevice *pdev = bus->devices[i];
- int slot = PCI_SLOT(i);
+ PCIDevice *pdev = bus->devices[devfn];
+ int slot = PCI_SLOT(devfn);
+ int func = PCI_FUNC(devfn);
+ /* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */
+ int adr = slot << 16 | func;
bool hotplug_enabled_dev;
bool bridge_in_acpi;
bool cold_plugged_bridge;
if (!pdev) {
- if (bsel) { /* add hotplug slots for non present devices */
+ /*
+ * add hotplug slots for non present devices.
+ * hotplug is supported only for non-multifunction device
+ * so generate device description only for function 0
+ */
+ if (bsel && !func) {
if (pci_bus_is_express(bus) && slot > 0) {
break;
}
- dev = aml_device("S%.02X", PCI_DEVFN(slot, 0));
+ dev = aml_device("S%.02X", devfn);
aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
- aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
+ aml_append(dev, aml_name_decl("_ADR", aml_int(adr)));
method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
aml_append(method,
aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
@@ -436,9 +444,18 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
continue;
}
- /* start to compose PCI slot descriptor */
- dev = aml_device("S%.02X", PCI_DEVFN(slot, 0));
- aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
+ /*
+ * allow describing coldplugged bridges in ACPI even if they are not
+ * on function 0, as they are not unpluggable, for all other devices
+ * generate description only for function 0 per slot
+ */
+ if (func && !bridge_in_acpi) {
+ continue;
+ }
+
+ /* start to compose PCI device descriptor */
+ dev = aml_device("S%.02X", devfn);
+ aml_append(dev, aml_name_decl("_ADR", aml_int(adr)));
if (bsel) {
/*
@@ -496,7 +513,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
build_append_pci_bus_devices(dev, sec_bus, pcihp_bridge_en);
}
- /* slot descriptor has been composed, add it into parent context */
+ /* device descriptor has been composed, add it into parent context */
aml_append(parent_scope, dev);
}
@@ -525,13 +542,12 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
/* Notify about child bus events in any case */
if (pcihp_bridge_en) {
QLIST_FOREACH(sec, &bus->child, sibling) {
- int32_t devfn = sec->parent_dev->devfn;
-
if (pci_bus_is_root(sec)) {
continue;
}
- aml_append(method, aml_name("^S%.02X.PCNT", devfn));
+ aml_append(method, aml_name("^S%.02X.PCNT",
+ sec->parent_dev->devfn));
}
}
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index ec9907917e..20099a8ae3 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -28,6 +28,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GenPCIERootPort, GEN_PCIE_ROOT_PORT)
(GEN_PCIE_ROOT_PORT_AER_OFFSET + PCI_ERR_SIZEOF)
#define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
+#define GEN_PCIE_ROOT_DEFAULT_IO_RANGE 4096
struct GenPCIERootPort {
/*< private >*/
@@ -75,6 +76,7 @@ static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
static void gen_rp_realize(DeviceState *dev, Error **errp)
{
PCIDevice *d = PCI_DEVICE(dev);
+ PCIESlot *s = PCIE_SLOT(d);
GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
Error *local_err = NULL;
@@ -85,6 +87,9 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
return;
}
+ if (grp->res_reserve.io == -1 && s->hotplug && !s->native_hotplug) {
+ grp->res_reserve.io = GEN_PCIE_ROOT_DEFAULT_IO_RANGE;
+ }
int rc = pci_bridge_qemu_reserve_cap_init(d, 0,
grp->res_reserve, errp);
diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c
index 0f01f13a6e..e7e162a00a 100644
--- a/hw/pci-host/gpex-acpi.c
+++ b/hw/pci-host/gpex-acpi.c
@@ -112,26 +112,10 @@ static void acpi_dsdt_add_pci_osc(Aml *dev)
UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
ifctx = aml_if(aml_equal(aml_arg(0), UUID));
ifctx1 = aml_if(aml_equal(aml_arg(2), aml_int(0)));
- uint8_t byte_list[] = {
- 0x1 << 0 /* support for functions other than function 0 */ |
- 0x1 << 5 /* support for function 5 */
- };
- buf = aml_buffer(ARRAY_SIZE(byte_list), byte_list);
+ uint8_t byte_list[1] = {1};
+ buf = aml_buffer(1, byte_list);
aml_append(ifctx1, aml_return(buf));
aml_append(ifctx, ifctx1);
-
- /*
- * PCI Firmware Specification 3.1
- * 4.6.5. _DSM for Ignoring PCI Boot Configurations
- */
- /* Arg2: Function Index: 5 */
- ifctx1 = aml_if(aml_equal(aml_arg(2), aml_int(5)));
- /*
- * 0 - The operating system must not ignore the PCI configuration that
- * firmware has done at boot time.
- */
- aml_append(ifctx1, aml_return(aml_int(0)));
- aml_append(ifctx, ifctx1);
aml_append(method, ifctx);
byte_list[0] = 0;
diff --git a/tests/data/acpi/microvm/DSDT.pcie b/tests/data/acpi/microvm/DSDT.pcie
index 3fb373fd97..765f14ef3d 100644
--- a/tests/data/acpi/microvm/DSDT.pcie
+++ b/tests/data/acpi/microvm/DSDT.pcie
Binary files differ
diff --git a/tests/data/acpi/virt/DSDT b/tests/data/acpi/virt/DSDT
index 134d8ae5b6..c475039907 100644
--- a/tests/data/acpi/virt/DSDT
+++ b/tests/data/acpi/virt/DSDT
Binary files differ
diff --git a/tests/data/acpi/virt/DSDT.memhp b/tests/data/acpi/virt/DSDT.memhp
index 140976b23e..bae36cdd39 100644
--- a/tests/data/acpi/virt/DSDT.memhp
+++ b/tests/data/acpi/virt/DSDT.memhp
Binary files differ
diff --git a/tests/data/acpi/virt/DSDT.numamem b/tests/data/acpi/virt/DSDT.numamem
index 134d8ae5b6..c475039907 100644
--- a/tests/data/acpi/virt/DSDT.numamem
+++ b/tests/data/acpi/virt/DSDT.numamem
Binary files differ
diff --git a/tests/data/acpi/virt/DSDT.pxb b/tests/data/acpi/virt/DSDT.pxb
index 46b9c4cad5..fbd78f44c4 100644
--- a/tests/data/acpi/virt/DSDT.pxb
+++ b/tests/data/acpi/virt/DSDT.pxb
Binary files differ