Skip to contentSkip to conversation

bulk: Replace !CONFIG_SOFTMMU and !CONFIG_USER_ONLY

RFC PATCH Superseded Philippe Mathieu-Daudé 2 participants 8 messages Jun 2, 2023 – Jun 5, 2023

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover bulk: Replace !CONFIG_SOFTMMU and !CONFIG_USER_ONLY

Since CONFIG_SOFTMMU is poisoned, we are using its opposite form via "!CONFIG_USER_ONLY" (because CONFIG_USER_ONLY is not poisoned).
Since patch [2] unpoison CONFIG_SOFTMMU, we can remove the kludge, resulting is a more logical code to review.

Personally I like the resulting code, but I can understand others simply see code churn here, so I'm simply posting as bulk patches. I don't have problem to split if nobody object to this change.

Based-on: [email protected]
"tcg: Build once for system, once for user" (v3)
[1] https://lore.kernel.org/qemu-devel/[email protected]/
[2] https://lore.kernel.org/qemu-devel/[email protected]/

*** BLURB HERE ***

Philippe Mathieu-Daudé (2):
bulk: Replace !CONFIG_SOFTMMU -> CONFIG_USER_ONLY
bulk: Replace !CONFIG_USER_ONLY -> CONFIG_SOFTMMU

 scripts/coccinelle/round.cocci                |   6 +
 include/exec/address-spaces.h                 |   2 +-
 include/exec/confidential-guest-support.h     |   4 +-
 include/exec/cpu-all.h                        |   4 +-
 include/exec/cpu-common.h                     |   4 +-
 include/exec/cpu-defs.h                       |  14 +-
 include/exec/cputlb.h                         |   2 +-
 include/exec/exec-all.h                       |   6 +-
 include/exec/ioport.h                         |   2 +-
 include/exec/memory-internal.h                |   2 +-
 include/exec/memory.h                         |   2 +-
 include/exec/ram_addr.h                       |   2 +-
 include/exec/ramblock.h                       |   2 +-
 include/hw/core/cpu.h                         |  12 +-
 include/hw/core/tcg-cpu-ops.h                 |   8 +-
 include/hw/intc/armv7m_nvic.h                 |   4 +-
 include/hw/s390x/css.h                        |   2 +-
 include/qemu/accel.h                          |   6 +-
 include/semihosting/semihost.h                |   4 +-
 include/sysemu/cpus.h                         |   2 +-
 include/sysemu/xen.h                          |   4 +-
 target/alpha/cpu.h                            |   6 +-
 target/arm/common-semi-target.h               |   2 +-
 target/arm/cpu.h                              |  14 +-
 target/arm/internals.h                        |   6 +-
 target/arm/tcg/arm_ldst.h                     |   2 +-
 target/arm/tcg/translate.h                    |   2 +-
 target/cris/cpu.h                             |   2 +-
 target/hppa/cpu.h                             |   2 +-
 target/hppa/helper.h                          |   2 +-
 target/i386/cpu-internal.h                    |   4 +-
 target/i386/cpu.h                             |  12 +-
 target/i386/helper.h                          |  12 +-
 target/i386/sev.h                             |   2 +-
 target/i386/tcg/helper-tcg.h                  |   4 +-
 target/loongarch/cpu.h                        |   4 +-
 target/loongarch/helper.h                     |   2 +-
 target/loongarch/internals.h                  |   4 +-
 target/m68k/cpu.h                             |   6 +-
 target/microblaze/cpu.h                       |  12 +-
 target/microblaze/helper.h                    |   2 +-
 target/mips/cpu.h                             |   6 +-
 target/mips/helper.h                          |   8 +-
 target/mips/internal.h                        |   4 +-
 target/mips/tcg/tcg-internal.h                |   4 +-
 target/nios2/cpu.h                            |  10 +-
 target/nios2/helper.h                         |   2 +-
 target/openrisc/cpu.h                         |   8 +-
 target/ppc/cpu-qom.h                          |   4 +-
 target/ppc/cpu.h                              |  32 ++---
 target/ppc/helper.h                           |   8 +-
 target/ppc/internal.h                         |   6 +-
 target/ppc/kvm_ppc.h                          |   8 +-
 target/ppc/mmu-book3s-v3.h                    |   2 +-
 target/ppc/mmu-hash32.h                       |   2 +-
 target/ppc/mmu-hash64.h                       |   2 +-
 target/ppc/mmu-radix64.h                      |   2 +-
 target/ppc/power8-pmu.h                       |   2 +-
 target/ppc/spr_common.h                       |   2 +-
 target/riscv/cpu.h                            |  10 +-
 target/riscv/helper.h                         |   4 +-
 target/riscv/internals.h                      |   2 +-
 target/rx/cpu.h                               |   4 +-
 target/s390x/cpu.h                            |   8 +-
 target/s390x/helper.h                         |   2 +-
 target/s390x/s390x-internal.h                 |   8 +-
 target/sh4/cpu.h                              |   2 +-
 target/sparc/cpu.h                            |  10 +-
 target/sparc/helper.h                         |   2 +-
 target/xtensa/cpu.h                           |   6 +-
 target/xtensa/helper.h                        |   4 +-
 target/s390x/tcg/insn-data.h.inc              |   2 +-
 accel/accel-common.c                          |   8 +-
 accel/tcg/cpu-exec.c                          |  24 ++--
 accel/tcg/tcg-all.c                           |   4 +-
 accel/tcg/translate-all.c                     |   2 +-
 cpu.c                                         |   8 +-
 gdbstub/gdbstub.c                             |   8 +-
 plugins/api.c                                 |   4 +-
 plugins/loader.c                              |   4 +-
 semihosting/arm-compat-semi.c                 |  10 +-
 semihosting/guestfd.c                         |   2 +-
 semihosting/syscalls.c                        |   6 +-
 softmmu/memory.c                              |   2 +-
 target/alpha/cpu.c                            |  10 +-
 target/alpha/helper.c                         |   4 +-
 target/alpha/sys_helper.c                     |   4 +-
 target/alpha/translate.c                      |  22 ++--
 target/arm/cpu.c                              |  44 +++----
 target/arm/debug_helper.c                     |   4 +-
 target/arm/gdbstub.c                          |   6 +-
 target/arm/helper.c                           |  48 +++----
 target/arm/tcg/cpu32.c                        |  18 +--
 target/arm/tcg/helper-a64.c                   |   2 +-
 target/arm/tcg/m_helper.c                     |   6 +-
 target/arm/tcg/op_helper.c                    |   2 +-
 target/arm/tcg/sve_helper.c                   |   2 +-
 target/arm/tcg/tlb_helper.c                   |   4 +-
 target/arm/tcg/translate-a64.c                |   2 +-
 target/arm/tcg/translate.c                    |   6 +-
 target/cris/cpu.c                             |  18 +--
 target/cris/op_helper.c                       |   8 +-
 target/cris/translate.c                       |   2 +-
 target/hexagon/genptr.c                       |   2 +-
 target/hppa/cpu.c                             |  14 +-
 target/hppa/helper.c                          |   4 +-
 target/hppa/translate.c                       |  36 ++---
 target/i386/cpu-dump.c                        |   6 +-
 target/i386/cpu.c                             |  42 +++---
 target/i386/gdbstub.c                         |  14 +-
 target/i386/helper.c                          |  14 +-
 target/i386/tcg/bpt_helper.c                  |   2 +-
 target/i386/tcg/excp_helper.c                 |   2 +-
 target/i386/tcg/fpu_helper.c                  |   4 +-
 target/i386/tcg/seg_helper.c                  |   8 +-
 target/i386/tcg/tcg-cpu.c                     |   6 +-
 target/i386/tcg/translate.c                   |   4 +-
 target/loongarch/cpu.c                        |  14 +-
 target/loongarch/op_helper.c                  |   2 +-
 target/m68k/cpu.c                             |   6 +-
 target/m68k/helper.c                          |   4 +-
 target/m68k/op_helper.c                       |   4 +-
 target/microblaze/cpu.c                       |  12 +-
 target/microblaze/helper.c                    |   4 +-
 target/microblaze/op_helper.c                 |   2 +-
 target/microblaze/translate.c                 |  12 +-
 target/mips/cpu.c                             |  18 +--
 target/mips/gdbstub.c                         |   4 +-
 target/mips/tcg/ldst_helper.c                 |   4 +-
 target/mips/tcg/msa_helper.c                  |   2 +-
 target/mips/tcg/op_helper.c                   |   4 +-
 target/mips/tcg/translate.c                   |  26 ++--
 target/nios2/cpu.c                            |  18 +--
 target/nios2/op_helper.c                      |   4 +-
 target/nios2/translate.c                      |  10 +-
 target/openrisc/cpu.c                         |  14 +-
 target/openrisc/interrupt.c                   |   2 +-
 target/openrisc/sys_helper.c                  |  10 +-
 target/ppc/compat.c                           |   2 +-
 target/ppc/cpu.c                              |   2 +-
 target/ppc/cpu_init.c                         | 124 +++++++++---------
 target/ppc/excp_helper.c                      |  17 +--
 target/ppc/gdbstub.c                          |   8 +-
 target/ppc/helper_regs.c                      |  20 +--
 target/ppc/mem_helper.c                       |   2 +-
 target/ppc/misc_helper.c                      |   2 +-
 target/ppc/power8-pmu.c                       |   4 +-
 target/ppc/ppc-qmp-cmds.c                     |   2 +-
 target/ppc/timebase_helper.c                  |   4 +-
 target/ppc/translate.c                        |  62 ++++-----
 target/riscv/cpu.c                            |  66 +++++-----
 target/riscv/cpu_helper.c                     |  20 +--
 target/riscv/csr.c                            |  42 +++---
 target/riscv/gdbstub.c                        |   6 +-
 target/riscv/op_helper.c                      |   8 +-
 target/riscv/translate.c                      |  12 +-
 target/riscv/zce_helper.c                     |   2 +-
 target/rx/cpu.c                               |  10 +-
 target/rx/helper.c                            |   4 +-
 target/s390x/cpu-dump.c                       |   2 +-
 target/s390x/cpu.c                            |  26 ++--
 target/s390x/cpu_features.c                   |   4 +-
 target/s390x/cpu_models.c                     |   8 +-
 target/s390x/gdbstub.c                        |   4 +-
 target/s390x/interrupt.c                      |   6 +-
 target/s390x/tcg/cc_helper.c                  |   2 +-
 target/s390x/tcg/excp_helper.c                |  10 +-
 target/s390x/tcg/mem_helper.c                 |   8 +-
 target/s390x/tcg/misc_helper.c                |  12 +-
 target/s390x/tcg/translate.c                  |  48 +++----
 target/sh4/cpu.c                              |  12 +-
 target/sh4/helper.c                           |   6 +-
 target/sh4/op_helper.c                        |   2 +-
 target/sparc/cpu.c                            |  16 +--
 target/sparc/helper.c                         |   6 +-
 target/sparc/int32_helper.c                   |   4 +-
 target/sparc/int64_helper.c                   |   4 +-
 target/sparc/ldst_helper.c                    |  16 +--
 target/sparc/translate.c                      |  50 +++----
 target/sparc/win_helper.c                     |  10 +-
 target/xtensa/cpu.c                           |  22 ++--
 target/xtensa/exc_helper.c                    |   4 +-
 target/xtensa/helper.c                        |   4 +-
 target/xtensa/op_helper.c                     |   6 +-
 target/xtensa/translate.c                     |  62 ++++-----
 tcg/tcg.c                                     |   4 +-
 .../loongarch/insn_trans/trans_farith.c.inc   |   2 +-
 target/loongarch/insn_trans/trans_lsx.c.inc   |   2 +-
 target/mips/cpu-defs.c.inc                    |   2 +-
 target/mips/tcg/micromips_translate.c.inc     |   4 +-
 target/mips/tcg/nanomips_translate.c.inc      |   6 +-
 target/ppc/power8-pmu-regs.c.inc              |   4 +-
 target/ppc/translate/branch-impl.c.inc        |   2 +-
 .../ppc/translate/processor-ctrl-impl.c.inc   |   8 +-
 target/ppc/translate/storage-ctrl-impl.c.inc  |  16 +--
 .../riscv/insn_trans/trans_privileged.c.inc   |   8 +-
 target/riscv/insn_trans/trans_rvh.c.inc       |   4 +-
 target/riscv/insn_trans/trans_svinval.c.inc   |   6 +-
 target/riscv/insn_trans/trans_xthead.c.inc    |   8 +-
 tcg/aarch64/tcg-target.c.inc                  |   4 +-
 tcg/arm/tcg-target.c.inc                      |   4 +-
 tcg/i386/tcg-target.c.inc                     |   8 +-
 tcg/loongarch64/tcg-target.c.inc              |   4 +-
 tcg/mips/tcg-target.c.inc                     |   6 +-
 tcg/ppc/tcg-target.c.inc                      |   4 +-
 tcg/riscv/tcg-target.c.inc                    |   2 +-
 tcg/s390x/tcg-target.c.inc                    |   4 +-
 tcg/sparc64/tcg-target.c.inc                  |   8 +-
 208 files changed, 948 insertions(+), 945 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

RFC PATCH 1/2 bulk: Replace !CONFIG_SOFTMMU -> CONFIG_USER_ONLY

CONFIG_USER_ONLY is the opposite of CONFIG_SOFTMMU. Replace !CONFIG_SOFTMMU negation by the positive form which is clearer when reviewing code.

Change mostly done mechanically using:

  $ sed -i -e 's/!defined(CONFIG_SOFTMMU)/defined(CONFIG_USER_ONLY)/' \
           -e 's/ifndef CONFIG_SOFTMMU/ifdef CONFIG_USER_ONLY/' \
               $(git grep -l CONFIG_SOFTMMU)

and adapting comments manually.

---
 accel/tcg/cpu-exec.c             | 4 ++--
 target/i386/helper.c             | 6 +++---
 tcg/aarch64/tcg-target.c.inc     | 4 ++--
 tcg/arm/tcg-target.c.inc         | 4 ++--
 tcg/i386/tcg-target.c.inc        | 8 ++++----
 tcg/loongarch64/tcg-target.c.inc | 4 ++--
 tcg/mips/tcg-target.c.inc        | 6 +++---
 tcg/ppc/tcg-target.c.inc         | 4 ++--
 tcg/riscv/tcg-target.c.inc       | 2 +-
 tcg/s390x/tcg-target.c.inc       | 4 ++--
 tcg/sparc64/tcg-target.c.inc     | 4 ++--
 11 files changed, 25 insertions(+), 25 deletions(-)
accel/tcg/cpu-exec.c +2 -2
index f1eae7b8e5..d5695a7083 100644
@@ -568,7 +568,7 @@ void cpu_exec_step_atomic(CPUState *cpu)
         cpu_tb_exec(cpu, tb, &tb_exit);
         cpu_exec_exit(cpu);
     } else {
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
         clear_helper_retaddr();
         if (have_mmap_lock()) {
             mmap_unlock();
@@ -1025,7 +1025,7 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc)
         /* Non-buggy compilers preserve this; assert the correct value. */
         g_assert(cpu == current_cpu);
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
         clear_helper_retaddr();
         if (have_mmap_lock()) {
             mmap_unlock();
target/i386/helper.c +3 -3
index 89aa696c6d..c9755b3aba 100644
@@ -582,7 +582,7 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector,
 
 void do_cpu_init(X86CPU *cpu)
 {
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     CPUState *cs = CPU(cpu);
     CPUX86State *env = &cpu->env;
     CPUX86State *save = g_new(CPUX86State, 1);
@@ -601,10 +601,10 @@ void do_cpu_init(X86CPU *cpu)
         kvm_arch_do_init_vcpu(cpu);
     }
     apic_init_reset(cpu->apic_state);
-#endif /* CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 void do_cpu_sipi(X86CPU *cpu)
 {
tcg/aarch64/tcg-target.c.inc +2 -2
index 35ca80cd56..d82654ac64 100644
@@ -77,7 +77,7 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot)
 #define TCG_REG_TMP2 TCG_REG_X30
 #define TCG_VEC_TMP0 TCG_REG_V31
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 #define TCG_REG_GUEST_BASE TCG_REG_X28
 #endif
 
@@ -3083,7 +3083,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
     tcg_set_frame(s, TCG_REG_SP, TCG_STATIC_CALL_ARGS_SIZE,
                   CPU_TEMP_BUF_NLONGS * sizeof(long));
 
-#if !defined(CONFIG_SOFTMMU)
+#if defined(CONFIG_USER_ONLY)
     /*
      * Note that XZR cannot be encoded in the address base register slot,
      * as that actaully encodes SP.  Depending on the guest, we may need
tcg/arm/tcg-target.c.inc +2 -2
index 83e286088f..9248c1eb2a 100644
@@ -89,7 +89,7 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot)
 
 #define TCG_REG_TMP  TCG_REG_R12
 #define TCG_VEC_TMP  TCG_REG_Q15
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 #define TCG_REG_GUEST_BASE  TCG_REG_R11
 #endif
 
@@ -2920,7 +2920,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
 
     tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
     if (guest_base) {
         tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_GUEST_BASE, guest_base);
         tcg_regset_set_reg(s->reserved_regs, TCG_REG_GUEST_BASE);
tcg/i386/tcg-target.c.inc +4 -4
index ab997b5fb3..fa3ef70417 100644
@@ -1866,7 +1866,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
     return true;
 }
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 static HostAddress x86_guest_base = {
     .index = -1
 };
@@ -1898,7 +1898,7 @@ static inline int setup_guest_base_seg(void)
     return 0;
 }
 #endif /* setup_guest_base_seg */
-#endif /* !SOFTMMU */
+#endif /* CONFIG_USER_ONLY */
 
 #define MIN_TLB_MASK_TABLE_OFS  INT_MIN
 
@@ -4069,7 +4069,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                          (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4
                          + stack_addend);
 #else
-# if !defined(CONFIG_SOFTMMU)
+# if defined(CONFIG_USER_ONLY)
     if (guest_base) {
         int seg = setup_guest_base_seg();
         if (seg != 0) {
@@ -4083,7 +4083,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
             tcg_regset_set_reg(s->reserved_regs, x86_guest_base.index);
         }
     }
-# endif
+# endif /* CONFIG_USER_ONLY */
     tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
     tcg_out_addi(s, TCG_REG_ESP, -stack_addend);
     /* jmp *tb.  */
tcg/loongarch64/tcg-target.c.inc +2 -2
index baf5fc3819..e145975aaf 100644
@@ -122,7 +122,7 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot)
     return TCG_REG_A0 + slot;
 }
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 #define USE_GUEST_BASE     (guest_base != 0)
 #define TCG_GUEST_BASE_REG TCG_REG_S1
 #endif
