Received: from eggs.gnu.org ([2001:4830:134:3::10]:50501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtwn-00057T-8n for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:43:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCtwf-00059s-Vf for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:43:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtwf-00059n-Mm for qemu-devel@nongnu.org; Mon, 10 Feb 2014 11:42:57 -0500 Date: Mon, 10 Feb 2014 18:47:53 +0200 From: "Michael S. Tsirkin" Message-ID: <1392050814-31814-5-git-send-email-mst@redhat.com> References: <1392050814-31814-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1392050814-31814-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 04/20] pcihp: make pci_read() mmio calback compatible with legacy ACPI hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Anthony Liguori , Igor Mammedov From: Igor Mammedov due to recent change introduced by: "pcihp: reduce number of device check events" 'up' field is cleared right after it's read. This is incompatible with legacy BIOS ACPI code where PCNF ACPI method reads this field 32 times. To make pci_read mmio callback compatible with legacy 'up' behavior, pcihp code will need to know in which mode it runs add 'legacy_piix' field to AcpiPciHpState structure and alter register behavior accordingly. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/pcihp.h | 3 ++- hw/acpi/pcihp.c | 7 +++++-- hw/acpi/piix4.c | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index aa297c2..02d3ce3 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -46,10 +46,11 @@ typedef struct AcpiPciHpState { uint32_t hotplug_select; PCIBus *root; MemoryRegion io; + bool legacy_piix; } AcpiPciHpState; void acpi_pcihp_init(AcpiPciHpState *, PCIBus *root, - MemoryRegion *address_space_io); + MemoryRegion *address_space_io, bool bridges_enabled); /* Invoke on device hotplug */ int acpi_pcihp_device_hotplug(AcpiPciHpState *, PCIDevice *, diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 64c8cf2..974f01c 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -215,7 +215,9 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size) switch (addr) { case PCI_UP_BASE: val = s->acpi_pcihp_pci_status[bsel].up; - s->acpi_pcihp_pci_status[bsel].up = 0; + if (!s->legacy_piix) { + s->acpi_pcihp_pci_status[bsel].up = 0; + } ACPI_PCIHP_DPRINTF("pci_up_read %" PRIu32 "\n", val); break; case PCI_DOWN_BASE: @@ -273,9 +275,10 @@ static const MemoryRegionOps acpi_pcihp_io_ops = { }; void acpi_pcihp_init(AcpiPciHpState *s, PCIBus *root_bus, - MemoryRegion *address_space_io) + MemoryRegion *address_space_io, bool bridges_enabled) { s->root= root_bus; + s->legacy_piix = !bridges_enabled; memory_region_init_io(&s->io, NULL, &acpi_pcihp_io_ops, s, "acpi-pci-hotplug", PCI_HOTPLUG_SIZE); diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 5d55a3c..2aedfe5 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -695,7 +695,8 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe); if (s->use_acpi_pci_hotplug) { - acpi_pcihp_init(&s->acpi_pci_hotplug, bus, parent); + acpi_pcihp_init(&s->acpi_pci_hotplug, bus, parent, + s->use_acpi_pci_hotplug); } else { memory_region_init_io(&s->io_pci, OBJECT(s), &piix4_pci_ops, s, "acpi-pci-hotplug", PCI_HOTPLUG_SIZE); -- MST