Skip to contentSkip to conversation

accel: Remove system-mode stubs from user-mode builds

PATCH In review Philippe Mathieu-Daudé 3 participants 8 messages Nov 9, 2020

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

cover accel: Remove system-mode stubs from user-mode builds

It is pointless to build/link these stubs into user-mode binaries.

Philippe Mathieu-Daudé (3):
accel: Only include TCG stubs in user-mode only builds accel/stubs: Restrict system-mode emulation stubs accel/stubs: Simplify kvm-stub.c

 accel/stubs/kvm-stub.c  |  5 -----
 accel/meson.build       | 10 ++++++----
 accel/stubs/meson.build | 12 ++++++++----
 3 files changed, 14 insertions(+), 13 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/3 accel: Only include TCG stubs in user-mode only builds

We only require TCG stubs in user-mode emulation. Do not build stubs restricted to system-mode emulation in a user-mode only build.

---
 accel/meson.build | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
accel/meson.build +6 -4
index b26cca227a4..609772f129b 100644
@@ -1,10 +1,12 @@
 softmmu_ss.add(files('accel.c'))
 
-subdir('qtest')
-subdir('kvm')
 subdir('tcg')
-subdir('xen')
-subdir('stubs')
+if have_system
+  subdir('qtest')
+  subdir('kvm')
+  subdir('xen')
+  subdir('stubs')
+endif
 
 dummy_ss = ss.source_set()
 dummy_ss.add(files(
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds

Quoted 21 lines · Philippe Mathieu-Daudé

We only require TCG stubs in user-mode emulation. Do not build stubs restricted to system-mode emulation in a user-mode only build.

---
 accel/meson.build | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
accel/meson.build +0 -3
index b26cca227a4..609772f129b 100644
@@ -1,10 +1,12 @@
 softmmu_ss.add(files('accel.c'))
 
-subdir('qtest')
-subdir('kvm')
 subdir('tcg')
-subdir('xen')

accel/meson.build line 12

Quoted 10 lines
accel/meson.build +6 -1
-subdir('stubs')
+if have_system
+  subdir('qtest')
+  subdir('kvm')
+  subdir('xen')
+  subdir('stubs')
+endif
 
 dummy_ss = ss.source_set()
 dummy_ss.add(files(

Ciao Philippe,

I thought that the pattern used by Paolo was, recurse always, and put the check inside the recursed dir meson.build . Paolo did you indeed intend meson use this way?

Ciao,

Claudio

maintainer
#3 lore raw

Re: [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds

Quoted 5 lines · Claudio Fontana

Ciao Philippe,

I thought that the pattern used by Paolo was, recurse always, and put the check inside the recursed dir meson.build . Paolo did you indeed intend meson use this way?

Generally yeah, I preferred to recurse always. In this specific case, however, an even bigger qualm with the patch is that the patch content does not match the commit message.

I also don't understand why it's useful, because patch 2 makes everything conditional on CONFIG_SOFTMMU.

Paolo

#4 lore raw

PATCH 2/3 accel/stubs: Restrict system-mode emulation stubs

In reply to Philippe Mathieu-Daudé

This system-mode emulation stubs are not require in user-mode binaries. Restrict them to system-mode binaries.

---
 accel/stubs/meson.build | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
accel/stubs/meson.build +8 -4
index 12dd1539afa..a83408bc0a7 100644
@@ -1,4 +1,8 @@
-specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
-specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
-specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
-specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+accel_stubs_ss = ss.source_set()
+
+accel_stubs_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+
+specific_ss.add_all(when: ['CONFIG_SOFTMMU'], if_true: accel_stubs_ss)
Signature · 1 line
2.26.2
#5 lore raw

Re: [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs

Quoted 1 line · Philippe Mathieu-Daudé

This system-mode emulation stubs are not require

nit: s,require,required,

Quoted 26 lines

in user-mode binaries. Restrict them to system-mode binaries.

---
 accel/stubs/meson.build | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
accel/stubs/meson.build +8 -4
index 12dd1539afa..a83408bc0a7 100644
@@ -1,4 +1,8 @@
-specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
-specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
-specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
-specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+accel_stubs_ss = ss.source_set()
+
+accel_stubs_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+
+specific_ss.add_all(when: ['CONFIG_SOFTMMU'], if_true: accel_stubs_ss)
#6 lore raw

PATCH 3/3 accel/stubs: Simplify kvm-stub.c

In reply to Philippe Mathieu-Daudé

Now than kvm-stub.c is only built on system-mode emulation, we can simplify its #ifdef'ry.

---
 accel/stubs/kvm-stub.c | 5 -----
 1 file changed, 5 deletions(-)
accel/stubs/kvm-stub.c +0 -5
index 680e0994637..68fdfce50ed 100644
@@ -13,10 +13,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "sysemu/kvm.h"
-
-#ifndef CONFIG_USER_ONLY
 #include "hw/pci/msi.h"
-#endif
 
 KVMState *kvm_state;
 bool kvm_kernel_irqchip;
@@ -91,7 +88,6 @@ int kvm_memcrypt_encrypt_data(uint8_t *ptr, uint64_t len)
   return 1;
 }
 
-#ifndef CONFIG_USER_ONLY
 int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
 {
     return -ENOSYS;
@@ -158,4 +154,3 @@ bool kvm_arm_supports_user_irq(void)
 {
     return false;
 }
-#endif
Signature · 1 line
2.26.2
maintainer
#7 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

It is pointless to build/link these stubs into user-mode binaries.

Philippe Mathieu-Daudé (3):
accel: Only include TCG stubs in user-mode only builds accel/stubs: Restrict system-mode emulation stubs accel/stubs: Simplify kvm-stub.c

Quoted 5 lines
  accel/stubs/kvm-stub.c  |  5 -----
  accel/meson.build       | 10 ++++++----
  accel/stubs/meson.build | 12 ++++++++----
  3 files changed, 14 insertions(+), 13 deletions(-)

The series makes sense. It probably also shows that it makes sense to have a "specific_softmmu_ss" sourceset in meson.build. Let's review Alex Bennée's patches and then get back to this one.

Paolo