@@ -1672,7 +1672,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                    TCG_REG_SP, SAVE_OFS + i * REG_SIZE);
     }
 
-#if !defined(CONFIG_SOFTMMU)
+#if defined(CONFIG_USER_ONLY)
     if (USE_GUEST_BASE) {
         tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base);
         tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
tcg/mips/tcg-target.c.inc +3 -3
index 9faa8bdf0b..1380b905dd 100644
@@ -78,7 +78,7 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
 #define TCG_TMP2  TCG_REG_T8
 #define TCG_TMP3  TCG_REG_T7
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 #define TCG_GUEST_BASE_REG TCG_REG_S7
 #endif
 #if TCG_TARGET_REG_BITS == 64
@@ -2465,7 +2465,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                    TCG_REG_SP, SAVE_OFS + i * REG_SIZE);
     }
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
     if (guest_base != (int16_t)guest_base) {
         /*
          * The function call abi for n32 and n64 will have loaded $25 (t9)
@@ -2479,7 +2479,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                          TCG_TARGET_REG_BITS == 64 ? TCG_REG_T9 : 0);
         tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
     }
-#endif
+#endif /* CONFIG_USER_ONLY */
 
     if (TCG_TARGET_REG_BITS == 64) {
         tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, tcg_target_call_iarg_regs[1]);
tcg/ppc/tcg-target.c.inc +2 -2
index 507fe6cda8..41420f7e6f 100644
@@ -97,7 +97,7 @@ static bool have_isel;
 bool have_altivec;
 bool have_vsx;
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 #define TCG_GUEST_BASE_REG 30
 #endif
 
@@ -2449,7 +2449,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
     }
     tcg_out_st(s, TCG_TYPE_PTR, TCG_REG_R0, TCG_REG_R1, FRAME_SIZE+LR_OFFSET);
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
     if (guest_base) {
         tcg_out_movi_int(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base, true);
         tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
tcg/riscv/tcg-target.c.inc +1 -1
index eeaeb6b6e3..60642f3e9a 100644
@@ -2030,7 +2030,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                    TCG_REG_SP, SAVE_OFS + i * REG_SIZE);
     }
 
-#if !defined(CONFIG_SOFTMMU)
+#if defined(CONFIG_USER_ONLY)
     tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base);
     tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
 #endif
tcg/s390x/tcg-target.c.inc +2 -2
index a878acd8ca..2a948e5317 100644
@@ -46,7 +46,7 @@
 /* A scratch register that may be be used throughout the backend.  */
 #define TCG_TMP0        TCG_REG_R1
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 #define TCG_GUEST_BASE_REG TCG_REG_R13
 #endif
 
@@ -3427,7 +3427,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                   TCG_STATIC_CALL_ARGS_SIZE + TCG_TARGET_CALL_STACK_OFFSET,
                   CPU_TEMP_BUF_NLONGS * sizeof(long));
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
     if (guest_base >= 0x80000) {
         tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base);
         tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
tcg/sparc64/tcg-target.c.inc +2 -2
index ffcb879211..29e67758ef 100644
@@ -78,7 +78,7 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
 #define TCG_REG_T2  TCG_REG_G2
 #define TCG_REG_T3  TCG_REG_O7
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
 # define TCG_GUEST_BASE_REG TCG_REG_I5
 #endif
 
@@ -932,7 +932,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
     tcg_out32(s, SAVE | INSN_RD(TCG_REG_O6) | INSN_RS1(TCG_REG_O6) |
               INSN_IMM13(-frame_size));
 
-#ifndef CONFIG_SOFTMMU
+#ifdef CONFIG_USER_ONLY
     if (guest_base != 0) {
         tcg_out_movi_int(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG,
                          guest_base, true, TCG_REG_T1);
Signature · 1 line
2.38.1
#2 lore raw

Re: [RFC PATCH 1/2] bulk: Replace !CONFIG_SOFTMMU -> CONFIG_USER_ONLY

Quoted 3 lines · Philippe Mathieu-Daudé

CONFIG_USER_ONLY is the opposite of CONFIG_SOFTMMU. Replace !CONFIG_SOFTMMU negation by the positive form which is clearer when reviewing code.

CONFIG_SOFTMMU should be reserved for the actual softmmu tlb, which we *should* be able to enable for user-only. It is the only way to handle some of our host/guest page size problems. Further, CONFIG_SOFTMMU should go away as a #define and become a runtime test (forced to true for system mode). Pie in the sky stuff.

It is quite likely that all uses of CONFIG_SOFTMMU outside of tcg/, accel/tcg/, and random bits of include/ should only be using CONFIG_USER_ONLY.

r~

#3 lore raw

Re: [RFC PATCH 1/2] bulk: Replace !CONFIG_SOFTMMU -> CONFIG_USER_ONLY

Quoted 6 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé

CONFIG_USER_ONLY is the opposite of CONFIG_SOFTMMU. Replace !CONFIG_SOFTMMU negation by the positive form which is clearer when reviewing code.

CONFIG_SOFTMMU should be reserved for the actual softmmu tlb, which we *should* be able to enable for user-only.  It is the only way to handle some of our host/guest page size problems.  Further, CONFIG_SOFTMMU should go away as a #define and become a runtime test (forced to true for system mode).  Pie in the sky stuff.

This would be:

  bool has_softmmu(void)
  {
  #ifdef CONFIG_USER_ONLY
      /* TODO: implement */
      return false;
  #else
      return true;
  #endif
  }

?

Quoted 1 line

It is quite likely that all uses of CONFIG_SOFTMMU outside of tcg/, accel/tcg/, and random bits of include/ should only be using CONFIG_USER_ONLY.

I see.

Thanks,

Phil.

#4 lore raw

Re: [RFC PATCH 1/2] bulk: Replace !CONFIG_SOFTMMU -> CONFIG_USER_ONLY

Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé

CONFIG_USER_ONLY is the opposite of CONFIG_SOFTMMU. Replace !CONFIG_SOFTMMU negation by the positive form which is clearer when reviewing code.

CONFIG_SOFTMMU should be reserved for the actual softmmu tlb, which we *should* be able to enable for user-only.  It is the only way to handle some of our host/guest page size problems.  Further, CONFIG_SOFTMMU should go away as a #define and become a runtime test (forced to true for system mode).  Pie in the sky stuff.

This would be:

  bool has_softmmu(void)
  {
  #ifdef CONFIG_USER_ONLY
      /* TODO: implement */
      return false;
  #else
      return true;
  #endif
  }

Quoted 1 line

?

Yes, something like that.

r~

#5 lore raw

RFC PATCH 2/2 bulk: Replace !CONFIG_USER_ONLY -> CONFIG_SOFTMMU

In reply to Philippe Mathieu-Daudé

CONFIG_SOFTMMU is the opposite of CONFIG_USER_ONLY. Now that CONFIG_SOFTMMU isn't poisoined anymore, replace !CONFIG_USER_ONLY negation by the positive form which is clearer when reviewing code.

Change mostly done mechanically using:

  $ sed -i -e 's/ifndef CONFIG_USER_ONLY/ifdef CONFIG_SOFTMMU/' \
           -e 's/!defined(CONFIG_USER_ONLY)/defined(CONFIG_SOFTMMU)/' \
               $(git grep -l CONFIG_USER_ONLY)

and adapting comments manually.

---
 scripts/coccinelle/round.cocci                |   6 +
 include/exec/address-spaces.h                 |   2 +-
 include/exec/confidential-guest-support.h     |   4 +-
 include/exec/cpu-all.h                        |   4 +-
 include/exec/cpu-common.h                     |   4 +-
 include/exec/cpu-defs.h                       |  14 +-
 include/exec/cputlb.h                         |   2 +-
 include/exec/exec-all.h                       |   6 +-
 include/exec/ioport.h                         |   2 +-
 include/exec/memory-internal.h                |   2 +-
 include/exec/memory.h                         |   2 +-
 include/exec/ram_addr.h                       |   2 +-
 include/exec/ramblock.h                       |   2 +-
 include/hw/core/cpu.h                         |  12 +-
 include/hw/core/tcg-cpu-ops.h                 |   8 +-
 include/hw/intc/armv7m_nvic.h                 |   4 +-
 include/hw/s390x/css.h                        |   2 +-
 include/qemu/accel.h                          |   6 +-
 include/semihosting/semihost.h                |   4 +-
 include/sysemu/cpus.h                         |   2 +-
 include/sysemu/xen.h                          |   4 +-
 target/alpha/cpu.h                            |   6 +-
 target/arm/common-semi-target.h               |   2 +-
 target/arm/cpu.h                              |  14 +-
 target/arm/internals.h                        |   6 +-
 target/arm/tcg/arm_ldst.h                     |   2 +-
 target/arm/tcg/translate.h                    |   2 +-
 target/cris/cpu.h                             |   2 +-
 target/hppa/cpu.h                             |   2 +-
 target/hppa/helper.h                          |   2 +-
 target/i386/cpu-internal.h                    |   4 +-
 target/i386/cpu.h                             |  12 +-
 target/i386/helper.h                          |  12 +-
 target/i386/sev.h                             |   2 +-
 target/i386/tcg/helper-tcg.h                  |   4 +-
 target/loongarch/cpu.h                        |   4 +-
 target/loongarch/helper.h                     |   2 +-
 target/loongarch/internals.h                  |   4 +-
 target/m68k/cpu.h                             |   6 +-
 target/microblaze/cpu.h                       |  12 +-
 target/microblaze/helper.h                    |   2 +-
 target/mips/cpu.h                             |   6 +-
 target/mips/helper.h                          |   8 +-
 target/mips/internal.h                        |   4 +-
 target/mips/tcg/tcg-internal.h                |   4 +-
 target/nios2/cpu.h                            |  10 +-
 target/nios2/helper.h                         |   2 +-
 target/openrisc/cpu.h                         |   8 +-
 target/ppc/cpu-qom.h                          |   4 +-
 target/ppc/cpu.h                              |  32 ++---
 target/ppc/helper.h                           |   8 +-
 target/ppc/internal.h                         |   6 +-
 target/ppc/kvm_ppc.h                          |   8 +-
 target/ppc/mmu-book3s-v3.h                    |   2 +-
 target/ppc/mmu-hash32.h                       |   2 +-
 target/ppc/mmu-hash64.h                       |   2 +-
 target/ppc/mmu-radix64.h                      |   2 +-
 target/ppc/power8-pmu.h                       |   2 +-
 target/ppc/spr_common.h                       |   2 +-
 target/riscv/cpu.h                            |  10 +-
 target/riscv/helper.h                         |   4 +-
 target/riscv/internals.h                      |   2 +-
 target/rx/cpu.h                               |   4 +-
 target/s390x/cpu.h                            |   8 +-
 target/s390x/helper.h                         |   2 +-
 target/s390x/s390x-internal.h                 |   8 +-
 target/sh4/cpu.h                              |   2 +-
 target/sparc/cpu.h                            |  10 +-
 target/sparc/helper.h                         |   2 +-
 target/xtensa/cpu.h                           |   6 +-
 target/xtensa/helper.h                        |   4 +-
 target/s390x/tcg/insn-data.h.inc              |   2 +-
 accel/accel-common.c                          |   8 +-
 accel/tcg/cpu-exec.c                          |  20 +--
 accel/tcg/tcg-all.c                           |   4 +-
 accel/tcg/translate-all.c                     |   2 +-
 cpu.c                                         |   8 +-
 gdbstub/gdbstub.c                             |   8 +-
 plugins/api.c                                 |   4 +-
 plugins/loader.c                              |   4 +-
 semihosting/arm-compat-semi.c                 |  10 +-
 semihosting/guestfd.c                         |   2 +-
 semihosting/syscalls.c                        |   6 +-
 softmmu/memory.c                              |   2 +-
 target/alpha/cpu.c                            |  10 +-
 target/alpha/helper.c                         |   4 +-
 target/alpha/sys_helper.c                     |   4 +-
 target/alpha/translate.c                      |  22 ++--
 target/arm/cpu.c                              |  44 +++----
 target/arm/debug_helper.c                     |   4 +-
 target/arm/gdbstub.c                          |   6 +-
 target/arm/helper.c                           |  48 +++----
 target/arm/tcg/cpu32.c                        |  18 +--
 target/arm/tcg/helper-a64.c                   |   2 +-
 target/arm/tcg/m_helper.c                     |   6 +-
 target/arm/tcg/op_helper.c                    |   2 +-
 target/arm/tcg/sve_helper.c                   |   2 +-
 target/arm/tcg/tlb_helper.c                   |   4 +-
 target/arm/tcg/translate-a64.c                |   2 +-
 target/arm/tcg/translate.c                    |   6 +-
 target/cris/cpu.c                             |  18 +--
 target/cris/op_helper.c                       |   8 +-
 target/cris/translate.c                       |   2 +-
 target/hexagon/genptr.c                       |   2 +-
 target/hppa/cpu.c                             |  14 +-
 target/hppa/helper.c                          |   4 +-
 target/hppa/translate.c                       |  36 ++---
 target/i386/cpu-dump.c                        |   6 +-
 target/i386/cpu.c                             |  42 +++---
 target/i386/gdbstub.c                         |  14 +-
 target/i386/helper.c                          |   8 +-
 target/i386/tcg/bpt_helper.c                  |   2 +-
 target/i386/tcg/excp_helper.c                 |   2 +-
 target/i386/tcg/fpu_helper.c                  |   4 +-
 target/i386/tcg/seg_helper.c                  |   8 +-
 target/i386/tcg/tcg-cpu.c                     |   6 +-
 target/i386/tcg/translate.c                   |   4 +-
 target/loongarch/cpu.c                        |  14 +-
 target/loongarch/op_helper.c                  |   2 +-
 target/m68k/cpu.c                             |   6 +-
 target/m68k/helper.c                          |   4 +-
 target/m68k/op_helper.c                       |   4 +-
 target/microblaze/cpu.c                       |  12 +-
 target/microblaze/helper.c                    |   4 +-
 target/microblaze/op_helper.c                 |   2 +-
 target/microblaze/translate.c                 |  12 +-
 target/mips/cpu.c                             |  18 +--
 target/mips/gdbstub.c                         |   4 +-
 target/mips/tcg/ldst_helper.c                 |   4 +-
 target/mips/tcg/msa_helper.c                  |   2 +-
 target/mips/tcg/op_helper.c                   |   4 +-
 target/mips/tcg/translate.c                   |  26 ++--
 target/nios2/cpu.c                            |  18 +--
 target/nios2/op_helper.c                      |   4 +-
 target/nios2/translate.c                      |  10 +-
 target/openrisc/cpu.c                         |  14 +-
 target/openrisc/interrupt.c                   |   2 +-
 target/openrisc/sys_helper.c                  |  10 +-
 target/ppc/compat.c                           |   2 +-
 target/ppc/cpu.c                              |   2 +-
 target/ppc/cpu_init.c                         | 124 +++++++++---------
 target/ppc/excp_helper.c                      |  17 +--
 target/ppc/gdbstub.c                          |   8 +-
 target/ppc/helper_regs.c                      |  20 +--
 target/ppc/mem_helper.c                       |   2 +-
 target/ppc/misc_helper.c                      |   2 +-
 target/ppc/power8-pmu.c                       |   4 +-
 target/ppc/ppc-qmp-cmds.c                     |   2 +-
 target/ppc/timebase_helper.c                  |   4 +-
 target/ppc/translate.c                        |  62 ++++-----
 target/riscv/cpu.c                            |  66 +++++-----
 target/riscv/cpu_helper.c                     |  20 +--
 target/riscv/csr.c                            |  42 +++---
 target/riscv/gdbstub.c                        |   6 +-
 target/riscv/op_helper.c                      |   8 +-
 target/riscv/translate.c                      |  12 +-
 target/riscv/zce_helper.c                     |   2 +-
 target/rx/cpu.c                               |  10 +-
 target/rx/helper.c                            |   4 +-
 target/s390x/cpu-dump.c                       |   2 +-
 target/s390x/cpu.c                            |  26 ++--
 target/s390x/cpu_features.c                   |   4 +-
 target/s390x/cpu_models.c                     |   8 +-
 target/s390x/gdbstub.c                        |   4 +-
 target/s390x/interrupt.c                      |   6 +-
 target/s390x/tcg/cc_helper.c                  |   2 +-
 target/s390x/tcg/excp_helper.c                |  10 +-
 target/s390x/tcg/mem_helper.c                 |   8 +-
 target/s390x/tcg/misc_helper.c                |  12 +-
 target/s390x/tcg/translate.c                  |  48 +++----
 target/sh4/cpu.c                              |  12 +-
 target/sh4/helper.c                           |   6 +-
 target/sh4/op_helper.c                        |   2 +-
 target/sparc/cpu.c                            |  16 +--
 target/sparc/helper.c                         |   6 +-
 target/sparc/int32_helper.c                   |   4 +-
 target/sparc/int64_helper.c                   |   4 +-
 target/sparc/ldst_helper.c                    |  16 +--
 target/sparc/translate.c                      |  50 +++----
 target/sparc/win_helper.c                     |  10 +-
 target/xtensa/cpu.c                           |  22 ++--
 target/xtensa/exc_helper.c                    |   4 +-
 target/xtensa/helper.c                        |   4 +-
 target/xtensa/op_helper.c                     |   6 +-
 target/xtensa/translate.c                     |  62 ++++-----
 tcg/tcg.c                                     |   4 +-
 .../loongarch/insn_trans/trans_farith.c.inc   |   2 +-
 target/loongarch/insn_trans/trans_lsx.c.inc   |   2 +-
 target/mips/cpu-defs.c.inc                    |   2 +-
 target/mips/tcg/micromips_translate.c.inc     |   4 +-
 target/mips/tcg/nanomips_translate.c.inc      |   6 +-
 target/ppc/power8-pmu-regs.c.inc              |   4 +-
 target/ppc/translate/branch-impl.c.inc        |   2 +-
 .../ppc/translate/processor-ctrl-impl.c.inc   |   8 +-
 target/ppc/translate/storage-ctrl-impl.c.inc  |  16 +--
 .../riscv/insn_trans/trans_privileged.c.inc   |   8 +-
 target/riscv/insn_trans/trans_rvh.c.inc       |   4 +-
 target/riscv/insn_trans/trans_svinval.c.inc   |   6 +-
 target/riscv/insn_trans/trans_xthead.c.inc    |   8 +-
 tcg/sparc64/tcg-target.c.inc                  |   4 +-
 200 files changed, 923 insertions(+), 920 deletions(-)
scripts/coccinelle/round.cocci +6 -0
index ed06773289..0a27b6da4d 100644
@@ -17,3 +17,9 @@ expression e2;
 @@
 -(DIV_ROUND_UP(e1,e2))
 +DIV_ROUND_UP(e1,e2)
+
+@@
+expression n, d;
+@@
+-   n & ~(d - 1)
++   ROUND_DOWN(n, d)
include/exec/address-spaces.h +1 -1
index db8bfa9a92..837e6a5560 100644
@@ -21,7 +21,7 @@
 
 #include "exec/memory.h"
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /* Get the root memory region.  This interface should only be used temporarily
  * until a proper bus interface is available.
include/exec/confidential-guest-support.h +2 -2
index ba2dd4b5df..16a963654e 100644
@@ -18,7 +18,7 @@
 #ifndef QEMU_CONFIDENTIAL_GUEST_SUPPORT_H
 #define QEMU_CONFIDENTIAL_GUEST_SUPPORT_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 #include "qom/object.h"
 
@@ -57,6 +57,6 @@ typedef struct ConfidentialGuestSupportClass {
     ObjectClass parent;
 } ConfidentialGuestSupportClass;
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 #endif /* QEMU_CONFIDENTIAL_GUEST_SUPPORT_H */
include/exec/cpu-all.h +2 -2
index 09bf4c0cc6..4e5acfcaff 100644
@@ -304,7 +304,7 @@ CPUArchState *cpu_copy(CPUArchState *env);
 #define TLB_MMIO            0
 #define TLB_WATCHPOINT      0
 
-#else
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
 
 /*
  * Flags stored in the low bits of the TLB virtual address.
@@ -367,7 +367,7 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr)
 void dump_exec_info(GString *buf);
 #endif /* CONFIG_TCG */
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /* accel/tcg/cpu-exec.c */
 int cpu_exec(CPUState *cpu);
include/exec/cpu-common.h +2 -2
index e5a55ede5f..807b673f21 100644
@@ -3,7 +3,7 @@
 
 /* CPU interfaces that are target independent.  */
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "exec/hwaddr.h"
 #endif
 
@@ -44,7 +44,7 @@ void tcg_flush_jmp_cache(CPUState *cs);
 void tcg_iommu_init_notifier_list(CPUState *cpu);
 void tcg_iommu_free_notifier_list(CPUState *cpu);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 enum device_endian {
     DEVICE_NATIVE_ENDIAN,
include/exec/cpu-defs.h +7 -7
index 0d418a0384..402e74df6e 100644
@@ -25,7 +25,7 @@
 
 #include "qemu/host-utils.h"
 #include "qemu/thread.h"
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "exec/hwaddr.h"
 #endif
 #include "exec/memattrs.h"
@@ -60,7 +60,7 @@
  */
 #define NB_MMU_MODES 16
 
-#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
+#if defined(CONFIG_SOFTMMU) && defined(CONFIG_TCG)
 #include "exec/tlb-common.h"
 
 /* use a fully associative victim tlb of 8 entries */
@@ -89,9 +89,9 @@
 #  endif
 # endif
 
-#endif  /* !CONFIG_USER_ONLY && CONFIG_TCG */
+#endif /* CONFIG_SOFTMMU && CONFIG_TCG */
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 /*
  * The full TLB entry, which is not accessed by generated TCG code,
  * so the layout is not as critical as that of CPUTLBEntry. This is
@@ -133,9 +133,9 @@ typedef struct CPUTLBEntryFull {
     TARGET_PAGE_ENTRY_EXTRA
 #endif
 } CPUTLBEntryFull;
-#endif  /* !CONFIG_USER_ONLY */
+#endif  /* CONFIG_SOFTMMU */
 
-#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
+#if defined(CONFIG_SOFTMMU) && defined(CONFIG_TCG)
 /*
  * Data elements that are per MMU mode, minus the bits accessed by
  * the TCG fast path.
@@ -201,7 +201,7 @@ typedef struct CPUTLB {
 
 typedef struct CPUTLB { } CPUTLB;
 
-#endif  /* !CONFIG_USER_ONLY && CONFIG_TCG */
+#endif  /* CONFIG_SOFTMMU && CONFIG_TCG */
 
 /*
  * This structure must be placed in ArchCPU immediately
include/exec/cputlb.h +1 -1
index 19b16e58f8..fa932cbd41 100644
@@ -22,7 +22,7 @@
 
 #include "exec/cpu-common.h"
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 /* cputlb.c */
 void tlb_protect_code(ram_addr_t ram_addr);
 void tlb_unprotect_code(ram_addr_t ram_addr);
include/exec/exec-all.h +3 -3
index 698943d58f..c90c685a44 100644
@@ -74,7 +74,7 @@ static inline bool cpu_loop_exit_requested(CPUState *cpu)
     return (int32_t)qatomic_read(&cpu_neg(cpu)->icount_decr.u32) < 0;
 }
 
-#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
+#if defined(CONFIG_SOFTMMU) && defined(CONFIG_TCG)
 /* cputlb.c */
 /**
  * tlb_init - initialize a CPU's TLB
@@ -452,7 +452,7 @@ int probe_access_flags(CPUArchState *env, target_ulong addr, int size,
                        MMUAccessType access_type, int mmu_idx,
                        bool nonfault, void **phost, uintptr_t retaddr);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /**
  * probe_access_full:
  * Like probe_access_flags, except also return into @pfull.
@@ -553,7 +553,7 @@ extern __thread uintptr_t tci_tb_ptr;
    smaller than 4 bytes, so we don't worry about special-casing this.  */
 #define GETPC_ADJ   2
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 /**
  * iotlb_to_section:
include/exec/ioport.h +1 -1
index e34f668998..2c17ca3eef 100644
@@ -40,7 +40,7 @@ typedef struct MemoryRegionPortio {
 
 #define PORTIO_END_OF_LIST() { }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const MemoryRegionOps unassigned_io_ops;
 #endif
 
include/exec/memory-internal.h +1 -1
index 100c1237ac..5c07a4748b 100644
@@ -22,7 +22,7 @@
 
 #include "cpu.h"
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
 {
     return fv->dispatch;
include/exec/memory.h +1 -1
index c3661b2276..8e55e50b84 100644
@@ -14,7 +14,7 @@
 #ifndef MEMORY_H
 #define MEMORY_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 #include "exec/cpu-common.h"
 #include "exec/hwaddr.h"
include/exec/ram_addr.h +1 -1
index 90a8269290..df19f1d6b7 100644
@@ -19,7 +19,7 @@
 #ifndef RAM_ADDR_H
 #define RAM_ADDR_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "cpu.h"
 #include "sysemu/xen.h"
 #include "sysemu/tcg.h"
include/exec/ramblock.h +1 -1
index 69c6a53902..ba66c13758 100644
@@ -19,7 +19,7 @@
 #ifndef QEMU_EXEC_RAMBLOCK_H
 #define QEMU_EXEC_RAMBLOCK_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "cpu-common.h"
 #include "qemu/rcu.h"
 #include "exec/ramlist.h"
include/hw/core/cpu.h +6 -6
index 39150cf8f8..780477aba3 100644
@@ -491,7 +491,7 @@ bool cpu_paging_enabled(const CPUState *cpu);
 void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
                             Error **errp);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 /**
  * cpu_write_elf64_note:
@@ -542,7 +542,7 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
  */
 GuestPanicInformation *cpu_get_crash_info(CPUState *cpu);
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /**
  * CPUDumpFlags:
@@ -565,7 +565,7 @@ enum CPUDumpFlags {
  */
 void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /**
  * cpu_get_phys_page_attrs_debug:
  * @cpu: The CPU to obtain the physical page address for.
@@ -612,7 +612,7 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);
  */
 bool cpu_virtio_is_big_endian(CPUState *cpu);
 
-#endif /* CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /**
  * cpu_list_add:
@@ -974,14 +974,14 @@ static inline void cpu_watchpoint_remove_by_ref(CPUState *cpu,
 static inline void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
 {
 }
-#else
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
 int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
                           int flags, CPUWatchpoint **watchpoint);
 int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
                           vaddr len, int flags);
 void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
 void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
