qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] hw/i386: Add the possibility to disable the 'isapc' machine


From: Thomas Huth
Subject: Re: [PATCH] hw/i386: Add the possibility to disable the 'isapc' machine
Date: Thu, 13 Jan 2022 07:57:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

On 07/01/2022 19.54, Philippe Mathieu-Daudé wrote:
On 1/7/22 17:07, Thomas Huth wrote:
We already have a CONFIG_ISAPC switch - but we're not using it yet.
Add some "#ifdefs" to make it possible to disable this machine now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
  hw/i386/pc_piix.c        | 5 ++++-
  tests/qtest/cdrom-test.c | 2 +-
  2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 1999190276..5147e1ee74 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -357,10 +357,12 @@ static void pc_compat_1_4_fn(MachineState *machine)
      pc_compat_1_5_fn(machine);
  }
+#ifdef CONFIG_ISAPC
  static void pc_init_isa(MachineState *machine)
  {
      pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE);
  }
+#endif
#ifdef CONFIG_XEN
  static void pc_xen_hvm_init_pci(MachineState *machine)
@@ -916,6 +918,7 @@ void igd_passthrough_isa_bridge_create(PCIBus *bus, 
uint16_t gpu_dev_id)
      pci_config_set_revision(bridge_dev->config, pch_rev_id);
  }
+#ifdef CONFIG_ISAPC
  static void isapc_machine_options(MachineClass *m)
  {
      PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
@@ -935,7 +938,7 @@ static void isapc_machine_options(MachineClass *m)
DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
                    isapc_machine_options);
-
+#endif

Wouldn't it be cleaner to extract the isapc machine to a new C unit
(after renaming/declaring pc_init1 public)?

That would be cleaner, of course, but that would also mean a major refactoring: We could rearrange the code so that it is possible to compile a binary that has isapc, but not i440fx... but that likely means a complete rework of pc_piix.c so that the code that is common between i440fx and isapc needs to be moved into a separate file, too. And that's likely not worth the effort, I guess, since people rather want to compile without isapc than compiling without i440fx, I think. So let's go with this low-hanging fruit here for now, and keep the possible clean-up in mind for later.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thanks!

 Thomas





reply via email to

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