diff mbox series

[08/13] i386: correctly select code in hw/i386 that depends on other components

Message ID 20240509170044.190795-9-pbonzini@redhat.com
State New
Headers show
Series fix --without-default-devices build and (mostly) tests | expand

Commit Message

Paolo Bonzini May 9, 2024, 5 p.m. UTC
fw_cfg.c and vapic.c are currently included unconditionally but
depend on other components.  vapic.c depends on the local APIC,
while fw_cfg.c includes a piece of AML builder code that depends
on CONFIG_ACPI.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/fw_cfg.c    | 2 ++
 hw/i386/meson.build | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Zhao Liu May 10, 2024, 12:15 p.m. UTC | #1
On Thu, May 09, 2024 at 07:00:39PM +0200, Paolo Bonzini wrote:
> Date: Thu,  9 May 2024 19:00:39 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 08/13] i386: correctly select code in hw/i386 that depends
>  on other components
> X-Mailer: git-send-email 2.45.0
> 
> fw_cfg.c and vapic.c are currently included unconditionally but
> depend on other components.  vapic.c depends on the local APIC,
> while fw_cfg.c includes a piece of AML builder code that depends
> on CONFIG_ACPI.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/i386/fw_cfg.c    | 2 ++
>  hw/i386/meson.build | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
diff mbox series

Patch

diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index d802d2787f0..6e0d9945d07 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -203,6 +203,7 @@  void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg)
     fw_cfg_add_file(fw_cfg, "etc/msr_feature_control", val, sizeof(*val));
 }
 
+#ifdef CONFIG_ACPI
 void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)
 {
     /*
@@ -229,3 +230,4 @@  void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)
     aml_append(dev, aml_name_decl("_CRS", crs));
     aml_append(scope, dev);
 }
+#endif
diff --git a/hw/i386/meson.build b/hw/i386/meson.build
index d8b70ef3e9c..d9da676038c 100644
--- a/hw/i386/meson.build
+++ b/hw/i386/meson.build
@@ -1,12 +1,12 @@ 
 i386_ss = ss.source_set()
 i386_ss.add(files(
   'fw_cfg.c',
-  'vapic.c',
   'e820_memory_layout.c',
   'multiboot.c',
   'x86.c',
 ))
 
+i386_ss.add(when: 'CONFIG_APIC', if_true: files('vapic.c'))
 i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'),
                                       if_false: files('x86-iommu-stub.c'))
 i386_ss.add(when: 'CONFIG_AMD_IOMMU', if_true: files('amd_iommu.c'),