-#endif
+#endif /* CONFIG_SOFTMMU */
 
 /**
  * cpu_get_address_space:
include/hw/core/tcg-cpu-ops.h +4 -4
index 0ae08df47e..38a684ed85 100644
@@ -121,7 +121,7 @@ struct TCGCPUOps {
      */
     bool (*io_recompile_replay_branch)(CPUState *cpu,
                                        const TranslationBlock *tb);
-#else
+#else /* !CONFIG_SOFTMMU = CONFIG_USER_ONLY */
     /**
      * record_sigsegv:
      * @cpu: cpu context
@@ -170,7 +170,7 @@ struct TCGCPUOps {
      */
     void (*record_sigbus)(CPUState *cpu, vaddr addr,
                           MMUAccessType access_type, uintptr_t ra);
-#endif /* CONFIG_SOFTMMU */
+#endif /* CONFIG_USER_ONLY */
 #endif /* NEED_CPU_H */
 
 };
@@ -188,7 +188,7 @@ static inline int cpu_watchpoint_address_matches(CPUState *cpu,
     return 0;
 }
 
-#else
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
 
 /**
  * cpu_check_watchpoint:
@@ -216,6 +216,6 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
  */
 int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);
 
-#endif
+#endif /* CONFIG_SOFTMMU */
 
 #endif /* TCG_CPU_OPS_H */
include/hw/intc/armv7m_nvic.h +2 -2
index 1ca262fbf8..9eb0f7297a 100644
@@ -189,7 +189,7 @@ int armv7m_nvic_raw_execution_priority(NVICState *s);
  * @secure: the security state to test
  * This corresponds to the pseudocode IsReqExecPriNeg().
  */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
 #else
 static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
@@ -197,7 +197,7 @@ static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
     return false;
 }
 #endif
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 bool armv7m_nvic_can_take_pending_exception(NVICState *s);
 #else
 static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
include/hw/s390x/css.h +1 -1
index 75e5381613..acfc9c7c2e 100644
@@ -238,7 +238,7 @@ uint32_t css_get_adapter_id(CssIoAdapterType type, uint8_t isc);
 void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maskable,
                               uint8_t flags, Error **errp);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
                          uint16_t schid);
 bool css_subch_visible(SubchDev *sch);
include/qemu/accel.h +3 -3
index e84db2e3e5..d1102a9304 100644
@@ -38,7 +38,7 @@ typedef struct AccelClass {
 
     const char *name;
     int (*init_machine)(MachineState *ms);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     void (*setup_post)(MachineState *ms, AccelState *accel);
     bool (*has_memory)(MachineState *ms, AddressSpace *as,
                        hwaddr start_addr, hwaddr size);
@@ -76,12 +76,12 @@ const char *current_accel_name(void);
 
 void accel_init_interfaces(AccelClass *ac);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 int accel_init_machine(AccelState *accel, MachineState *ms);
 
 /* Called just before os_setup_post (ie just before drop OS privs) */
 void accel_setup_post(MachineState *ms);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /**
  * accel_cpu_instance_init:
include/semihosting/semihost.h +2 -2
index efd2efa25a..4cc1fd90e6 100644
@@ -51,7 +51,7 @@ static inline const char *semihosting_get_cmdline(void)
 {
     return NULL;
 }
-#else /* !CONFIG_USER_ONLY */
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
 /**
  * semihosting_enabled:
  * @is_user: true if guest code is in usermode (i.e. not privileged)
@@ -69,7 +69,7 @@ void qemu_semihosting_enable(void);
 int qemu_semihosting_config_options(const char *opt);
 void qemu_semihosting_chardev_init(void);
 void qemu_semihosting_console_init(Chardev *);
-#endif /* CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 void qemu_semihosting_guestfd_init(void);
 
 #endif /* SEMIHOST_H */
include/sysemu/cpus.h +1 -1
index 0535a4c68a..e2eced8caf 100644
@@ -50,7 +50,7 @@ void cpu_synchronize_all_post_reset(void);
 void cpu_synchronize_all_post_init(void);
 void cpu_synchronize_all_pre_loadvm(void);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* vl.c */
 /* *-user doesn't have configurable SMP topology */
 extern int smp_cores;
include/sysemu/xen.h +2 -2
index 0ca25697e4..c1fdc64b9c 100644
@@ -24,7 +24,7 @@ extern bool xen_allowed;
 
 #define xen_enabled()           (xen_allowed)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length);
 void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
                    struct MemoryRegion *mr, Error **errp);
@@ -33,7 +33,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
 #else /* !CONFIG_XEN_IS_POSSIBLE */
 
 #define xen_enabled() 0
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
 {
     /* nothing */
target/alpha/cpu.h +3 -3
index 5e67304d81..1a2d0076aa 100644
@@ -230,7 +230,7 @@ typedef struct CPUArchState {
     uint64_t trap_arg1;
     uint64_t trap_arg2;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     /* The internal data required by our emulation of the Unix PALcode.  */
     uint64_t exc_addr;
     uint64_t palbr;
@@ -271,13 +271,13 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_alpha_cpu;
 
 void alpha_cpu_do_interrupt(CPUState *cpu);
 bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req);
 hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags);
 int alpha_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
target/arm/common-semi-target.h +1 -1
index 629d75ca5a..ea84e2f35d 100644
@@ -10,7 +10,7 @@
 #ifndef TARGET_ARM_COMMON_SEMI_TARGET_H
 #define TARGET_ARM_COMMON_SEMI_TARGET_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "hw/arm/boot.h"
 #endif
 
target/arm/cpu.h +7 -7
index d469a2637b..b5f2eff98e 100644
@@ -769,7 +769,7 @@ typedef struct CPUArchState {
         uint32_t ctrl;
     } sau;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     NVICState *nvic;
     const struct arm_boot_info *boot_info;
     /* Store GICv3CPUState to access from this struct */
@@ -1101,7 +1101,7 @@ void arm_cpu_post_init(Object *obj);
 
 uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_arm_cpu;
 
 void arm_cpu_do_interrupt(CPUState *cpu);
@@ -1109,7 +1109,7 @@ void arm_v7m_cpu_do_interrupt(CPUState *cpu);
 
 hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
                                          MemTxAttrs *attrs);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 int arm_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int arm_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
@@ -1588,7 +1588,7 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
     if (mask & XPSR_GE) {
         env->GE = (val & XPSR_GE) >> 16;
     }
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (mask & XPSR_T) {
         env->thumb = ((val & XPSR_T) != 0);
     }
@@ -2383,7 +2383,7 @@ static inline int arm_feature(CPUARMState *env, int feature)
 
 void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 /*
  * Return true if exception levels below EL3 are in secure state,
  * or would be following an exception return to that level.
@@ -2874,7 +2874,7 @@ static inline bool arm_sctlr_b(CPUARMState *env)
          * let linux-user ignore the fact that it conflicts with SCTLR_B.
          * This lets people run BE32 binaries with "-cpu any".
          */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         !arm_feature(env, ARM_FEATURE_V7) &&
 #endif
         (env->cp15.sctlr_el[1] & SCTLR_B) != 0;
@@ -3132,7 +3132,7 @@ enum {
     QEMU_PSCI_CONDUIT_HVC = 2,
 };
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* Return the address space index to use for a memory access */
 static inline int arm_asidx_from_attrs(CPUState *cs, MemTxAttrs attrs)
 {
target/arm/internals.h +3 -3
index c869d18c38..640e6c7a57 100644
@@ -617,7 +617,7 @@ G_NORETURN void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
                                             MMUAccessType access_type,
                                             int mmu_idx, uintptr_t retaddr);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* arm_cpu_do_transaction_failed: handle a memory system error response
  * (eg "no device/memory present at address") by raising an external abort
  * exception
