cpus: Remove system reset() API from user emulation
cover cpus: Remove system reset() API from user emulation
In user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
Philippe Mathieu-Daudé (5):
target/i386: Restrict qapi/qapi-events-run-state.h to system emulation target/i386: Restrict sysemu/reset.h to system emulation target/loongarch: Restrict sysemu/reset.h to system emulation target/s390x: Restrict sysemu/reset.h to system emulation hw/core: Only build CPU reset handlers with system emulation
hw/core/meson.build | 2 +- target/i386/cpu.c | 2 +- target/i386/helper.c | 2 +- target/loongarch/cpu.c | 2 ++ target/s390x/cpu.c | 4 +++- 5 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.38.1
PATCH 1/5 target/i386: Restrict qapi/qapi-events-run-state.h to system emulation
shutdown / powerdown / suspend_disk / resume / watchdog are events irrlevant to user emulation.
--- target/i386/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/helper.c +1 -1
@@ -18,12 +18,12 @@*/ #include "qemu/osdep.h" -#include "qapi/qapi-events-run-state.h" #include "cpu.h" #include "exec/exec-all.h" #include "sysemu/runstate.h" #include "kvm/kvm_i386.h" #ifndef CONFIG_USER_ONLY +#include "qapi/qapi-events-run-state.h" #include "sysemu/hw_accel.h" #include "monitor/monitor.h" #endif
Signature · 1 line
2.38.1
PATCH 2/5 target/i386: Restrict sysemu/reset.h to system emulation
In reply to Philippe Mathieu-DaudéIn user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
--- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -24,7 +24,6 @@#include "qemu/hw-version.h" #include "cpu.h" #include "tcg/helper-tcg.h" -#include "sysemu/reset.h" #include "sysemu/hvf.h" #include "kvm/kvm_i386.h" #include "sev.h"
@@ -37,6 +36,7 @@#ifndef CONFIG_USER_ONLY #include "qapi/qapi-commands-machine-target.h" #include "exec/address-spaces.h" +#include "sysemu/reset.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h" #endif
Signature · 1 line
2.38.1
PATCH 3/5 target/loongarch: Restrict sysemu/reset.h to system emulation
In reply to Philippe Mathieu-DaudéIn user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
--- target/loongarch/cpu.c | 2 ++ 1 file changed, 2 insertions(+)
target/loongarch/cpu.c +2 -0
@@ -16,7 +16,9 @@#include "internals.h" #include "fpu/softfloat-helpers.h" #include "cpu-csr.h" +#ifndef CONFIG_USER_ONLY #include "sysemu/reset.h" +#endif const char *const regnames[32 ] = {"r0" ,"r1" ,"r2" ,"r3" ,"r4" ,"r5" ,"r6" ,"r7" ,
Signature · 1 line
2.38.1
PATCH 4/5 target/s390x: Restrict sysemu/reset.h to system emulation
In reply to Philippe Mathieu-DaudéIn user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
--- target/s390x/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/s390x/cpu.c +3 -1
@@ -26,7 +26,6 @@#include "s390x-internal.h" #include "kvm/kvm_s390x.h" #include "sysemu/kvm.h" -#include "sysemu/reset.h" #include "qemu/module.h" #include "trace.h" #include "qapi/qapi-types-machine.h"
@@ -35,6 +34,9 @@#include "fpu/softfloat-helpers.h" #include "disas/capstone.h" #include "sysemu/tcg.h" +#ifndef CONFIG_USER_ONLY +#include "sysemu/reset.h" +#endif #define CR0_RESET 0xE0UL#define CR14_RESET 0xC2000000UL;
Signature · 1 line
2.38.1
Re: [PATCH 4/5] target/s390x: Restrict sysemu/reset.h to system emulation
Quoted 22 lines · Philippe Mathieu-Daudé
In user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/s390x/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)target/s390x/cpu.c +0
-1@@ -26,7 +26,6 @@#include "s390x-internal.h" #include "kvm/kvm_s390x.h" #include "sysemu/kvm.h" -#include "sysemu/reset.h" #include "qemu/module.h" #include "trace.h" #include "qapi/qapi-types-machine.h"
target/s390x/cpu.c line 42
Quoted 9 lines
target/s390x/cpu.c +3
-0@@ -35,6 +34,9 @@#include "fpu/softfloat-helpers.h" #include "disas/capstone.h" #include "sysemu/tcg.h" +#ifndef CONFIG_USER_ONLY +#include "sysemu/reset.h" +#endif #define CR0_RESET 0xE0UL#define CR14_RESET 0xC2000000UL;
PATCH 5/5 hw/core: Only build CPU reset handlers with system emulation
In reply to Philippe Mathieu-DaudéIn user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in providing the sysemu/reset handlers there.
--- hw/core/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/meson.build +1 -1
@@ -3,7 +3,6 @@ hwcore_ss.add(files( 'bus.c', 'qdev-properties.c', 'qdev.c', - 'reset.c', 'resettable.c', 'vmstate-if.c', # irq.c needed for qdev GPIO handling:
@@ -15,6 +14,7 @@ if have_system hwcore_ss.add(files( 'hotplug.c', 'qdev-hotplug.c', + 'reset.c', )) else hwcore_ss.add(files(
Signature · 1 line
2.38.1
Re: [PATCH 5/5] hw/core: Only build CPU reset handlers with system emulation
Quoted 4 lines · Philippe Mathieu-Daudé
In user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in providing the sysemu/reset handlers there.
We do reset the CPU, the linux-user code calls cpu_reset() after creating it (and this is required for correct behaviour). What we don't need (and what this patch is making system-only) is the "register a global reset function" API (which is non-functional in user-mode binaries because nothing ever calls the qemu_devices_reset() function to say "run all the hooks", so it makes sense not to compile it in).
thanks
-- PMM
Quoted 10 lines · Philippe Mathieu-Daudé
In user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
Philippe Mathieu-Daudé (5):
target/i386: Restrictqapi/qapi-events-run-state.hto system emulation target/i386: Restrictsysemu/reset.hto system emulation target/loongarch: Restrictsysemu/reset.hto system emulation target/s390x: Restrictsysemu/reset.hto system emulation hw/core: Only build CPU reset handlers with system emulation
r~
Quoted 4 lines · Philippe Mathieu-Daudé
In user emulation, threads -- implemented as CPU -- are created/destroyed, but never reset. There is no point in allowing the user emulation access the sysemu/reset API.
Quoted 8 lines
Philippe Mathieu-Daudé (5):
target/i386: Restrictqapi/qapi-events-run-state.hto system emulation
target/i386: Restrictsysemu/reset.hto system emulation target/loongarch: Restrictsysemu/reset.hto system emulation target/s390x: Restrictsysemu/reset.hto system emulation hw/core: Only build CPU reset handlers with system emulation
Quoted 7 lines
hw/core/meson.build | 2 +-
target/i386/cpu.c | 2 +-
target/i386/helper.c | 2 +-
target/loongarch/cpu.c | 2 ++
target/s390x/cpu.c | 4 +++-5 files changed, 8 insertions(+), 4 deletions(-)