qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/7] hw/ide/piix: Use generic ide_init_ioport()


From: Bernhard Beschow
Subject: Re: [PATCH 5/7] hw/ide/piix: Use generic ide_init_ioport()
Date: Thu, 9 Feb 2023 10:04:49 +0100



On Wed, Feb 8, 2023 at 1:08 AM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
TYPE_PIIX3_IDE is a PCI function inheriting from QOM
TYPE_PCI_DEVICE. To be able to call the ISA specific
ide_init_ioport_isa(), we call this function passing
a NULL ISADevice argument. Remove this hack by calling
the recently added generic ide_init_ioport(), which
doesn't expect any ISADevice.

Inspired-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ide/piix.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index a587541bb2..1cd4389611 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -136,15 +136,13 @@ static int pci_piix_init_ports(PCIIDEState *d)
         {0x1f0, 0x3f6, 14},
         {0x170, 0x376, 15},
     };
-    int i, ret;
+    int i;

     for (i = 0; i < 2; i++) {
         ide_bus_init(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
-        ret = ide_init_ioport_isa(&d->bus[i], NULL,
-                                  port_info[i].iobase, port_info[i].iobase2);
-        if (ret) {
-            return ret;
-        }
+        ide_init_ioport(&d->bus[i], OBJECT(d),
+                        pci_address_space_io(PCI_DEVICE(d)),
+                        port_info[i].iobase, port_info[i].iobase2);
         ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));

         bmdma_init(&d->bus[i], &d->bmdma[i], d);
--
2.38.1

This patch essentially circumvents the mitigations introduced by https://lore.kernel.org/qemu-devel/20210416125256.2039734-1-thuth@redhat.com/ "hw/ide: Fix crash when plugging a piix3-ide device into the x-remote machine": `qemu-system-x86_64 -M x-remote -device piix3-ide` now crashes. This has been considered in https://lore.kernel.org/qemu-devel/20230126211740.66874-1-shentey@gmail.com/ -- see cover letter there. TBH it's not entirely clear to me why we need two competing series here at all.

Best regards,
Bernhard

reply via email to

[Prev in Thread] Current Thread [Next in Thread]