@@ -1127,7 +1127,7 @@ static inline bool allocation_tag_access_enabled(CPUARMState *env, int el,
     return sctlr != 0;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /* Security attributes for an address, as returned by v8m_security_lookup. */
 typedef struct V8M_SAttributes {
@@ -1214,7 +1214,7 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
 
 void arm_log_exception(CPUState *cs);
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /*
  * The log2 of the words in the tag block, for GMID_EL1.BS.
target/arm/tcg/arm_ldst.h +1 -1
index cee0548a1c..f0b44bbd25 100644
@@ -34,7 +34,7 @@ static inline uint32_t arm_ldl_code(CPUARMState *env, DisasContextBase *s,
 static inline uint16_t arm_lduw_code(CPUARMState *env, DisasContextBase* s,
                                      target_ulong addr, bool sctlr_b)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     /* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped
        within each word.  Undo that now.  */
     if (sctlr_b) {
target/arm/tcg/translate.h +1 -1
index 4d88197715..83a2f8eddd 100644
@@ -59,7 +59,7 @@ typedef struct DisasContext {
     bool eci_handled;
     int sctlr_b;
     MemOp be_data;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     int user;
 #endif
     ARMMMUIdx mmu_idx; /* MMU index to use for normal loads/stores */
target/cris/cpu.h +1 -1
index 71fa1f96e0..d354b13706 100644
@@ -183,7 +183,7 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cris_cpu;
 
 void cris_cpu_do_interrupt(CPUState *cpu);
target/hppa/cpu.h +1 -1
index b595ef25a9..6c1e8d87c1 100644
@@ -325,7 +325,7 @@ void cpu_hppa_change_prot_id(CPUHPPAState *env);
 int hppa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void hppa_cpu_dump_state(CPUState *cs, FILE *f, int);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr);
 bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                        MMUAccessType access_type, int mmu_idx,
target/hppa/helper.h +1 -1
index c7e35ce8c7..e214aeffe7 100644
@@ -79,7 +79,7 @@ DEF_HELPER_FLAGS_4(fmpynfadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
 
 DEF_HELPER_FLAGS_0(read_interval_timer, TCG_CALL_NO_RWG, tr)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_1(halt, noreturn, env)
 DEF_HELPER_1(reset, noreturn, env)
 DEF_HELPER_1(getshadowregs, void, env)
target/i386/cpu-internal.h +2 -2
index 9baac5c0b4..dbaddeb6fa 100644
@@ -57,7 +57,7 @@ extern FeatureWordInfo feature_word_info[];
 
 void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs);
 void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v,
                                 const char *name, void *opaque, Error **errp);
@@ -65,6 +65,6 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v,
 void x86_cpu_apic_create(X86CPU *cpu, Error **errp);
 void x86_cpu_apic_realize(X86CPU *cpu, Error **errp);
 void x86_cpu_machine_reset_cb(void *opaque);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 #endif /* I386_CPU_INTERNAL_H */
target/i386/cpu.h +6 -6
index cd047e0410..55af087b53 100644
@@ -2029,7 +2029,7 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_x86_cpu;
 #endif
 
@@ -2055,7 +2055,7 @@ int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void x86_cpu_list(void);
 int cpu_x86_support_mca_broadcast(CPUX86State *env);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 hwaddr x86_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
                                          MemTxAttrs *attrs);
 int cpu_get_pic_interrupt(CPUX86State *s);
@@ -2194,7 +2194,7 @@ void host_cpuid(uint32_t function, uint32_t count,
 void x86_cpu_set_a20(X86CPU *cpu, int a20_state);
 void cpu_sync_avx_hflag(CPUX86State *env);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static inline int x86_asidx_from_attrs(CPUState *cs, MemTxAttrs attrs)
 {
     return !!attrs.secure;
@@ -2271,7 +2271,7 @@ static inline int cpu_mmu_index_kernel(CPUX86State *env)
 #include "exec/cpu-all.h"
 #include "svm.h"
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "hw/i386/apic.h"
 #endif
 
@@ -2416,7 +2416,7 @@ typedef int X86CPUVersion;
  */
 void x86_cpu_set_default_version(X86CPUVersion version);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 void do_cpu_sipi(X86CPU *cpu);
 
@@ -2426,7 +2426,7 @@ void do_cpu_sipi(X86CPU *cpu);
 /* cpu-dump.c */
 void x86_cpu_dump_local_apic_state(CPUState *cs, int flags);
 
-#endif
+#endif /* CONFIG_SOFTMMU */
 
 /* cpu.c */
 bool cpu_is_bsp(X86CPU *cpu);
target/i386/helper.h +6 -6
index e627a93107..5d7b12ccd4 100644
@@ -44,10 +44,10 @@ DEF_HELPER_3(iret_protected, void, env, int, int)
 DEF_HELPER_3(lret_protected, void, env, int, int)
 DEF_HELPER_1(clts, void, env)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_FLAGS_3(set_dr, TCG_CALL_NO_WG, void, env, int, tl)
 DEF_HELPER_FLAGS_2(get_dr, TCG_CALL_NO_WG, tl, env, int)
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 DEF_HELPER_1(sysenter, void, env)
 DEF_HELPER_2(sysexit, void, env, int)
@@ -61,9 +61,9 @@ DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, int)
 DEF_HELPER_3(boundw, void, env, tl, int)
 DEF_HELPER_3(boundl, void, env, tl, int)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_1(rsm, void, env)
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 DEF_HELPER_2(into, void, env, int)
 DEF_HELPER_FLAGS_1(single_step, TCG_CALL_NO_WG, noreturn, env)
@@ -73,7 +73,7 @@ DEF_HELPER_1(rdtsc, void, env)
 DEF_HELPER_1(rdtscp, void, env)
 DEF_HELPER_FLAGS_1(rdpmc, TCG_CALL_NO_WG, noreturn, env)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_3(outb, void, env, i32, i32)
 DEF_HELPER_2(inb, tl, env, i32)
 DEF_HELPER_3(outw, void, env, i32, i32)
@@ -98,7 +98,7 @@ DEF_HELPER_1(rdmsr, void, env)
 DEF_HELPER_1(wrmsr, void, env)
 DEF_HELPER_FLAGS_2(read_crN, TCG_CALL_NO_RWG, tl, env, int)
 DEF_HELPER_FLAGS_3(write_crN, TCG_CALL_NO_RWG, void, env, int, tl)
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /* x86 FPU */
 
target/i386/sev.h +1 -1
index 7b1528248a..f5bf822d59 100644
@@ -14,7 +14,7 @@
 #ifndef I386_SEV_H
 #define I386_SEV_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include CONFIG_DEVICES /* CONFIG_SEV */
 #endif
 
target/i386/tcg/helper-tcg.h +2 -2
index cd1723389a..5e08a020a8 100644
@@ -38,7 +38,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS);
  * @cpu: vCPU the interrupt is to be handled by.
  */
 void x86_cpu_do_interrupt(CPUState *cpu);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req);
 #endif
 
@@ -93,7 +93,7 @@ void cpu_load_eflags(CPUX86State *env, int eflags, int update_mask);
 G_NORETURN void do_pause(CPUX86State *env);
 
 /* sysemu/svm_helper.c */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 G_NORETURN void cpu_vmexit(CPUX86State *nenv, uint32_t exit_code,
                            uint64_t exit_info_1, uintptr_t retaddr);
 void do_vmexit(CPUX86State *env);
target/loongarch/cpu.h +2 -2
index 1f37e36b7c..5f6f4129ab 100644
@@ -13,7 +13,7 @@
 #include "fpu/softfloat-types.h"
 #include "hw/registerfields.h"
 #include "qemu/timer.h"
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "exec/memory.h"
 #endif
 #include "cpu-csr.h"
@@ -343,7 +343,7 @@ typedef struct CPUArchState {
     uint64_t CSR_DERA;
     uint64_t CSR_DSAVE;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     LoongArchTLB  tlb[LOONGARCH_TLB_MAX];
 
     AddressSpace address_space_iocsr;
target/loongarch/helper.h +1 -1
index b9de77d926..48f3b51dd2 100644
@@ -95,7 +95,7 @@ DEF_HELPER_FLAGS_1(set_rounding_mode, TCG_CALL_NO_RWG, void, env)
 
 DEF_HELPER_1(rdtime_d, i64, env)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* CSRs helper */
 DEF_HELPER_1(csrrd_pgd, i64, env)
 DEF_HELPER_1(csrrd_tval, i64, env)
target/loongarch/internals.h +2 -2
index 7b0f29c942..68d1d726c3 100644
@@ -56,7 +56,7 @@ const char *loongarch_exception_name(int32_t exception);
 int ieee_ex_to_loongarch(int xcpt);
 void restore_fp_status(CPULoongArchState *env);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_loongarch_cpu;
 
 void loongarch_cpu_set_irq(void *opaque, int irq, int level);
@@ -72,7 +72,7 @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                             bool probe, uintptr_t retaddr);
 
 hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 uint64_t read_fcc(CPULoongArchState *env);
 void write_fcc(CPULoongArchState *env, uint64_t val);
target/m68k/cpu.h +3 -3
index 048d5aae2b..ada0bbbf77 100644
@@ -173,11 +173,11 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void m68k_cpu_do_interrupt(CPUState *cpu);
 bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req);
 hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 void m68k_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 int m68k_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
@@ -581,7 +581,7 @@ static inline int cpu_mmu_index (CPUM68KState *env, bool ifetch)
 bool m68k_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                        MMUAccessType access_type, int mmu_idx,
                        bool probe, uintptr_t retaddr);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
                                  unsigned size, MMUAccessType access_type,
                                  int mmu_idx, MemTxAttrs attrs,
target/microblaze/cpu.h +6 -6
index 88324d0bc1..0ff502e1eb 100644
@@ -25,7 +25,7 @@
 #include "qemu/cpu-float.h"
 
 typedef struct CPUArchState CPUMBState;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "mmu.h"
 #endif
 
@@ -282,7 +282,7 @@ struct CPUArchState {
 
     uint32_t iflags;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     /* Unified MMU.  */
     MicroBlazeMMU mmu;
 #endif
@@ -355,12 +355,12 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void mb_cpu_do_interrupt(CPUState *cs);
 bool mb_cpu_exec_interrupt(CPUState *cs, int int_req);
 hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
                                         MemTxAttrs *attrs);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
                                            MMUAccessType access_type,
                                            int mmu_idx, uintptr_t retaddr);
@@ -409,7 +409,7 @@ static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc,
     *cs_base = (*flags & IMM_FLAG ? env->imm : 0);
 }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                      MMUAccessType access_type, int mmu_idx,
                      bool probe, uintptr_t retaddr);
@@ -435,7 +435,7 @@ static inline int cpu_mmu_index(CPUMBState *env, bool ifetch)
     return MMU_KERNEL_IDX;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_mb_cpu;
 #endif
 
target/microblaze/helper.h +1 -1
index f740835fcb..7e012ddfa7 100644
@@ -20,7 +20,7 @@ DEF_HELPER_FLAGS_3(fcmp_ne, TCG_CALL_NO_WG, i32, env, i32, i32)
 DEF_HELPER_FLAGS_3(fcmp_ge, TCG_CALL_NO_WG, i32, env, i32, i32)
 
 DEF_HELPER_FLAGS_2(pcmpbf, TCG_CALL_NO_RWG_SE, i32, i32, i32)
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 DEF_HELPER_FLAGS_3(mmu_read, TCG_CALL_NO_RWG, i32, env, i32, i32)
 DEF_HELPER_FLAGS_4(mmu_write, TCG_CALL_NO_RWG, void, env, i32, i32, i32)
 #endif
