[PATCH v2 10/12] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always false in pc_init_isa()

Mark Cave-Ayland posted 12 patches 5 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
There is a newer version of this series
[PATCH v2 10/12] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always false in pc_init_isa()
Posted by Mark Cave-Ayland 5 months ago
By definition PCI can never be enabled on an isapc machine so hardcode the relevant values
set via pcmc->pci_enabled.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
 hw/i386/pc_piix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 03bd09f680..279eab10ce 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -462,7 +462,7 @@ static void pc_init_isa(MachineState *machine)
         }
     }
 
-    gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
+    gsi_state = pc_gsi_create(&x86ms->gsi, false);
 
     isa_bus = isa_bus_new(NULL, system_memory, system_io,
                             &error_abort);
@@ -483,7 +483,7 @@ static void pc_init_isa(MachineState *machine)
         x86_register_ferr_irq(x86ms->gsi[13]);
     }
 
-    pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL);
+    pc_vga_init(isa_bus, NULL);
 
     /* init basic PC hardware */
     pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc,
-- 
2.43.0
Re: [PATCH v2 10/12] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always false in pc_init_isa()
Posted by Bernhard Beschow 4 months, 3 weeks ago

Am 18. Juni 2025 11:27:15 UTC schrieb Mark Cave-Ayland <mark.caveayland@nutanix.com>:
>By definition PCI can never be enabled on an isapc machine so hardcode the relevant values
>set via pcmc->pci_enabled.

The inverse should be true now for pc-i440fx, so a similar patch is needed there as well.

Best regards,
Bernhard

>
>Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>---
> hw/i386/pc_piix.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
>index 03bd09f680..279eab10ce 100644
>--- a/hw/i386/pc_piix.c
>+++ b/hw/i386/pc_piix.c
>@@ -462,7 +462,7 @@ static void pc_init_isa(MachineState *machine)
>         }
>     }
> 
>-    gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
>+    gsi_state = pc_gsi_create(&x86ms->gsi, false);
> 
>     isa_bus = isa_bus_new(NULL, system_memory, system_io,
>                             &error_abort);
>@@ -483,7 +483,7 @@ static void pc_init_isa(MachineState *machine)
>         x86_register_ferr_irq(x86ms->gsi[13]);
>     }
> 
>-    pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL);
>+    pc_vga_init(isa_bus, NULL);
> 
>     /* init basic PC hardware */
>     pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc,
Re: [PATCH v2 10/12] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always false in pc_init_isa()
Posted by Mark Cave-Ayland 4 months, 2 weeks ago
On 23/06/2025 11:51, Bernhard Beschow wrote:

> Am 18. Juni 2025 11:27:15 UTC schrieb Mark Cave-Ayland <mark.caveayland@nutanix.com>:
>> By definition PCI can never be enabled on an isapc machine so hardcode the relevant values
>> set via pcmc->pci_enabled.
> 
> The inverse should be true now for pc-i440fx, so a similar patch is needed there as well.
> 
> Best regards,
> Bernhard

Good point. I've added a new patch that does this in v3 (soon to be 
posted). It certainly seems like a nice cleanup, and I think that 
further tidy-ups are possible in future if you can assume that PCI is 
always present.


ATB,

Mark.
Re: [PATCH v2 10/12] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always false in pc_init_isa()
Posted by Philippe Mathieu-Daudé 4 months, 4 weeks ago
On 18/6/25 13:27, Mark Cave-Ayland wrote:
> By definition PCI can never be enabled on an isapc machine so hardcode the relevant values
> set via pcmc->pci_enabled.
> 
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
>   hw/i386/pc_piix.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>