Skip to contentSkip to conversation

target/i386/helper: Minor #ifdef'ry simplifications

PATCH In review Philippe Mathieu-Daudé 2 participants 4 messages Jun 2, 2023 – Jun 3, 2023

lore
Share & tools
lore
#0 lore raw

cover target/i386/helper: Minor #ifdef'ry simplifications

Not very interesting code shuffle, but this was in the way of another big cleanup. So sending apart.

BTW this file isn't covered in MAINTAINERS:

  $ ./scripts/get_maintainer.pl -f target/i386/helper.c
  get_maintainer.pl: No maintainers found

Philippe Mathieu-Daudé (2):
target/i386/helper: Remove do_cpu_sipi() stub for user-mode emulation target/i386/helper: Shuffle do_cpu_init()

 target/i386/cpu.h    |  3 ++-
 target/i386/helper.c | 15 ++++-----------
 2 files changed, 6 insertions(+), 12 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/2 target/i386/helper: Remove do_cpu_sipi() stub for user-mode emulation

Since commit 604664726f ("target/i386: Restrict cpu_exec_interrupt() handler to sysemu"), do_cpu_sipi() isn't called anymore on user emulation. Remove the now pointless stub.

---
 target/i386/cpu.h    | 3 ++-
 target/i386/helper.c | 3 ---
 2 files changed, 2 insertions(+), 4 deletions(-)
target/i386/cpu.h +2 -1
index 7201a71de8..cd047e0410 100644
@@ -2285,7 +2285,6 @@ static inline void cpu_get_tb_cpu_state(CPUX86State *env, target_ulong *pc,
 }
 
 void do_cpu_init(X86CPU *cpu);
-void do_cpu_sipi(X86CPU *cpu);
 
 #define MCE_INJECT_BROADCAST    1
 #define MCE_INJECT_UNCOND_AO    2
@@ -2419,6 +2418,8 @@ void x86_cpu_set_default_version(X86CPUVersion version);
 
 #ifndef CONFIG_USER_ONLY
 
+void do_cpu_sipi(X86CPU *cpu);
+
 #define APIC_DEFAULT_ADDRESS 0xfee00000
 #define APIC_SPACE_SIZE      0x100000
 
target/i386/helper.c +0 -3
index 36bf2107e7..792c8eb45e 100644
@@ -611,9 +611,6 @@ void do_cpu_sipi(X86CPU *cpu)
 void do_cpu_init(X86CPU *cpu)
 {
 }
-void do_cpu_sipi(X86CPU *cpu)
-{
-}
 #endif
 
 #ifndef CONFIG_USER_ONLY
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/2 target/i386/helper: Shuffle do_cpu_init()

In reply to Philippe Mathieu-Daudé

Move the #ifdef'ry inside do_cpu_init() instead of declaring an empty stub for user emulation.

---
 target/i386/helper.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
target/i386/helper.c +4 -8
index 792c8eb45e..89aa696c6d 100644
@@ -580,9 +580,9 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector,
     return 1;
 }
 
-#if !defined(CONFIG_USER_ONLY)
 void do_cpu_init(X86CPU *cpu)
 {
+#if !defined(CONFIG_USER_ONLY)
     CPUState *cs = CPU(cpu);
     CPUX86State *env = &cpu->env;
     CPUX86State *save = g_new(CPUX86State, 1);
@@ -601,19 +601,15 @@ void do_cpu_init(X86CPU *cpu)
         kvm_arch_do_init_vcpu(cpu);
     }
     apic_init_reset(cpu->apic_state);
+#endif /* CONFIG_USER_ONLY */
 }
 
+#ifndef CONFIG_USER_ONLY
+
 void do_cpu_sipi(X86CPU *cpu)
 {
     apic_sipi(cpu->apic_state);
 }
-#else
-void do_cpu_init(X86CPU *cpu)
-{
-}
-#endif
-
-#ifndef CONFIG_USER_ONLY
 
 void cpu_load_efer(CPUX86State *env, uint64_t val)
 {
Signature · 1 line
2.38.1
Reviewed-by on the v1 series
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé

Not very interesting code shuffle, but this was in the way of another big cleanup. So sending apart.

BTW this file isn't covered in MAINTAINERS:

   $ ./scripts/get_maintainer.pl -f target/i386/helper.c
   get_maintainer.pl: No maintainers found
Quoted 8 lines

Philippe Mathieu-Daudé (2):
target/i386/helper: Remove do_cpu_sipi() stub for user-mode emulation target/i386/helper: Shuffle do_cpu_init()

  target/i386/cpu.h    |  3 ++-
  target/i386/helper.c | 15 ++++-----------
  2 files changed, 6 insertions(+), 12 deletions(-)

r~