target/mips/cpu.h +3 -3
index 142c55af47..73c8ee9343 100644
@@ -1151,7 +1151,7 @@ typedef struct CPUArchState {
 
     /* Fields from here on are preserved across CPU reset. */
     CPUMIPSMVPContext *mvp;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     CPUMIPSTLBContext *tlb;
     void *irq[8];
     struct MIPSITUState *itu;
@@ -1300,7 +1300,7 @@ uint64_t cpu_mips_phys_to_kseg0(void *opaque, uint64_t addr);
 uint64_t cpu_mips_kseg1_to_phys(void *opaque, uint64_t addr);
 uint64_t cpu_mips_phys_to_kseg1(void *opaque, uint64_t addr);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 /* mips_int.c */
 void cpu_mips_soft_irq(CPUMIPSState *env, int irq, int level);
@@ -1308,7 +1308,7 @@ void cpu_mips_soft_irq(CPUMIPSState *env, int irq, int level);
 /* mips_itu.c */
 void itc_reconfigure(struct MIPSITUState *tag);
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /* helper.c */
 target_ulong exception_resume_pc(CPUMIPSState *env);
target/mips/helper.h +4 -4
index de32d82e98..cb619f3447 100644
@@ -9,12 +9,12 @@ DEF_HELPER_4(sdr, void, env, tl, tl, int)
 DEF_HELPER_4(swl, void, env, tl, tl, int)
 DEF_HELPER_4(swr, void, env, tl, tl, int)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_3(ll, tl, env, tl, int)
 #ifdef TARGET_MIPS64
 DEF_HELPER_3(lld, tl, env, tl, int)
 #endif
-#endif
+#endif /* CONFIG_SOFTMMU */
 
 DEF_HELPER_FLAGS_1(bitswap, TCG_CALL_NO_RWG_SE, tl, tl)
 #ifdef TARGET_MIPS64
@@ -589,9 +589,9 @@ DEF_HELPER_FLAGS_3(dmthlip, 0, void, tl, tl, env)
 DEF_HELPER_FLAGS_3(wrdsp, 0, void, tl, tl, env)
 DEF_HELPER_FLAGS_2(rddsp, 0, tl, tl, env)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "tcg/sysemu_helper.h.inc"
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 #include "tcg/msa_helper.h.inc"
 
target/mips/internal.h +2 -2
index 4b0031d10d..649a0e80c7 100644
@@ -99,7 +99,7 @@ int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 #define KSEG2_BASE      ((target_ulong)(int32_t)0xC0000000UL)
 #define KSEG3_BASE      ((target_ulong)(int32_t)0xE0000000UL)
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 enum {
     TLBRET_XI = -6,
@@ -161,7 +161,7 @@ void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val);
 
 extern const VMStateDescription vmstate_mips_cpu;
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 static inline bool cpu_mips_hw_interrupts_enabled(CPUMIPSState *env)
 {
target/mips/tcg/tcg-internal.h +2 -2
index aef032c48d..f0672184a8 100644
@@ -38,7 +38,7 @@ void do_raise_exception(CPUMIPSState *env,
     do_raise_exception_err(env, exception, 0, pc);
 }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 void mips_cpu_do_interrupt(CPUState *cpu);
 bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req);
@@ -67,6 +67,6 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
 
 void mips_semihosting(CPUMIPSState *env);
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 #endif
target/nios2/cpu.h +5 -5
index 20042c4332..3c67464e20 100644
@@ -27,7 +27,7 @@
 #include "qom/object.h"
 
 typedef struct CPUArchState CPUNios2State;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "mmu.h"
 #endif
 
@@ -60,7 +60,7 @@ struct Nios2CPUClass {
 #define NUM_GP_REGS 32
 #define NUM_CR_REGS 32
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* 63 shadow register sets; index 0 is the primary register set. */
 #define NUM_REG_SETS 64
 #endif
@@ -196,7 +196,7 @@ struct CPUArchState {
     uint32_t ctrl[NUM_CR_REGS];
     uint32_t pc;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     Nios2MMU mmu;
 #endif
     int error_code;
@@ -252,7 +252,7 @@ static inline bool nios2_cr_reserved(const ControlRegState *s)
 
 static inline void nios2_update_crs(CPUNios2State *env)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     unsigned crs = FIELD_EX32(env->ctrl[CR_STATUS], CR_STATUS, CRS);
     env->regs = env->shadow_regs[crs];
 #endif
@@ -286,7 +286,7 @@ static inline int cpu_mmu_index(CPUNios2State *env, bool ifetch)
                                                   MMU_SUPERVISOR_IDX;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 hwaddr nios2_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                         MMUAccessType access_type, int mmu_idx,
target/nios2/helper.h +1 -1
index 1648d76ade..073678dae5 100644
@@ -22,7 +22,7 @@ DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32)
 DEF_HELPER_FLAGS_3(divs, TCG_CALL_NO_WG, s32, env, s32, s32)
 DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32)
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 DEF_HELPER_3(eret, noreturn, env, i32, i32)
 DEF_HELPER_FLAGS_2(rdprs, TCG_CALL_NO_WG, i32, env, i32)
 DEF_HELPER_3(wrprs, void, env, i32, i32)
target/openrisc/cpu.h +4 -4
index f16e8b3274..ecdc94e48a 100644
@@ -225,7 +225,7 @@ typedef struct OpenRISCTLBEntry {
     uint32_t tr;
 } OpenRISCTLBEntry;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 typedef struct CPUOpenRISCTLBContext {
     OpenRISCTLBEntry itlb[TLB_SIZE];
     OpenRISCTLBEntry dtlb[TLB_SIZE];
@@ -268,7 +268,7 @@ typedef struct CPUArchState {
 
     uint32_t dflag;           /* In delay slot (boolean) */
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     CPUOpenRISCTLBContext tlb;
 #endif
 
@@ -284,7 +284,7 @@ typedef struct CPUArchState {
     uint32_t dmmucfgr;        /* DMMU configure register */
     uint32_t immucfgr;        /* IMMU configure register */
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     QEMUTimer *timer;
     uint32_t ttmr;          /* Timer tick mode register */
     int is_counting;
@@ -319,7 +319,7 @@ int print_insn_or1k(bfd_vma addr, disassemble_info *info);
 
 #define cpu_list cpu_openrisc_list
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 
 bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
target/ppc/cpu-qom.h +2 -2
index 9666f54f65..0d33645a64 100644
@@ -179,7 +179,7 @@ struct PowerPCCPUClass {
     uint32_t flags;
     int bfd_mach;
     uint32_t l1_dcache_size, l1_icache_size;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     unsigned int gdb_num_sprs;
     const char *gdb_spr_xml;
 #endif
@@ -191,7 +191,7 @@ struct PowerPCCPUClass {
     int  (*check_pow)(CPUPPCState *env);
 };
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 typedef struct PPCTimebase {
     uint64_t guest_timebase;
     int64_t time_of_the_day_ns;
target/ppc/cpu.h +16 -16
index 10c4ffa148..27f2562230 100644
@@ -206,13 +206,13 @@ typedef struct ppc_hash_pte64 ppc_hash_pte64_t;
 struct ppc_spr_t {
     const char *name;
     target_ulong default_value;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     unsigned int gdb_id;
 #endif
 #ifdef CONFIG_TCG
     void (*uea_read)(DisasContext *ctx, int gpr_num, int spr_num);
     void (*uea_write)(DisasContext *ctx, int spr_num, int gpr_num);
-# ifndef CONFIG_USER_ONLY
+# ifdef CONFIG_SOFTMMU
     void (*oea_read)(DisasContext *ctx, int gpr_num, int spr_num);
     void (*oea_write)(DisasContext *ctx, int spr_num, int gpr_num);
     void (*hea_read)(DisasContext *ctx, int gpr_num, int spr_num);
@@ -253,7 +253,7 @@ typedef ppc_vsr_t ppc_avr_t;
 typedef ppc_vsr_t ppc_fprp_t;
 typedef ppc_vsr_t ppc_acc_t;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 /* Software TLB cache */
 typedef struct ppc6xx_tlb_t ppc6xx_tlb_t;
 struct ppc6xx_tlb_t {
@@ -1128,7 +1128,7 @@ struct CPUArchState {
     /* when a memory exception occurs, the access type is stored here */
     int access_type;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     /* MMU context, only relevant for full system emulation */
 #if defined(TARGET_PPC64)
     ppc_slb_t slb[MAX_SLB_ENTRIES]; /* PowerPC 64 SLB area */
@@ -1193,7 +1193,7 @@ struct CPUArchState {
 
     int error_code;
     uint32_t pending_interrupts;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     /*
      * This is the IRQ controller, which is implementation dependent and only
      * relevant when emulating a complete machine. Note that this isn't used
@@ -1224,7 +1224,7 @@ struct CPUArchState {
     /* Power management */
     int (*check_pow)(CPUPPCState *env);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     void *load_info;  /* holds boot loading state */
 #endif
 
@@ -1328,7 +1328,7 @@ PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
 PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr);
 PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 struct PPCVirtualHypervisorClass {
     InterfaceClass parent;
     bool (*cpu_in_nested)(PowerPCCPU *cpu);
@@ -1364,7 +1364,7 @@ int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
 int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 void ppc_gdb_gen_spr_xml(PowerPCCPU *cpu);
 const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name);
@@ -1373,7 +1373,7 @@ int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
                                int cpuid, DumpState *s);
 int ppc32_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
                                int cpuid, DumpState *s);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void ppc_maybe_interrupt(CPUPPCState *env);
 void ppc_cpu_do_interrupt(CPUState *cpu);
 bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
@@ -1385,10 +1385,10 @@ extern const VMStateDescription vmstate_ppc_cpu;
 /*****************************************************************************/
 void ppc_translate_init(void);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 void ppc_store_sdr1(CPUPPCState *env, target_ulong value);
 void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val);
-#endif /* !defined(CONFIG_USER_ONLY) */
+#endif /* defined(CONFIG_SOFTMMU) */
 void ppc_store_msr(CPUPPCState *env, target_ulong value);
 
 void ppc_cpu_list(void);
@@ -1412,7 +1412,7 @@ void cpu_ppc_store_hdecr(CPUPPCState *env, target_ulong value);
 void cpu_ppc_store_tbu40(CPUPPCState *env, uint64_t value);
 uint64_t cpu_ppc_load_purr(CPUPPCState *env);
 void cpu_ppc_store_purr(CPUPPCState *env, uint64_t value);
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 target_ulong load_40x_pit(CPUPPCState *env);
 void store_40x_pit(CPUPPCState *env, target_ulong val);
 void store_40x_dbcr0(CPUPPCState *env, uint32_t val);
@@ -1486,7 +1486,7 @@ bool ppc_type_check_compat(const char *cputype, uint32_t compat_pvr,
 
 int ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 int ppc_set_compat_all(uint32_t compat_pvr, Error **errp);
 #endif
 int ppc_compat_max_vthreads(PowerPCCPU *cpu);
@@ -2522,11 +2522,11 @@ G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception,
                                        uint32_t error_code, uintptr_t raddr);
 
 /* PERFM EBB helper*/
-#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
+#if defined(TARGET_PPC64) && defined(CONFIG_SOFTMMU)
 void raise_ebb_perfm_exception(CPUPPCState *env);
 #endif
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 static inline int booke206_tlbm_id(CPUPPCState *env, ppcmas_tlb_t *tlbm)
 {
     uintptr_t tlbml = (uintptr_t)tlbm;
@@ -2741,7 +2741,7 @@ static inline bool ppc_has_spr(PowerPCCPU *cpu, int spr)
     return cpu->env.spr_cb[spr].name != NULL;
 }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv)
 {
     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
target/ppc/helper.h +4 -4
index 38efbc351c..c58b3dfca0 100644
@@ -8,7 +8,7 @@ DEF_HELPER_4(HASHST, void, env, tl, tl, tl)
 DEF_HELPER_4(HASHCHK, void, env, tl, tl, tl)
 DEF_HELPER_4(HASHSTP, void, env, tl, tl, tl)
 DEF_HELPER_4(HASHCHKP, void, env, tl, tl, tl)
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 DEF_HELPER_2(store_msr, void, env, tl)
 DEF_HELPER_1(ppc_maybe_interrupt, void, env)
 DEF_HELPER_1(rfi, void, env)
@@ -648,7 +648,7 @@ DEF_HELPER_3(efdcmplt, i32, env, i64, i64)
 DEF_HELPER_3(efdcmpgt, i32, env, i64, i64)
 DEF_HELPER_3(efdcmpeq, i32, env, i64, i64)
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 DEF_HELPER_2(4xx_tlbre_hi, tl, env, tl)
 DEF_HELPER_2(4xx_tlbre_lo, tl, env, tl)
 DEF_HELPER_3(4xx_tlbwe_hi, void, env, tl, tl)
@@ -695,7 +695,7 @@ DEF_HELPER_2(book3s_msgclr, void, env, tl)
 #endif
 
 DEF_HELPER_4(dlmzb, tl, env, tl, tl, i32)
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 DEF_HELPER_2(rac, tl, env, tl)
 
 DEF_HELPER_2(load_dcr, tl, env, tl)
@@ -711,7 +711,7 @@ DEF_HELPER_FLAGS_1(load_tbu, TCG_CALL_NO_RWG, tl, env)
 DEF_HELPER_FLAGS_1(load_atbl, TCG_CALL_NO_RWG, tl, env)
 DEF_HELPER_FLAGS_1(load_atbu, TCG_CALL_NO_RWG, tl, env)
 DEF_HELPER_FLAGS_1(load_vtb, TCG_CALL_NO_RWG, tl, env)
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #if defined(TARGET_PPC64)
 DEF_HELPER_FLAGS_1(load_purr, TCG_CALL_NO_RWG, tl, env)
 DEF_HELPER_FLAGS_2(store_purr, TCG_CALL_NO_RWG, void, env, tl)
target/ppc/internal.h +3 -3
index 901bae6d39..45e7e71ee4 100644
@@ -148,7 +148,7 @@ EXTRACT_HELPER(TO, 21, 5);
 
 EXTRACT_HELPER(CRM, 12, 8);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 EXTRACT_HELPER(SR, 16, 4);
 #endif
 
@@ -242,7 +242,7 @@ static inline int prot_for_access_type(MMUAccessType access_type)
     g_assert_not_reached();
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /* PowerPC MMU emulation */
 
@@ -269,7 +269,7 @@ struct mmu_ctx_t {
     int nx;                        /* Non-execute area          */
 };
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 /* Common routines used by software and hardware TLBs emulation */
 static inline int pte_is_valid(target_ulong pte0)
target/ppc/kvm_ppc.h +4 -4
index 611debc3ce..38d9888de9 100644
@@ -43,7 +43,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
 target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
                                      bool radix, bool gtse,
                                      uint64_t proc_tbl);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 bool kvmppc_spapr_use_multitce(void);
 int kvmppc_spapr_enable_inkernel_multitce(void);
 void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
@@ -53,7 +53,7 @@ int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
 int kvmppc_reset_htab(int shift_hint);
 uint64_t kvmppc_vrma_limit(unsigned int hash_shift);
 bool kvmppc_has_cap_spapr_vfio(void);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 bool kvmppc_has_cap_epr(void);
 int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function);
 int kvmppc_get_htab_fd(bool write, uint64_t index, Error **errp);
@@ -236,7 +236,7 @@ static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset)
 {
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static inline bool kvmppc_spapr_use_multitce(void)
 {
     return false;
@@ -296,7 +296,7 @@ static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)
     abort();
 }
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 static inline bool kvmppc_has_cap_epr(void)
 {
target/ppc/mmu-book3s-v3.h +1 -1
index 674377a19e..89173498ce 100644
@@ -23,7 +23,7 @@
 #include "mmu-hash64.h"
 #include "mmu-books.h"
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /*
  * Partition table definitions
target/ppc/mmu-hash32.h +1 -1
index 7119a63d97..35b6c54af8 100644
@@ -1,7 +1,7 @@
 #ifndef MMU_HASH32_H
 #define MMU_HASH32_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 hwaddr get_pteg_offset32(PowerPCCPU *cpu, hwaddr hash);
 bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
target/ppc/mmu-hash64.h +1 -1
index 1496955d38..0875edd0dc 100644
@@ -1,7 +1,7 @@
 #ifndef MMU_HASH64_H
 #define MMU_HASH64_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 #ifdef TARGET_PPC64
 void dump_slb(PowerPCCPU *cpu);
target/ppc/mmu-radix64.h +1 -1
index 4c768aa5cc..5dcb01ee95 100644
@@ -1,7 +1,7 @@
 #ifndef MMU_RADIX64_H
 #define MMU_RADIX64_H
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /* Radix Quadrants */
 #define R_EADDR_MASK            0x3FFFFFFFFFFFFFFF
target/ppc/power8-pmu.h +1 -1
index c0093e2219..13c94a540a 100644
@@ -13,7 +13,7 @@
 #ifndef POWER8_PMU_H
 #define POWER8_PMU_H
 
-#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
+#if defined(TARGET_PPC64) && defined(CONFIG_SOFTMMU)
 
 #define PMC_COUNTER_NEGATIVE_VAL 0x80000000UL
 
target/ppc/spr_common.h +1 -1
index 4c0f2bed77..6d89e8e051 100644
@@ -109,7 +109,7 @@ void spr_write_MMCR2_ureg(DisasContext *ctx, int sprn, int gprn);
 void spr_write_PMC14_ureg(DisasContext *ctx, int sprn, int gprn);
 void spr_write_PMC56_ureg(DisasContext *ctx, int sprn, int gprn);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void spr_write_clear(DisasContext *ctx, int sprn, int gprn);
 void spr_access_nop(DisasContext *ctx, int sprn, int gprn);
 void spr_read_decr(DisasContext *ctx, int gprn, int sprn);
target/riscv/cpu.h +5 -5
index de7e43126a..b663e3c4d6 100644
@@ -84,7 +84,7 @@ typedef enum {
 
 #define MAX_RISCV_PMPS (16)
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "pmp.h"
 #include "debug.h"
 #endif
@@ -161,7 +161,7 @@ struct CPUArchState {
     uint32_t elf_flags;
 #endif
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     target_ulong priv;
     /* This contains QEMU specific information about the virt state. */
     bool virt_enabled;
@@ -474,7 +474,7 @@ struct RISCVCPUConfig {
 
     bool short_isa_string;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     RISCVSATPMap satp_mode;
 #endif
 };
@@ -550,7 +550,7 @@ void riscv_cpu_list(void);
 #define cpu_list riscv_cpu_list
 #define cpu_mmu_index riscv_cpu_mmu_index
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
                                      vaddr addr, unsigned size,
                                      MMUAccessType access_type,
@@ -629,7 +629,7 @@ static inline const RISCVCPUConfig *riscv_cpu_cfg(CPURISCVState *env)
 static inline RISCVMXL cpu_recompute_xl(CPURISCVState *env)
 {
     RISCVMXL xl = env->misa_mxl;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     /*
      * When emulating a 32-bit-only cpu, use RV32.
      * When emulating a 64-bit cpu, and MXL has been reduced to RV32,
target/riscv/helper.h +2 -2
index 98e97810fd..d536341e6f 100644
@@ -109,7 +109,7 @@ DEF_HELPER_4(csrrw, tl, env, int, tl, tl)
 DEF_HELPER_2(csrr_i128, tl, env, int)
 DEF_HELPER_4(csrw_i128, void, env, int, tl, tl)
 DEF_HELPER_6(csrrw_i128, tl, env, int, tl, tl, tl, tl)
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_1(sret, tl, env)
 DEF_HELPER_1(mret, tl, env)
 DEF_HELPER_1(wfi, void, env)
@@ -120,7 +120,7 @@ DEF_HELPER_1(itrigger_match, void, env)
 #endif
 
 /* Hypervisor functions */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_1(hyp_tlb_flush, void, env)
 DEF_HELPER_1(hyp_gvma_tlb_flush, void, env)
 DEF_HELPER_FLAGS_2(hyp_hlv_bu, TCG_CALL_NO_WG, tl, env, tl)
target/riscv/internals.h +1 -1
index b5f823c7ec..da76ca6389 100644
@@ -70,7 +70,7 @@ target_ulong fclass_h(uint64_t frs1);
 target_ulong fclass_s(uint64_t frs1);
 target_ulong fclass_d(uint64_t frs1);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_riscv_cpu;
 #endif
 
target/rx/cpu.h +2 -2
index 555d230f24..ece11daf37 100644
@@ -120,11 +120,11 @@ struct ArchCPU {
 #define CPU_RESOLVING_TYPE TYPE_RX_CPU
 
 const char *rx_crname(uint8_t cr);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void rx_cpu_do_interrupt(CPUState *cpu);
 bool rx_cpu_exec_interrupt(CPUState *cpu, int int_req);
 hwaddr rx_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 void rx_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 int rx_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int rx_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
target/s390x/cpu.h +4 -4
index f130c29f83..d1db5ad2c3 100644
@@ -120,7 +120,7 @@ struct CPUArchState {
     uint16_t external_call_addr;
     DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     uint64_t tlb_fill_tec;   /* translation exception code during tlb_fill */
     int tlb_fill_exc;        /* exception number seen during tlb_fill */
 #endif
@@ -128,7 +128,7 @@ struct CPUArchState {
     /* Fields up to this point are cleared by a CPU reset */
     struct {} end_reset_fields;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     uint32_t core_id; /* PoP "CPU address", same as cpu_index */
     uint64_t cpuid;
 #endif
@@ -177,7 +177,7 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_s390_cpu;
 #endif
 
@@ -787,7 +787,7 @@ void s390_enable_css_support(S390CPU *cpu);
 void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);
 int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id,
                                 int vq, bool assign);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu);
 #else
 static inline unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
target/s390x/helper.h +1 -1
index 7529e725f2..de74302fed 100644
@@ -327,7 +327,7 @@ DEF_HELPER_4(gvec_vftci32, void, ptr, cptr, env, i32)
 DEF_HELPER_4(gvec_vftci64, void, ptr, cptr, env, i32)
 DEF_HELPER_4(gvec_vftci128, void, ptr, cptr, env, i32)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_3(servc, i32, env, i64, i64)
 DEF_HELPER_4(diag, void, env, i32, i32, i32)
 DEF_HELPER_3(load_psw, noreturn, env, i64, i64)
target/s390x/s390x-internal.h +4 -4
index 825252d728..5122fc0da6 100644
@@ -13,7 +13,7 @@
 #include "cpu.h"
 #include "fpu/softfloat.h"
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 typedef struct LowCore {
     /* prefix area: defined by architecture */
     uint32_t        ccw1[2];                  /* 0x000 */
@@ -201,7 +201,7 @@ enum cc_op {
     CC_OP_MAX
 };
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb,
                                        uint8_t *ar)
@@ -237,7 +237,7 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
                  uint64_t vr);
 
 /* cpu.c */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 unsigned int s390_cpu_halt(S390CPU *cpu);
 void s390_cpu_unhalt(S390CPU *cpu);
 void s390_cpu_init_sysemu(Object *obj);
@@ -324,7 +324,7 @@ void s390_cpu_gdb_init(CPUState *cs);
 /* helper.c */
 void s390_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 void do_restart_interrupt(CPUS390XState *env);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void s390_cpu_recompute_watchpoints(CPUState *cs);
 void s390x_tod_timer(void *opaque);
 void s390x_cpu_timer(void *opaque);
target/sh4/cpu.h +1 -1
index 02bfd612ea..9bb87d3c36 100644
@@ -223,7 +223,7 @@ G_NORETURN void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
 void sh4_translate_init(void);
 void sh4_cpu_list(void);
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                          MMUAccessType access_type, int mmu_idx,
target/sparc/cpu.h +5 -5
index 3d090e8278..b5bcc20bb6 100644
@@ -566,7 +566,7 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_sparc_cpu;
 
 hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
@@ -591,7 +591,7 @@ bool sparc_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
 target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev);
 void dump_mmu(CPUSPARCState *env);
 
-#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
+#if !defined(TARGET_SPARC64) && defined(CONFIG_SOFTMMU)
 int sparc_cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
                               uint8_t *buf, int len, bool is_write);
 #endif
@@ -639,7 +639,7 @@ static inline int tlb_compare_context(const SparcTLBEntry *tlb,
 #endif
 
 /* cpu-exec.c */
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 void sparc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
                                      vaddr addr, unsigned size,
                                      MMUAccessType access_type,
@@ -769,13 +769,13 @@ static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, target_ulong *pc,
     *pc = env->pc;
     *cs_base = env->npc;
     flags = cpu_mmu_index(env, false);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (cpu_supervisor_mode(env)) {
         flags |= TB_FLAG_SUPER;
     }
 #endif
 #ifdef TARGET_SPARC64
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (cpu_hypervisor_mode(env)) {
         flags |= TB_FLAG_HYPER;
     }
target/sparc/helper.h +1 -1
index b8f1e78c75..db35a40e0b 100644
@@ -38,7 +38,7 @@ DEF_HELPER_3(tsubcctv, tl, env, tl, tl)
 DEF_HELPER_FLAGS_3(sdivx, TCG_CALL_NO_WG, s64, env, s64, s64)
 DEF_HELPER_FLAGS_3(udivx, TCG_CALL_NO_WG, i64, env, i64, i64)
 #endif
-#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64)
+#if defined(CONFIG_SOFTMMU) || defined(TARGET_SPARC64)
 DEF_HELPER_FLAGS_4(ld_asi, TCG_CALL_NO_WG, i64, env, tl, int, i32)
 DEF_HELPER_FLAGS_5(st_asi, TCG_CALL_NO_WG, void, env, tl, i64, int, i32)
 #endif
target/xtensa/cpu.h +3 -3
index b7a54711a6..d3d0b0737e 100644
@@ -524,7 +524,7 @@ struct CPUArchState {
     uint32_t exclusive_addr;
     uint32_t exclusive_val;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     xtensa_tlb_entry itlb[7][MAX_TLB_WAY_SIZE];
     xtensa_tlb_entry dtlb[10][MAX_TLB_WAY_SIZE];
     xtensa_mpu_entry mpu_fg[MAX_MPU_FOREGROUND_SEGMENTS];
@@ -566,7 +566,7 @@ struct ArchCPU {
 };
 
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                          MMUAccessType access_type, int mmu_idx,
                          bool probe, uintptr_t retaddr);
@@ -676,7 +676,7 @@ static inline int xtensa_get_cring(const CPUXtensaState *env)
     }
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb,
         uint32_t vaddr, int is_write, int mmu_idx,
         uint32_t *paddr, uint32_t *page_size, unsigned *access);
target/xtensa/helper.h +2 -2
index ae938ceedb..ec1818240b 100644
@@ -11,11 +11,11 @@ DEF_HELPER_2(retw, void, env, i32)
 DEF_HELPER_3(window_check, noreturn, env, i32, i32)
 DEF_HELPER_1(restore_owb, void, env)
 DEF_HELPER_2(movsp, void, env, i32)
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_1(simcall, void, env)
 #endif
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 DEF_HELPER_3(waiti, void, env, i32, i32)
 DEF_HELPER_1(update_ccount, void, env)
 DEF_HELPER_2(wsr_ccount, void, env, i32)
target/s390x/tcg/insn-data.h.inc +1 -1
index bcc70d99ba..a9a1cd6a67 100644
@@ -1326,7 +1326,7 @@
 /* VECTOR FP TEST DATA CLASS IMMEDIATE */
     F(0xe74a, VFTCI,   VRI_e, V,   0, 0, 0, 0, vftci, 0, IF_VEC)
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* COMPARE AND SWAP AND PURGE */
     E(0xb250, CSP,     RRE,   Z,   r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL, IF_PRIV)
     E(0xb98a, CSPG,    RRE, DAT_ENH, r1_o, ra2, r1_P, 0, csp, 0, MO_TEUQ, IF_PRIV)
accel/accel-common.c +4 -4
index df72cc989a..061769284b 100644
@@ -29,9 +29,9 @@
 #include "cpu.h"
 #include "hw/core/accel-cpu.h"
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "accel-softmmu.h"
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 static const TypeInfo accel_type = {
     .name = TYPE_ACCEL,
@@ -103,9 +103,9 @@ static void accel_init_cpu_interfaces(AccelClass *ac)
 
 void accel_init_interfaces(AccelClass *ac)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     accel_init_ops_interfaces(ac);
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
     accel_init_cpu_interfaces(ac);
 }
accel/tcg/cpu-exec.c +10 -10
index d5695a7083..1bcec1460e 100644
@@ -30,7 +30,7 @@
 #include "qemu/rcu.h"
 #include "exec/log.h"
 #include "qemu/main-loop.h"
-#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
+#if defined(TARGET_I386) && defined(CONFIG_SOFTMMU)
 #include "hw/i386/apic.h"
 #endif
 #include "sysemu/cpus.h"
@@ -52,7 +52,7 @@ typedef struct SyncClocks {
     int64_t realtime_clock;
 } SyncClocks;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 /* Allow the guest to have a max 3ms advance.
  * The difference between the 2 clocks could therefore
  * oscillate around 0.
@@ -646,7 +646,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,
 
 static inline bool cpu_handle_halt(CPUState *cpu)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (cpu->halted) {
 #if defined(TARGET_I386)
         if (cpu->interrupt_request & CPU_INTERRUPT_POLL) {
@@ -687,7 +687,7 @@ static inline void cpu_handle_debug_exception(CPUState *cpu)
 static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
 {
     if (cpu->exception_index < 0) {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         if (replay_has_exception()
             && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra == 0) {
             /* Execute just one insn to trigger exception pending in the log */
@@ -746,7 +746,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
     return false;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /*
  * CPU_INTERRUPT_POLL is a virtual event which gets converted into a
  * "real" interrupt event later. It does not need to be recorded for
@@ -795,7 +795,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
             qemu_mutex_unlock_iothread();
             return true;
         }
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
         if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) {
             /* Do nothing */
         } else if (interrupt_request & CPU_INTERRUPT_HALT) {
@@ -909,7 +909,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb,
 
     /* Instruction counter expired.  */
     assert(icount_enabled());
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     /* Ensure global icount has gone forward */
     icount_update(cpu);
     /* Refill decrementer and continue execution.  */
@@ -992,7 +992,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
                 }
             }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             /*
              * We don't take care of direct jumps when address mapping
              * changes in system emulation.  So it's not safe to make a
@@ -1084,7 +1084,7 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp)
 
     cpu->tb_jmp_cache = g_new0(CPUJumpCache, 1);
     tlb_init(cpu);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     tcg_iommu_init_notifier_list(cpu);
 #endif /* !CONFIG_USER_ONLY */
     /* qemu_plugin_vcpu_init_hook delayed until cpu_index assigned. */
@@ -1093,7 +1093,7 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp)
 /* undo the initializations in reverse order */
 void tcg_exec_unrealizefn(CPUState *cpu)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     tcg_iommu_free_notifier_list(cpu);
 #endif /* !CONFIG_USER_ONLY */
 
