Skip to contentSkip to conversation

accel: Build stubs once

PATCH In review Philippe Mathieu-Daudé 2 participants 5 messages Mar 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover accel: Build stubs once

v2: Expose kvm_irqchip*notifier() declarations

Philippe Mathieu-Daudé (2):
system/kvm: Make kvm_irqchip*notifier() declaration non
target-specific
accel: Build stubs once

 include/system/kvm.h    |  8 ++++----
 accel/stubs/meson.build | 21 ++++++++++-----------
 2 files changed, 14 insertions(+), 15 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/2 system/kvm: Make kvm_irqchip*notifier() declaration non target-specific

Commit 3607715a308 ("kvm: Introduce KVM irqchip change notifier") restricted the kvm_irqchip*notifier() declarations to target-specific files, guarding them under the NEED_CPU_H (later renamed as COMPILING_PER_TARGET) #ifdef check.

This however prohibit building the kvm-stub.c file once:

../accel/stubs/kvm-stub.c:70:6: error: no previous prototype for function 'kvm_irqchip_add_change_notifier' [-Werror,-Wmissing-prototypes]
70 | void kvm_irqchip_add_change_notifier(Notifier *n)
| ^
../accel/stubs/kvm-stub.c:74:6: error: no previous prototype for function 'kvm_irqchip_remove_change_notifier' [-Werror,-Wmissing-prototypes]
74 | void kvm_irqchip_remove_change_notifier(Notifier *n)
| ^
../accel/stubs/kvm-stub.c:78:6: error: no previous prototype for function 'kvm_irqchip_change_notify' [-Werror,-Wmissing-prototypes]
78 | void kvm_irqchip_change_notify(void)
| ^

Since nothing in these prototype declarations is target specific, move them around to be generically available, allowing to build kvm-stub.c once for all targets in the next commit.

---
 include/system/kvm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/system/kvm.h +4 -4
index 4b0e1b4ab14..5fa33eddda3 100644
@@ -219,6 +219,10 @@ int kvm_vm_ioctl(KVMState *s, unsigned long type, ...);
 
 void kvm_flush_coalesced_mmio_buffer(void);
 
+void kvm_irqchip_add_change_notifier(Notifier *n);
+void kvm_irqchip_remove_change_notifier(Notifier *n);
+void kvm_irqchip_change_notify(void);
+
 #ifdef COMPILING_PER_TARGET
 #include "cpu.h"
 
@@ -393,10 +397,6 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg);
 
 void kvm_irqchip_add_irq_route(KVMState *s, int gsi, int irqchip, int pin);
 
-void kvm_irqchip_add_change_notifier(Notifier *n);
-void kvm_irqchip_remove_change_notifier(Notifier *n);
-void kvm_irqchip_change_notify(void);
-
 struct kvm_guest_debug;
 struct kvm_debug_exit_arch;
 
Signature · 1 line
2.53.0
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] system/kvm: Make kvm_irqchip*notifier() declaration non target-specific

Quoted 17 lines · Philippe Mathieu-Daudé

Commit 3607715a308 ("kvm: Introduce KVM irqchip change notifier") restricted the kvm_irqchip*notifier() declarations to target-specific files, guarding them under the NEED_CPU_H (later renamed as COMPILING_PER_TARGET) #ifdef check.

This however prohibit building the kvm-stub.c file once:

../accel/stubs/kvm-stub.c:70:6: error: no previous prototype for function 'kvm_irqchip_add_change_notifier' [-Werror,-Wmissing-prototypes]
70 | void kvm_irqchip_add_change_notifier(Notifier *n)
| ^
../accel/stubs/kvm-stub.c:74:6: error: no previous prototype for function 'kvm_irqchip_remove_change_notifier' [-Werror,-Wmissing-prototypes]
74 | void kvm_irqchip_remove_change_notifier(Notifier *n)
| ^
../accel/stubs/kvm-stub.c:78:6: error: no previous prototype for function 'kvm_irqchip_change_notify' [-Werror,-Wmissing-prototypes]
78 | void kvm_irqchip_change_notify(void)
| ^

Quoted 9 lines

Since nothing in these prototype declarations is target specific, move them around to be generically available, allowing to build kvm-stub.c once for all targets in the next commit.

---
  include/system/kvm.h | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
#3 lore raw

PATCH v2 2/2 accel: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
 accel/stubs/meson.build | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
accel/stubs/meson.build +10 -11
index 5de4a279ff9..ccad583e647 100644
@@ -1,11 +1,10 @@
-system_stubs_ss = ss.source_set()
-system_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_HVF', if_false: files('hvf-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_NITRO', if_false: files('nitro-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_NVMM', if_false: files('nvmm-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_WHPX', if_false: files('whpx-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_MSHV', if_false: files('mshv-stub.c'))
-
-specific_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: system_stubs_ss)
+stub_ss.add(files(
+  'hvf-stub.c',
+  'kvm-stub.c',
+  'nitro-stub.c',
+  'mshv-stub.c',
+  'nvmm-stub.c',
+  'tcg-stub.c',
+  'whpx-stub.c',
+  'xen-stub.c',
+))
Signature · 1 line
2.53.0
Reviewed-by on v2 2/2
#4 lore raw
Quoted 11 lines · Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
  accel/stubs/meson.build | 21 ++++++++++-----------
  1 file changed, 10 insertions(+), 11 deletions(-)