[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/28] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 14/28] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice |
Date: |
Tue, 7 Feb 2017 17:51:57 +0400 |
From: Igor Mammedov <address@hidden>
PCI hotplug for bridges was introduced only since 2.0 however
acpi_set_bsel()->object_property_add_uint32_ptr(bus, ACPI_PCIHP_PROP_BSEL)
didn't take in account that for legacy mode (1.7) when
PCI hotplug for bridges is unavailable and ACPI_PCIHP_PROP_BSEL property
the only bus "PCI.0' has been created earlier at acpi_pcihp_init() time.
We managed to live with it only because of error rised by adding
a duplicate property in acpi_set_bsel() has been ignored which
resulted in useless leaking of just allocated (int)bus_bsel.
Issue affects only 1.7 machine type as ACPI tables supported by
QEMU were introduced at that time, but there wasn't PCI hotplug
for bridges till the next release (2.0).
Fix it by removing duplicate ACPI_PCIHP_PROP_BSEL intialization
in acpi_pcihp_init() and doing it only in one place acpi_set_pci_info().
PS:
do not ignore error returned by object_property_add_uint32_ptr()
and abort QEMU since it's programming error which should be fixed
instead of being ignored.
Signed-off-by: Igor Mammedov <address@hidden>
Reported-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
[ Marc-André - Remove now unused ACPI_PCIHP_LEGACY_SIZE ]
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/acpi/pcihp.c | 11 -----------
hw/i386/acpi-build.c | 4 ++--
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index d957d1e30d..2b0f3e1bfb 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -49,7 +49,6 @@
#define ACPI_PCIHP_ADDR 0xae00
#define ACPI_PCIHP_SIZE 0x0014
-#define ACPI_PCIHP_LEGACY_SIZE 0x000f
#define PCI_UP_BASE 0x0000
#define PCI_DOWN_BASE 0x0004
#define PCI_EJ_BASE 0x0008
@@ -302,16 +301,6 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s,
PCIBus *root_bus,
s->root= root_bus;
s->legacy_piix = !bridges_enabled;
- if (s->legacy_piix) {
- unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);
-
- s->io_len = ACPI_PCIHP_LEGACY_SIZE;
-
- *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;
- object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,
- bus_bsel, NULL);
- }
-
memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s,
"acpi-pci-hotplug", s->io_len);
memory_region_add_subregion(address_space_io, s->io_base, &s->io);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1c928abb28..f44767b9be 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -462,7 +462,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)
*bus_bsel = (*bsel_alloc)++;
object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
- bus_bsel, NULL);
+ bus_bsel, &error_abort);
}
return bsel_alloc;
@@ -471,7 +471,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)
static void acpi_set_pci_info(void)
{
PCIBus *bus = find_i440fx(); /* TODO: Q35 support */
- unsigned bsel_alloc = 0;
+ unsigned bsel_alloc = ACPI_PCIHP_BSEL_DEFAULT;
if (bus) {
/* Scan all PCI buses. Set property to enable acpi based hotplug. */
--
2.11.0.295.gd7dffce1c.dirty
- Re: [Qemu-devel] [PATCH 05/28] tests: fix ptimer leaks, (continued)
- [Qemu-devel] [PATCH 06/28] tests: fix endianness-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 07/28] tests: fix q35-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 08/28] tests: fix vhost-user-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 09/28] tests: fix ide-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 10/28] tests: fix hd-geo-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 11/28] tests: fix bios-tables-test leak, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 12/28] tests: fix ipmi-kcs-test leak, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 13/28] tests: fix ipmi-bt-test leak, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 15/28] tests: fix eepro100-test leak, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 14/28] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 16/28] tests: fix tco-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 17/28] tests: fix e1000-test leak, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 18/28] tests: fix i440fx-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 19/28] tests: fix e1000e leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 20/28] tests: fix virtio-scsi-test leak, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 21/28] tests: fix virtio-9p-test leaks, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 22/28] bus: do not unref hotplug handler, Marc-André Lureau, 2017/02/07
- [Qemu-devel] [PATCH 23/28] usb: replace handle_destroy with unrealize, Marc-André Lureau, 2017/02/07