accel/tcg/tcg-all.c +2 -2
index 02af6a2891..8fd2c7179f 100644
@@ -35,7 +35,7 @@
 #include "qemu/atomic.h"
 #include "qapi/qapi-builtin-visit.h"
 #include "qemu/units.h"
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "hw/boards.h"
 #endif
 #include "internal.h"
@@ -104,7 +104,7 @@ static void tcg_accel_instance_init(Object *obj)
     s->mttcg_enabled = default_mttcg_enabled();
 
     /* If debugging enabled, default "auto on", otherwise off. */
-#if defined(CONFIG_DEBUG_TCG) && !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_DEBUG_TCG) && defined(CONFIG_SOFTMMU)
     s->splitwx_enabled = -1;
 #else
     s->splitwx_enabled = 0;
accel/tcg/translate-all.c +1 -1
index dd19b3ca78..d715393a12 100644
@@ -595,7 +595,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr)
     }
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /*
  * In deterministic execution mode, instructions doing device I/Os
  * must be at the end of the TB.
cpu.c +4 -4
index 65ebaf8159..4a91ecd630 100644
@@ -47,7 +47,7 @@
 uintptr_t qemu_host_page_size;
 intptr_t qemu_host_page_mask;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static int cpu_common_post_load(void *opaque, int version_id)
 {
     CPUState *cpu = opaque;
@@ -168,7 +168,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
 
 void cpu_exec_unrealizefn(CPUState *cpu)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     CPUClass *cc = CPU_GET_CLASS(cpu);
 
     if (cc->sysemu_ops->legacy_vmsd != NULL) {
@@ -250,7 +250,7 @@ void cpu_exec_initfn(CPUState *cpu)
     cpu->as = NULL;
     cpu->num_ases = 0;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     cpu->thread_id = qemu_get_thread_id();
     cpu->memory = get_system_memory();
     object_ref(OBJECT(cpu->memory));
@@ -328,7 +328,7 @@ void cpu_single_step(CPUState *cpu, int enabled)
     if (cpu->singlestep_enabled != enabled) {
         cpu->singlestep_enabled = enabled;
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
         const AccelOpsClass *ops = cpus_get_accel();
         if (ops->update_guest_debug) {
             ops->update_guest_debug(cpu);
gdbstub/gdbstub.c +4 -4
index be18568d0a..14d8edbbae 100644
@@ -1549,7 +1549,7 @@ static void handle_query_xfer_features(GArray *params, void *user_ctx)
 static void handle_query_qemu_supported(GArray *params, void *user_ctx)
 {
     g_string_printf(gdbserver_state.str_buf, "sstepbits;sstep");
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     g_string_append(gdbserver_state.str_buf, ";PhyMemMode");
 #endif
     gdb_put_strbuf();
@@ -1643,7 +1643,7 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = {
         .handler = handle_query_qemu_supported,
         .cmd = "qemu.Supported",
     },
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     {
         .handler = gdb_handle_query_qemu_phy_mem_mode,
         .cmd = "qemu.PhyMemMode",
@@ -1659,7 +1659,7 @@ static const GdbCmdParseEntry gdb_gen_set_table[] = {
         .cmd_startswith = 1,
         .schema = "l0"
     },
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     {
         .handler = gdb_handle_set_qemu_phy_mem_mode,
         .cmd = "qemu.PhyMemMode:",
@@ -1995,7 +1995,7 @@ void gdb_read_byte(uint8_t ch)
     uint8_t reply;
 
     gdbserver_state.allow_stop_reply = false;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (gdbserver_state.last_packet->len) {
         /* Waiting for a response to the last packet.  If we see the start
            of a new command then abandon the previous response.  */
plugins/api.c +2 -2
index 2078b16edb..5397d03f9e 100644
@@ -42,7 +42,7 @@
 #include "exec/ram_addr.h"
 #include "disas/disas.h"
 #include "plugin.h"
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "qemu/plugin-memory.h"
 #include "hw/boards.h"
 #else
@@ -362,7 +362,7 @@ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
  * will be. This helps the plugin dimension per-vcpu arrays.
  */
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static MachineState * get_ms(void)
 {
     return MACHINE(qdev_get_machine());
plugins/loader.c +2 -2
index 809f3f9b13..02dd7f705d 100644
@@ -30,7 +30,7 @@
 #include "qemu/memalign.h"
 #include "hw/core/cpu.h"
 #include "exec/tb-flush.h"
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "hw/boards.h"
 #endif
 #include "qemu/compiler.h"
@@ -295,7 +295,7 @@ int qemu_plugin_load_list(QemuPluginList *head, Error **errp)
     info->target_name = TARGET_NAME;
     info->version.min = QEMU_PLUGIN_MIN_VERSION;
     info->version.cur = QEMU_PLUGIN_VERSION;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     MachineState *ms = MACHINE(qdev_get_machine());
     info->system_emulation = true;
     info->system.smp_vcpus = ms->smp.cpus;
semihosting/arm-compat-semi.c +5 -5
index 564fe17f75..32508931dc 100644
@@ -100,7 +100,7 @@ static int gdb_open_modeflags[12] = {
     GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND,
 };
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /**
  * common_semi_find_bases: find information about ram and heap base
@@ -205,7 +205,7 @@ static LayoutInfo common_semi_find_bases(CPUState *cs)
  * errno be per-thread in linux-user mode; in softmmu it is a simple
  * global, and we assume that the guest takes care of avoiding any races.
  */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static target_ulong syscall_err;
 
 #include "semihosting/softmmu-uaccess.h"
@@ -584,7 +584,7 @@ void do_common_semihosting(CPUState *cs)
             size_t input_size;
             size_t output_size;
             int status = 0;
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
             const char *cmdline;
 #else
             TaskState *ts = cs->opaque;
@@ -593,7 +593,7 @@ void do_common_semihosting(CPUState *cs)
             GET_ARG(1);
             input_size = arg1;
             /* Compute the size of the output string.  */
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
             cmdline = semihosting_get_cmdline();
             if (cmdline == NULL) {
                 cmdline = ""; /* Default to an empty line. */
@@ -631,7 +631,7 @@ void do_common_semihosting(CPUState *cs)
             }
 
             /* Copy the command-line arguments.  */
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
             pstrcpy(output_buffer, output_size, cmdline);
 #else
             if (output_size == 1) {
semihosting/guestfd.c +1 -1
index acb86b50dd..859e733008 100644
@@ -45,7 +45,7 @@ void qemu_semihosting_guestfd_init(void)
 #else
     /* Otherwise, the stdio file descriptors apply. */
     guestfd_array = g_array_set_size(guestfd_array, 3);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (!use_gdb_syscalls()) {
         GuestFD *gf = &g_array_index(guestfd_array, GuestFD, 0);
         gf[0].type = GuestFDConsole;
semihosting/syscalls.c +3 -3
index 68899ebb1c..65782ae2f9 100644
@@ -525,7 +525,7 @@ static void host_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
     unlock_user(p, tv_addr, sizeof(struct gdb_timeval));
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static void host_poll_one(CPUState *cs, gdb_syscall_complete_cb complete,
                           GuestFD *gf, GIOCondition cond, int timeout)
 {
@@ -648,7 +648,7 @@ static void console_fstat(CPUState *cs, gdb_syscall_complete_cb complete,
     complete(cs, ret ? -1 : 0, ret ? -ret : 0);
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static void console_poll_one(CPUState *cs, gdb_syscall_complete_cb complete,
                              GuestFD *gf, GIOCondition cond, int timeout)
 {
@@ -955,7 +955,7 @@ void semihost_sys_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
     }
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void semihost_sys_poll_one(CPUState *cs, gdb_syscall_complete_cb complete,
                            int fd, GIOCondition cond, int timeout)
 {
softmmu/memory.c +1 -1
index 7d9494ce70..2f21336288 100644
@@ -3400,7 +3400,7 @@ static void mtree_print_flatview(gpointer key, gpointer value,
         range++;
     }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     if (fvi->dispatch_tree && view->root) {
         mtree_print_dispatch(view->dispatch, view->root);
     }
target/alpha/cpu.c +5 -5
index 270ae787b1..04c47edfdf 100644
@@ -222,13 +222,13 @@ static void alpha_cpu_initfn(Object *obj)
 #endif
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "hw/core/sysemu-cpu-ops.h"
 
 static const struct SysemuCPUOps alpha_sysemu_ops = {
     .get_phys_page_debug = alpha_cpu_get_phys_page_debug,
 };
-#endif
+#endif /* CONFIG_SOFTMMU */
 
 #include "hw/core/tcg-cpu-ops.h"
 
@@ -239,13 +239,13 @@ static const struct TCGCPUOps alpha_tcg_ops = {
 #ifdef CONFIG_USER_ONLY
     .record_sigsegv = alpha_cpu_record_sigsegv,
     .record_sigbus = alpha_cpu_record_sigbus,
-#else
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
     .tlb_fill = alpha_cpu_tlb_fill,
     .cpu_exec_interrupt = alpha_cpu_exec_interrupt,
     .do_interrupt = alpha_cpu_do_interrupt,
     .do_transaction_failed = alpha_cpu_do_transaction_failed,
     .do_unaligned_access = alpha_cpu_do_unaligned_access,
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 };
 
 static void alpha_cpu_class_init(ObjectClass *oc, void *data)
@@ -264,7 +264,7 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
     cc->get_pc = alpha_cpu_get_pc;
     cc->gdb_read_register = alpha_cpu_gdb_read_register;
     cc->gdb_write_register = alpha_cpu_gdb_write_register;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     dc->vmsd = &vmstate_alpha_cpu;
     cc->sysemu_ops = &alpha_sysemu_ops;
 #endif
target/alpha/helper.c +2 -2
index 970c869771..09ddbbce11 100644
@@ -97,7 +97,7 @@ void helper_store_fpcr(CPUAlphaState *env, uint64_t val)
 
 static uint64_t *cpu_alpha_addr_gr(CPUAlphaState *env, unsigned reg)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (env->flags & ENV_FLAG_PAL_MODE) {
         if (reg >= 8 && reg <= 14) {
             return &env->shadow[reg - 8];
@@ -477,7 +477,7 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
     return false;
 }
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
target/alpha/sys_helper.c +2 -2
index c83c92dd4c..6bb5aec5d4 100644
@@ -29,7 +29,7 @@
 
 uint64_t helper_load_pcc(CPUAlphaState *env)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     /* In system mode we have access to a decent high-resolution clock.
        In order to make OS-level time accounting work with the RPCC,
        present it with a well-timed clock fixed at 250MHz.  */
@@ -43,7 +43,7 @@ uint64_t helper_load_pcc(CPUAlphaState *env)
 }
 
 /* PALcode support special instructions */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void helper_tbia(CPUAlphaState *env)
 {
     tlb_flush(env_cpu(env));
target/alpha/translate.c +11 -11
index 1f7dd078d8..995af81c06 100644
@@ -92,7 +92,7 @@ static TCGv cpu_pc;
 static TCGv cpu_lock_addr;
 static TCGv cpu_lock_value;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static TCGv cpu_pal_ir[31];
 #endif
 
@@ -122,7 +122,7 @@ void alpha_translate_init(void)
         "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
         "f24", "f25", "f26", "f27", "f28", "f29", "f30"
     };
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     static const char shadow_names[8][8] = {
         "pal_t7", "pal_s0", "pal_s1", "pal_s2",
         "pal_s3", "pal_s4", "pal_s5", "pal_t11"
@@ -143,7 +143,7 @@ void alpha_translate_init(void)
                                             freg_names[i]);
     }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     memcpy(cpu_pal_ir, cpu_std_ir, sizeof(cpu_pal_ir));
     for (i = 0; i < 8; i++) {
         int r = (i == 7 ? 25 : i + 8);
@@ -643,7 +643,7 @@ static TCGv gen_ieee_input(DisasContext *ctx, int reg, int fn11, int is_cmp)
                 gen_helper_ieee_input(cpu_env, val);
             }
         } else {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             /* In system mode, raise exceptions for denormals like real
                hardware.  In user mode, proceed as if the OS completion
                handler is handling the denormal as per spec.  */
@@ -1076,7 +1076,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode)
         return DISAS_NEXT;
     }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     /* Privileged PAL code */
     if (palcode < 0x40 && (ctx->tbflags & ENV_FLAG_PS_USER) == 0) {
         switch (palcode) {
@@ -1188,7 +1188,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode)
 #endif
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 #define PR_LONG         0x200000
 
@@ -2362,7 +2362,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
 
     case 0x19:
         /* HW_MFPR (PALcode) */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         REQUIRE_TB_FLAG(ENV_FLAG_PAL_MODE);
         va = dest_gpr(ctx, ra);
         ret = gen_mfpr(ctx, va, insn & 0xffff);
@@ -2384,7 +2384,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
 
     case 0x1B:
         /* HW_LD (PALcode) */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         REQUIRE_TB_FLAG(ENV_FLAG_PAL_MODE);
         {
             TCGv addr = tcg_temp_new();
@@ -2612,7 +2612,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
 
     case 0x1D:
         /* HW_MTPR (PALcode) */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         REQUIRE_TB_FLAG(ENV_FLAG_PAL_MODE);
         vb = load_gpr(ctx, rb);
         ret = gen_mtpr(ctx, vb, insn & 0xffff);
@@ -2623,7 +2623,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
 
     case 0x1E:
         /* HW_RET (PALcode) */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         REQUIRE_TB_FLAG(ENV_FLAG_PAL_MODE);
         if (rb == 31) {
             /* Pre-EV6 CPUs interpreted this as HW_REI, loading the return
@@ -2649,7 +2649,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
 
     case 0x1F:
         /* HW_ST (PALcode) */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         REQUIRE_TB_FLAG(ENV_FLAG_PAL_MODE);
         {
             switch ((insn >> 12) & 0xF) {
target/arm/cpu.c +22 -22

175 lines not on this page · raw message

target/arm/debug_helper.c +2 -2
index d41cc643b1..3d992a4253 100644
@@ -746,7 +746,7 @@ void hw_breakpoint_update_all(ARMCPU *cpu)
     }
 }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
 {
@@ -771,7 +771,7 @@ vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
     return addr;
 }
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 #endif /* CONFIG_TCG */
 
 /*
target/arm/gdbstub.c +3 -3
index 03b17c814f..a3d23c5aaf 100644
@@ -439,7 +439,7 @@ static int arm_gen_dynamic_m_systemreg_xml(CPUState *cs, int orig_base_reg)
     return cpu->dyn_m_systemreg_xml.num;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /*
  * For user-only, we see the non-secure registers via m_systemreg above.
  * For secext, encode the non-secure view as even and secure view as odd.
@@ -492,7 +492,7 @@ const char *arm_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
         return cpu->dyn_svereg_xml.desc;
     } else if (strcmp(xmlname, "arm-m-system.xml") == 0) {
         return cpu->dyn_m_systemreg_xml.desc;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     } else if (strcmp(xmlname, "arm-m-secext.xml") == 0) {
         return cpu->dyn_m_secextreg_xml.desc;
 #endif
@@ -566,7 +566,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
             arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg,
             arm_gen_dynamic_m_systemreg_xml(cs, cs->gdb_num_regs),
             "arm-m-system.xml", 0);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
             gdb_register_coprocessor(cs,
                 arm_gdb_get_m_secextreg, arm_gdb_set_m_secextreg,
target/arm/helper.c +24 -24

192 lines not on this page · raw message

target/arm/tcg/cpu32.c +9 -9
index 47d2e8e781..2dd61b87a5 100644
@@ -13,11 +13,11 @@
 #include "hw/core/tcg-cpu-ops.h"
 #include "internals.h"
 #include "target/arm/idau.h"
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "hw/boards.h"
 #endif
 #include "cpregs.h"
-#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
+#if defined(CONFIG_SOFTMMU) && defined(CONFIG_TCG)
 #include "hw/intc/armv7m_nvic.h"
 #endif
 
@@ -92,9 +92,9 @@ void aa32_max_features(ARMCPU *cpu)
 }
 
 /* CPU models. These are not needed for the AArch64 linux-user build. */
-#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
+#if defined(CONFIG_SOFTMMU) || !defined(TARGET_AARCH64)
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
 {
     CPUClass *cc = CPU_GET_CLASS(cs);
@@ -448,7 +448,7 @@ static void cortex_a9_initfn(Object *obj)
     define_arm_cp_regs(cpu, cortexa9_cp_reginfo);
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static uint64_t a15_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
@@ -462,7 +462,7 @@ static uint64_t a15_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
 #endif
 
 static const ARMCPRegInfo cortexa15_cp_reginfo[] = {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     { .name = "L2CTLR", .cp = 15, .crn = 9, .crm = 0, .opc1 = 1, .opc2 = 2,
       .access = PL1_RW, .resetvalue = 0, .readfn = a15_l2ctlr_read,
       .writefn = arm_cp_write_ignore, },
@@ -1021,7 +1021,7 @@ static const struct TCGCPUOps arm_v7m_tcg_ops = {
 #ifdef CONFIG_USER_ONLY
     .record_sigsegv = arm_cpu_record_sigsegv,
     .record_sigbus = arm_cpu_record_sigbus,
-#else
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
     .tlb_fill = arm_cpu_tlb_fill,
     .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt,
     .do_interrupt = arm_v7m_cpu_do_interrupt,
@@ -1030,7 +1030,7 @@ static const struct TCGCPUOps arm_v7m_tcg_ops = {
     .adjust_watchpoint_address = arm_adjust_watchpoint_address,
     .debug_check_watchpoint = arm_debug_check_watchpoint,
     .debug_check_breakpoint = arm_debug_check_breakpoint,
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 };
 
 static void arm_v7m_class_init(ObjectClass *oc, void *data)
@@ -1182,4 +1182,4 @@ static void arm_tcg_cpu_register_types(void)
 
 type_init(arm_tcg_cpu_register_types)
 
-#endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
+#endif /* CONFIG_SOFTMMU || !TARGET_AARCH64 */
target/arm/tcg/helper-a64.c +1 -1
index c3edf163be..c28f7a93fb 100644
@@ -925,7 +925,7 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
      */
     mem = tlb_vaddr_to_host(env, vaddr, MMU_DATA_STORE, mmu_idx);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (unlikely(!mem)) {
         uintptr_t ra = GETPC();
 
target/arm/tcg/m_helper.c +3 -3
index 9cef70e5c9..e8c8f223c3 100644
@@ -19,7 +19,7 @@
 #include "exec/cpu_ldst.h"
 #include "semihosting/common-semi.h"
 #endif
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 #include "hw/intc/armv7m_nvic.h"
 #endif
 
@@ -159,7 +159,7 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
     return ARMMMUIdx_MUser;
 }
 
-#else /* !CONFIG_USER_ONLY */
+#else /* !CONFIG_USER_ONLY = CONFIG_SOFTMMU */
 
 static ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
                                      bool secstate, bool priv, bool negpri)
@@ -2862,7 +2862,7 @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
     return tt_resp;
 }
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure, bool threadmode,
                              bool spsel)
target/arm/tcg/op_helper.c +1 -1
index 3baf8004f6..98ec566273 100644
@@ -256,7 +256,7 @@ void HELPER(check_bxj_trap)(CPUARMState *env, uint32_t rm)
     }
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped.
  * The function returns the target EL (1-3) if the instruction is to be trapped;
  * otherwise it returns 0 indicating it is not trapped.
target/arm/tcg/sve_helper.c +1 -1
index 0097522470..8ab4b877e4 100644
@@ -5535,7 +5535,7 @@ bool sve_cont_ldst_pages(SVEContLdSt *info, SVEContFault fault,
     return have_work;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 void sve_cont_ldst_watchpoints(SVEContLdSt *info, CPUARMState *env,
                                uint64_t *vg, target_ulong addr,
                                int esize, int msize, int wp_access,
target/arm/tcg/tlb_helper.c +2 -2
index 8df36c2cbf..57105fc304 100644
@@ -180,7 +180,7 @@ void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc)
     raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el);
 }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
 
 /*
  * arm_cpu_do_transaction_failed: handle a memory system error response
@@ -281,4 +281,4 @@ void arm_cpu_record_sigbus(CPUState *cs, vaddr addr,
 {
     arm_cpu_do_unaligned_access(cs, addr, access_type, MMU_USER_IDX, ra);
 }
-#endif /* !defined(CONFIG_USER_ONLY) */
+#endif /* defined(CONFIG_SOFTMMU) */
target/arm/tcg/translate-a64.c +1 -1
index d9800337cf..60f5035c1a 100644
@@ -14064,7 +14064,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,
     dc->tbid = EX_TBFLAG_A64(tb_flags, TBID);
     dc->tcma = EX_TBFLAG_A64(tb_flags, TCMA);
     dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx);
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     dc->user = (dc->current_el == 0);
 #endif
     dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL);
target/arm/tcg/translate.c +3 -3
index a68d3c7f6d..2b3ac587e8 100644
@@ -327,7 +327,7 @@ void store_reg(DisasContext *s, int reg, TCGv_i32 var)
  */
 static void store_sp_checked(DisasContext *s, TCGv_i32 var)
 {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (s->v8m_stackcheck) {
         gen_helper_v8m_stackcheck(cpu_env, var);
     }
@@ -789,7 +789,7 @@ static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var)
      * s->base.is_jmp that we need to do the rest of the work later.
      */
     gen_bx(s, var);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (arm_dc_feature(s, ARM_FEATURE_M_SECURITY) ||
         (s->v7m_handler_mode && arm_dc_feature(s, ARM_FEATURE_M))) {
         s->base.is_jmp = DISAS_BX_EXCRET;
@@ -9134,7 +9134,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
     core_mmu_idx = EX_TBFLAG_ANY(tb_flags, MMUIDX);
     dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx);
     dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx);
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     dc->user = (dc->current_el == 0);
 #endif
     dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL);
target/cris/cpu.c +9 -9
index a6a93c2359..34abc3ee85 100644
@@ -158,7 +158,7 @@ static void cris_cpu_realizefn(DeviceState *dev, Error **errp)
     ccc->parent_realize(dev, errp);
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static void cris_cpu_set_irq(void *opaque, int irq, int level)
 {
     CRISCPU *cpu = opaque;
@@ -179,7 +179,7 @@ static void cris_cpu_set_irq(void *opaque, int irq, int level)
         cpu_reset_interrupt(cs, type);
     }
 }
-#endif
+#endif /* CONFIG_SOFTMMU */
 
 static void cris_disas_set_info(CPUState *cpu, disassemble_info *info)
 {
@@ -205,13 +205,13 @@ static void cris_cpu_initfn(Object *obj)
 
     env->pregs[PR_VR] = ccc->vr;
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     /* IRQ and NMI lines.  */
     qdev_init_gpio_in(DEVICE(cpu), cris_cpu_set_irq, 2);
 #endif
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "hw/core/sysemu-cpu-ops.h"
 
 static const struct SysemuCPUOps cris_sysemu_ops = {
@@ -225,22 +225,22 @@ static const struct TCGCPUOps crisv10_tcg_ops = {
     .initialize = cris_initialize_crisv10_tcg,
     .restore_state_to_opc = cris_restore_state_to_opc,
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     .tlb_fill = cris_cpu_tlb_fill,
     .cpu_exec_interrupt = cris_cpu_exec_interrupt,
     .do_interrupt = crisv10_cpu_do_interrupt,
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 };
 
 static const struct TCGCPUOps crisv32_tcg_ops = {
     .initialize = cris_initialize_tcg,
     .restore_state_to_opc = cris_restore_state_to_opc,
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     .tlb_fill = cris_cpu_tlb_fill,
     .cpu_exec_interrupt = cris_cpu_exec_interrupt,
     .do_interrupt = cris_cpu_do_interrupt,
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 };
 
 static void crisv8_cpu_class_init(ObjectClass *oc, void *data)
@@ -322,7 +322,7 @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
     cc->get_pc = cris_cpu_get_pc;
     cc->gdb_read_register = cris_cpu_gdb_read_register;
     cc->gdb_write_register = cris_cpu_gdb_write_register;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     dc->vmsd = &vmstate_cris_cpu;
     cc->sysemu_ops = &cris_sysemu_ops;
 #endif
target/cris/op_helper.c +4 -4
index d55a18a213..09aaf77b5f 100644
@@ -47,7 +47,7 @@ void helper_raise_exception(CPUCRISState *env, uint32_t index)
 
 void helper_tlb_flush_pid(CPUCRISState *env, uint32_t pid)
 {
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     pid &= 0xff;
     if (pid != (env->pregs[PR_PID] & 0xff)) {
         cris_mmu_flush_pid(env, env->pregs[PR_PID]);
@@ -57,7 +57,7 @@ void helper_tlb_flush_pid(CPUCRISState *env, uint32_t pid)
 
 void helper_spc_write(CPUCRISState *env, uint32_t new_spc)
 {
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     CPUState *cs = env_cpu(env);
 
     tlb_flush_page(cs, env->pregs[PR_SPC]);
@@ -76,7 +76,7 @@ void helper_movl_sreg_reg(CPUCRISState *env, uint32_t sreg, uint32_t reg)
     srs &= 3;
     env->sregs[srs][sreg] = env->regs[reg];
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     if (srs == 1 || srs == 2) {
         if (sreg == 6) {
             /* Writes to tlb-hi write to mm_cause as a side effect.  */
@@ -121,7 +121,7 @@ void helper_movl_reg_sreg(CPUCRISState *env, uint32_t reg, uint32_t sreg)
     env->pregs[PR_SRS] &= 3;
     srs = env->pregs[PR_SRS];
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     if (srs == 1 || srs == 2) {
         uint32_t set;
         uint32_t idx;
target/cris/translate.c +1 -1
index 1445cd8bb5..f090c98c56 100644
@@ -2890,7 +2890,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc)
         }
     }
 
-#if !defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_SOFTMMU)
     /* Single-stepping ?  */
     if (dc->tb_flags & S_FLAG) {
         TCGLabel *l1 = gen_new_label();
target/hexagon/genptr.c +1 -1
index 217bc7bb5a..233469a4db 100644
@@ -772,7 +772,7 @@ static void gen_framecheck(TCGv EA, int framesize)
 {
     /* Not modelled in linux-user mode */
     /* Placeholder for system mode */
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     g_assert_not_reached();
 #endif
 }
target/hppa/cpu.c +7 -7
index 11022f9c99..3541efaa10 100644
@@ -99,7 +99,7 @@ static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info)
     info->print_insn = print_insn_hppa;
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static G_NORETURN
 void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
                                   MMUAccessType access_type, int mmu_idx,
@@ -117,7 +117,7 @@ void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
 
     cpu_loop_exit_restore(cs, retaddr);
 }
-#endif /* CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
 {
@@ -134,7 +134,7 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
     qemu_init_vcpu(cs);
     acc->parent_realize(dev, errp);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     {
         HPPACPU *cpu = HPPA_CPU(cs);
         cpu->alarm_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
@@ -160,7 +160,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
     return object_class_by_name(TYPE_HPPA_CPU);
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "hw/core/sysemu-cpu-ops.h"
 
 static const struct SysemuCPUOps hppa_sysemu_ops = {
@@ -175,12 +175,12 @@ static const struct TCGCPUOps hppa_tcg_ops = {
     .synchronize_from_tb = hppa_cpu_synchronize_from_tb,
     .restore_state_to_opc = hppa_restore_state_to_opc,
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     .tlb_fill = hppa_cpu_tlb_fill,
     .cpu_exec_interrupt = hppa_cpu_exec_interrupt,
     .do_interrupt = hppa_cpu_do_interrupt,
     .do_unaligned_access = hppa_cpu_do_unaligned_access,
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 };
 
 static void hppa_cpu_class_init(ObjectClass *oc, void *data)
@@ -199,7 +199,7 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
     cc->get_pc = hppa_cpu_get_pc;
     cc->gdb_read_register = hppa_cpu_gdb_read_register;
     cc->gdb_write_register = hppa_cpu_gdb_write_register;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     dc->vmsd = &vmstate_hppa_cpu;
     cc->sysemu_ops = &hppa_sysemu_ops;
 #endif
target/hppa/helper.c +2 -2
index 74b8747083..308d97e484 100644
@@ -70,7 +70,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)
 
     /* If PSW_P changes, it affects how we translate addresses.  */
     if ((psw ^ old_psw) & PSW_P) {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         tlb_flush_by_mmuidx(env_cpu(env), 0xf);
 #endif
     }
@@ -119,7 +119,7 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
         qemu_fprintf(f, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
                      (i & 3) == 3 ? '\n' : ' ');
     }
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     for (i = 0; i < 8; i++) {
         qemu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32),
                      (i & 3) == 3 ? '\n' : ' ');
target/hppa/translate.c +18 -18
index d33813d173..1189eca265 100644
@@ -500,7 +500,7 @@ static TCGv_reg get_temp(DisasContext *ctx)
     return ctx->tempr[i] = tcg_temp_new();
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 static TCGv_tl get_temp_tl(DisasContext *ctx)
 {
     unsigned i = ctx->ntempl++;
@@ -1368,7 +1368,7 @@ static void do_unit(DisasContext *ctx, unsigned rt, TCGv_reg in1,
     }
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 /* The "normal" usage is SP >= 0, wherein SP == 0 selects the space
    from the top 2 bits of the base register.  There are a few system
    instructions that have a 3-bit space specifier, for which SR0 is
@@ -2158,7 +2158,7 @@ static bool trans_mtctl(DisasContext *ctx, arg_mtctl *a)
     /* All other control registers are privileged or read-only.  */
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_REG);
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     nullify_over(ctx);
     reg = load_gpr(ctx, a->r);
 
@@ -2191,7 +2191,7 @@ static bool trans_mtctl(DisasContext *ctx, arg_mtctl *a)
     case CR_PID3:
     case CR_PID4:
         tcg_gen_st_reg(reg, cpu_env, offsetof(CPUHPPAState, cr[ctl]));
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         gen_helper_change_prot_id(cpu_env);
 #endif
         break;
@@ -2239,7 +2239,7 @@ static bool trans_ldsid(DisasContext *ctx, arg_ldsid *a)
 static bool trans_rsm(DisasContext *ctx, arg_rsm *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_reg tmp;
 
     nullify_over(ctx);
@@ -2259,7 +2259,7 @@ static bool trans_rsm(DisasContext *ctx, arg_rsm *a)
 static bool trans_ssm(DisasContext *ctx, arg_ssm *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_reg tmp;
 
     nullify_over(ctx);
@@ -2279,7 +2279,7 @@ static bool trans_ssm(DisasContext *ctx, arg_ssm *a)
 static bool trans_mtsm(DisasContext *ctx, arg_mtsm *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_reg tmp, reg;
     nullify_over(ctx);
 
@@ -2296,7 +2296,7 @@ static bool trans_mtsm(DisasContext *ctx, arg_mtsm *a)
 static bool do_rfi(DisasContext *ctx, bool rfi_r)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     nullify_over(ctx);
 
     if (rfi_r) {
@@ -2325,7 +2325,7 @@ static bool trans_rfi_r(DisasContext *ctx, arg_rfi_r *a)
 static bool trans_halt(DisasContext *ctx, arg_halt *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     nullify_over(ctx);
     gen_helper_halt(cpu_env);
     ctx->base.is_jmp = DISAS_NORETURN;
@@ -2336,7 +2336,7 @@ static bool trans_halt(DisasContext *ctx, arg_halt *a)
 static bool trans_reset(DisasContext *ctx, arg_reset *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     nullify_over(ctx);
     gen_helper_reset(cpu_env);
     ctx->base.is_jmp = DISAS_NORETURN;
@@ -2347,7 +2347,7 @@ static bool trans_reset(DisasContext *ctx, arg_reset *a)
 static bool trans_getshadowregs(DisasContext *ctx, arg_getshadowregs *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     nullify_over(ctx);
     gen_helper_getshadowregs(cpu_env);
     return nullify_end(ctx);
@@ -2398,7 +2398,7 @@ static bool trans_probe(DisasContext *ctx, arg_probe *a)
 static bool trans_ixtlbx(DisasContext *ctx, arg_ixtlbx *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_tl addr;
     TCGv_reg ofs, reg;
 
@@ -2423,7 +2423,7 @@ static bool trans_ixtlbx(DisasContext *ctx, arg_ixtlbx *a)
 static bool trans_pxtlbx(DisasContext *ctx, arg_pxtlbx *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_tl addr;
     TCGv_reg ofs;
 
@@ -2456,7 +2456,7 @@ static bool trans_pxtlbx(DisasContext *ctx, arg_pxtlbx *a)
 static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_tl addr, atl, stl;
     TCGv_reg reg;
 
@@ -2501,7 +2501,7 @@ static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a)
 static bool trans_lpa(DisasContext *ctx, arg_ldst *a)
 {
     CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     TCGv_tl vaddr;
     TCGv_reg ofs, paddr;
 
@@ -2623,7 +2623,7 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf *a)
             cond_free(&ctx->null_cond);
             return true;
         }
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
         /* These are QEMU extensions and are nops in the real architecture:
          *
          * or %r10,%r10,%r10 -- idle loop; wait for interrupt
@@ -3449,7 +3449,7 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a)
         return gen_illegal(ctx);
     }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
     if (ctx->tb_flags & PSW_C) {
         CPUHPPAState *env = ctx->cs->env_ptr;
         int type = hppa_artype_for_page(env, ctx->base.pc_next);
@@ -4191,7 +4191,7 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
         if (ctx->iaoq_f == -1) {
             tcg_gen_mov_reg(cpu_iaoq_f, cpu_iaoq_b);
             copy_iaoq_entry(cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b);
 #endif
             nullify_save(ctx);
target/i386/cpu-dump.c +3 -3
index 40697064d9..2e28e6ca45 100644
@@ -20,7 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "qemu/qemu-print.h"
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 #include "hw/i386/apic_internal.h"
 #endif
 
@@ -152,7 +152,7 @@ done:
     qemu_fprintf(f, "\n");
 }
 
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
 
 /* ARRAY_SIZE check is not required because
  * DeliveryMode(dm) has a size of 3 bit.
@@ -336,7 +336,7 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, int flags)
     qemu_printf(" PPR 0x%02x\n", apic_get_ppr(s));
 }
 
-#endif /* !CONFIG_USER_ONLY */
+#endif /* CONFIG_SOFTMMU */
 
 #define DUMP_CODE_BYTES_TOTAL    50
 #define DUMP_CODE_BYTES_BACKWARD 20
target/i386/cpu.c +21 -21

161 lines not on this page · raw message

target/i386/gdbstub.c +7 -7
index ebb000df6a..c9cbdaceda 100644
@@ -204,7 +204,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
         case IDX_CTL_CR4_REG:
             return gdb_read_reg_cs64(env->hflags, mem_buf, env->cr[4]);
         case IDX_CTL_CR8_REG:
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             tpr = cpu_get_apic_tpr(cpu->apic_state);
 #else
             tpr = 0;
@@ -353,42 +353,42 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
 
         case IDX_CTL_CR0_REG:
             len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             cpu_x86_update_cr0(env, tmp);
 #endif
             return len;
 
         case IDX_CTL_CR2_REG:
             len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             env->cr[2] = tmp;
 #endif
             return len;
 
         case IDX_CTL_CR3_REG:
             len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             cpu_x86_update_cr3(env, tmp);
 #endif
             return len;
 
         case IDX_CTL_CR4_REG:
             len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             cpu_x86_update_cr4(env, tmp);
 #endif
             return len;
 
         case IDX_CTL_CR8_REG:
             len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp);
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_SOFTMMU
             cpu_set_apic_tpr(cpu->apic_state, tmp);
 #endif
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

target/i386/helper.c +4 -4
index c9755b3aba..4c62fadc4f 100644

Lines of this file are not shown. View the raw message.

target/i386/tcg/bpt_helper.c +1 -1
index bc34ac27fe..af0d9f0f60 100644

Lines of this file are not shown. View the raw message.

target/i386/tcg/excp_helper.c +1 -1
index 7c3c8dc7fe..36fa395e51 100644

Lines of this file are not shown. View the raw message.

target/i386/tcg/fpu_helper.c +2 -2
index 6f3741b635..2441bbe21a 100644

Lines of this file are not shown. View the raw message.

target/i386/tcg/seg_helper.c +4 -4
index 03b58e94a2..1c80d8036c 100644

Lines of this file are not shown. View the raw message.

target/i386/tcg/tcg-cpu.c +3 -3
index b942c306d6..de018b4c38 100644

Lines of this file are not shown. View the raw message.

target/i386/tcg/translate.c +2 -2
index 5cf14311a6..dd6ba436bc 100644

Lines of this file are not shown. View the raw message.

target/loongarch/cpu.c +7 -7
index ad93ecac92..a65f881768 100644

Lines of this file are not shown. View the raw message.

target/loongarch/op_helper.c +1 -1
index 60335a05e2..deb0a77991 100644

Lines of this file are not shown. View the raw message.

target/m68k/cpu.c +3 -3
index 99af1ab541..525560a1b9 100644

Lines of this file are not shown. View the raw message.

target/m68k/helper.c +2 -2
index 3b3a6ea8bd..82df60ed4a 100644

Lines of this file are not shown. View the raw message.

target/m68k/op_helper.c +2 -2
index 1ce850bbc5..75282eb6bd 100644

Lines of this file are not shown. View the raw message.

target/microblaze/cpu.c +6 -6
index 03c2c4db1f..001c4e8078 100644

Lines of this file are not shown. View the raw message.

target/microblaze/helper.c +2 -2
index 98bdb82de8..8077c5cf28 100644

Lines of this file are not shown. View the raw message.

target/microblaze/op_helper.c +1 -1
index f6378030b7..3ecac4f727 100644

Lines of this file are not shown. View the raw message.

target/microblaze/translate.c +6 -6
index 7e7f837c63..7b1ecc5a53 100644

Lines of this file are not shown. View the raw message.

target/mips/cpu.c +9 -9
index 01e0fbe10d..6aa57a88d3 100644

Lines of this file are not shown. View the raw message.

target/mips/gdbstub.c +2 -2
index 62d7b72407..7ea4d57cb3 100644

Lines of this file are not shown. View the raw message.

target/mips/tcg/ldst_helper.c +2 -2
index c1a8380e34..e67fac3133 100644

Lines of this file are not shown. View the raw message.

target/mips/tcg/msa_helper.c +1 -1
index 29b31d70fe..42fd09e3e6 100644

Lines of this file are not shown. View the raw message.

target/mips/tcg/op_helper.c +2 -2
index ef3dafcbb3..d9ed6d123c 100644

Lines of this file are not shown. View the raw message.

target/mips/tcg/translate.c +13 -13
index 74af91e4f5..f0d13a44e6 100644

Lines of this file are not shown. View the raw message.

target/nios2/cpu.c +9 -9
index bc5cbf81c2..c36073ecc0 100644

Lines of this file are not shown. View the raw message.

target/nios2/op_helper.c +2 -2
index 0aaf33ffc2..efea888caa 100644

Lines of this file are not shown. View the raw message.

target/nios2/translate.c +5 -5
index a365ad8293..bf8d90e9be 100644

Lines of this file are not shown. View the raw message.

target/openrisc/cpu.c +7 -7
index 61d748cfdc..b870248cd5 100644

Lines of this file are not shown. View the raw message.

target/openrisc/interrupt.c +1 -1
index 3887812810..c20f684aba 100644

Lines of this file are not shown. View the raw message.

target/openrisc/sys_helper.c +5 -5
index 782a5751b7..dab9aa0496 100644

Lines of this file are not shown. View the raw message.

target/ppc/compat.c +1 -1
index 7949a24f5a..985118f890 100644

Lines of this file are not shown. View the raw message.

target/ppc/cpu.c +1 -1
index 424f2e1741..023eca90b8 100644

Lines of this file are not shown. View the raw message.

target/ppc/cpu_init.c +62 -62

124 lines not on this page · raw message

target/ppc/excp_helper.c +7 -10
index fea9221501..6e0876213f 100644

Lines of this file are not shown. View the raw message.

target/ppc/gdbstub.c +4 -4
index 63c9abe4f1..124d7b221f 100644

Lines of this file are not shown. View the raw message.

target/ppc/helper_regs.c +10 -10
index fb351c303f..fbbbb554c8 100644

Lines of this file are not shown. View the raw message.

target/ppc/mem_helper.c +1 -1
index 46eae65819..6d6c6c4c27 100644

Lines of this file are not shown. View the raw message.

target/ppc/misc_helper.c +1 -1
index 40ddc5c08c..d2c8973790 100644

Lines of this file are not shown. View the raw message.

target/ppc/power8-pmu.c +2 -2
index 64a64865d7..6b8455d8c3 100644

Lines of this file are not shown. View the raw message.

target/ppc/ppc-qmp-cmds.c +1 -1
index f9acc21056..733fa6a574 100644

Lines of this file are not shown. View the raw message.

target/ppc/timebase_helper.c +2 -2
index b80f56af7e..79d9576f05 100644

Lines of this file are not shown. View the raw message.

target/ppc/translate.c +31 -31

62 lines not on this page · raw message

target/riscv/cpu.c +33 -33

66 lines not on this page · raw message

target/riscv/cpu_helper.c +10 -10
index 56381aaf26..4daf98f792 100644

Lines of this file are not shown. View the raw message.

target/riscv/csr.c +21 -21

42 lines not on this page · raw message

target/riscv/gdbstub.c +3 -3
index 524bede865..75ed0adc24 100644

Lines of this file are not shown. View the raw message.

target/riscv/op_helper.c +4 -4
index f563dc3981..8eeaf113eb 100644

Lines of this file are not shown. View the raw message.

target/riscv/translate.c +6 -6
index 933b11c50d..a51a887917 100644

Lines of this file are not shown. View the raw message.

target/riscv/zce_helper.c +1 -1
index b433bda16d..8ac62e8342 100644

Lines of this file are not shown. View the raw message.

target/rx/cpu.c +5 -5
index 157e57da0f..582456dbb1 100644

Lines of this file are not shown. View the raw message.

target/rx/helper.c +2 -2
index dad5fb4976..8950b22c47 100644

Lines of this file are not shown. View the raw message.

target/s390x/cpu-dump.c +1 -1
index ffa9e94d84..44694ac776 100644

Lines of this file are not shown. View the raw message.

target/s390x/cpu.c +13 -13
index df167493c3..ec9b955b50 100644

Lines of this file are not shown. View the raw message.

target/s390x/cpu_features.c +2 -2
index 2e4e11d264..ec24137b1a 100644

Lines of this file are not shown. View the raw message.

target/s390x/cpu_models.c +4 -4
index 457b5cb10c..d3707ebefb 100644

Lines of this file are not shown. View the raw message.

target/s390x/gdbstub.c +2 -2
index 6fbfd41bc8..4dd641c676 100644

Lines of this file are not shown. View the raw message.

target/s390x/interrupt.c +3 -3
index 5195f060ec..5ab796e261 100644

Lines of this file are not shown. View the raw message.

target/s390x/tcg/cc_helper.c +1 -1
index b36f8cdc8b..62640ac5a9 100644

Lines of this file are not shown. View the raw message.

target/s390x/tcg/excp_helper.c +5 -5
index 228aa9f237..f68b47d58d 100644

Lines of this file are not shown. View the raw message.

target/s390x/tcg/mem_helper.c +4 -4
index d02ec861d8..8dc4ea7e5f 100644

Lines of this file are not shown. View the raw message.

target/s390x/tcg/misc_helper.c +6 -6
index 576157b1f3..8e27bdb621 100644

Lines of this file are not shown. View the raw message.

target/s390x/tcg/translate.c +24 -24

48 lines not on this page · raw message

target/sh4/cpu.c +6 -6
index 61769ffdfa..393df9f1d6 100644

Lines of this file are not shown. View the raw message.

target/sh4/helper.c +3 -3
index e02e7af607..9691344e26 100644

Lines of this file are not shown. View the raw message.

target/sh4/op_helper.c +1 -1
index a663335c39..272b5304dc 100644

Lines of this file are not shown. View the raw message.

target/sparc/cpu.c +8 -8
index e329a7aece..8f8924a0ec 100644

Lines of this file are not shown. View the raw message.

target/sparc/helper.c +3 -3
index c4358bba84..e4328535ef 100644

Lines of this file are not shown. View the raw message.

target/sparc/int32_helper.c +2 -2
index 82e8418e46..2dbf843a99 100644

Lines of this file are not shown. View the raw message.

target/sparc/int64_helper.c +2 -2
index 793e57c536..b9dd16cc6c 100644

Lines of this file are not shown. View the raw message.

target/sparc/ldst_helper.c +8 -8
index 981a47d8bb..487f4bafeb 100644

Lines of this file are not shown. View the raw message.

target/sparc/translate.c +25 -25

50 lines not on this page · raw message

target/sparc/win_helper.c +5 -5
index 3a7c0ff943..0e497da708 100644

Lines of this file are not shown. View the raw message.

target/xtensa/cpu.c +11 -11
index acaf8c905f..2db561a29b 100644

Lines of this file are not shown. View the raw message.

target/xtensa/exc_helper.c +2 -2
index d4823a65cd..9e4e6d3fcf 100644

Lines of this file are not shown. View the raw message.

target/xtensa/helper.c +2 -2
index dbeb97a953..fa1df80617 100644

Lines of this file are not shown. View the raw message.

target/xtensa/op_helper.c +3 -3
index 1af7becc54..1a7e4e1290 100644

Lines of this file are not shown. View the raw message.

target/xtensa/translate.c +31 -31

62 lines not on this page · raw message

tcg/tcg.c +2 -2
index 3fcd0d9f32..ab11c29154 100644

Lines of this file are not shown. View the raw message.

target/loongarch/insn_trans/trans_farith.c.inc +1 -1
index 21ea47308b..c7b70a6e90 100644

Lines of this file are not shown. View the raw message.

target/loongarch/insn_trans/trans_lsx.c.inc +1 -1
index 68779daff6..f5ff9348be 100644

Lines of this file are not shown. View the raw message.

target/mips/cpu-defs.c.inc +1 -1
index d45f245a67..8c3d230238 100644

Lines of this file are not shown. View the raw message.

target/mips/tcg/micromips_translate.c.inc +2 -2
index 211d102cf6..ff3183959f 100644

Lines of this file are not shown. View the raw message.

target/mips/tcg/nanomips_translate.c.inc +3 -3
index a98dde0d2e..df6cf9d77d 100644

Lines of this file are not shown. View the raw message.

target/ppc/power8-pmu-regs.c.inc +2 -2
index c82feedaff..72954e84c7 100644

Lines of this file are not shown. View the raw message.

target/ppc/translate/branch-impl.c.inc +1 -1
index f9931b9d73..1072ce0bef 100644

Lines of this file are not shown. View the raw message.

target/ppc/translate/processor-ctrl-impl.c.inc +4 -4
index cc7a50d579..ebbe991e24 100644

Lines of this file are not shown. View the raw message.

target/ppc/translate/storage-ctrl-impl.c.inc +8 -8
index faa7b04bbc..166ac0cb58 100644

Lines of this file are not shown. View the raw message.

target/riscv/insn_trans/trans_privileged.c.inc +4 -4
index 528baa1652..10910b507a 100644

Lines of this file are not shown. View the raw message.

target/riscv/insn_trans/trans_rvh.c.inc +2 -2
index 3e9322130f..3ea3936c89 100644

Lines of this file are not shown. View the raw message.

target/riscv/insn_trans/trans_svinval.c.inc +3 -3
index f3cd7d5c0b..20a88810f5 100644

Lines of this file are not shown. View the raw message.

target/riscv/insn_trans/trans_xthead.c.inc +4 -4
index 3e13b1d74d..6b085c7a97 100644

Lines of this file are not shown. View the raw message.

tcg/sparc64/tcg-target.c.inc +2 -2
index 29e67758ef..0305f446d2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.38.1

Part of the diff is not shown here. View the raw message.

#6 lore raw

Re: [RFC PATCH 2/2] bulk: Replace !CONFIG_USER_ONLY -> CONFIG_SOFTMMU

Quoted 23 lines · Philippe Mathieu-Daudé

CONFIG_SOFTMMU is the opposite of CONFIG_USER_ONLY. Now that CONFIG_SOFTMMU isn't poisoined anymore, replace !CONFIG_USER_ONLY negation by the positive form which is clearer when reviewing code.

Change mostly done mechanically using:

   $ sed -i -e 's/ifndef CONFIG_USER_ONLY/ifdef CONFIG_SOFTMMU/' \
            -e 's/!defined(CONFIG_USER_ONLY)/defined(CONFIG_SOFTMMU)/' \
                $(git grep -l CONFIG_USER_ONLY)

and adapting comments manually.

---
  scripts/coccinelle/round.cocci                |   6 +
scripts/coccinelle/round.cocci +0 -0
index ed06773289..0a27b6da4d 100644

scripts/coccinelle/round.cocci expression e2; · line 25

Quoted 9 lines
scripts/coccinelle/round.cocci +6 -0
@@ -17,3 +17,9 @@ expression e2;
  @@
  -(DIV_ROUND_UP(e1,e2))
  +DIV_ROUND_UP(e1,e2)
+
+@@
+expression n, d;
+@@
+-   n & ~(d - 1)
++   ROUND_DOWN(n, d)

Oops, unrelated =)

#7 lore raw

Re: [RFC PATCH 2/2] bulk: Replace !CONFIG_USER_ONLY -> CONFIG_SOFTMMU

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

CONFIG_SOFTMMU is the opposite of CONFIG_USER_ONLY. Now that CONFIG_SOFTMMU isn't poisoined anymore, replace !CONFIG_USER_ONLY negation by the positive form which is clearer when reviewing code.

Change mostly done mechanically using:

Quoted 7 lines
   $ sed -i -e 's/ifndef CONFIG_USER_ONLY/ifdef CONFIG_SOFTMMU/' \
            -e 's/!defined(CONFIG_USER_ONLY)/defined(CONFIG_SOFTMMU)/' \
                $(git grep -l CONFIG_USER_ONLY)

and adapting comments manually.

*Sigh* I was not building in the correct build directory, now I realize this patch is crap because the CONFIG_SOFTMMU definitions is not propagated on all objects.

Please disregard...