qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] cpus: Remove system reset() API from user emulation
@ 2022-12-20 14:56 Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 1/5] target/i386: Restrict qapi/qapi-events-run-state.h to system emulation Philippe Mathieu-Daudé
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini, 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: 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(-)

-- 
2.38.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] target/i386: Restrict qapi/qapi-events-run-state.h to system emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
@ 2022-12-20 14:56 ` Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 2/5] target/i386: Restrict sysemu/reset.h " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini, Philippe Mathieu-Daudé

shutdown / powerdown / suspend_disk / resume / watchdog
are events irrlevant to user emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/helper.c b/target/i386/helper.c
index 0ac2da066d..dcce27bac1 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -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
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] target/i386: Restrict sysemu/reset.h to system emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 1/5] target/i386: Restrict qapi/qapi-events-run-state.h to system emulation Philippe Mathieu-Daudé
@ 2022-12-20 14:56 ` Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 3/5] target/loongarch: " Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini, 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é <philmd@linaro.org>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 435980dd3a..91961359c7 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] target/loongarch: Restrict sysemu/reset.h to system emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 1/5] target/i386: Restrict qapi/qapi-events-run-state.h to system emulation Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 2/5] target/i386: Restrict sysemu/reset.h " Philippe Mathieu-Daudé
@ 2022-12-20 14:56 ` Philippe Mathieu-Daudé
  2022-12-20 14:56 ` [PATCH 4/5] target/s390x: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini, 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é <philmd@linaro.org>
---
 target/loongarch/cpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 0fb853d915..441dfbab74 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -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",
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] target/s390x: Restrict sysemu/reset.h to system emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2022-12-20 14:56 ` [PATCH 3/5] target/loongarch: " Philippe Mathieu-Daudé
@ 2022-12-20 14:56 ` Philippe Mathieu-Daudé
  2022-12-29  9:45   ` Thomas Huth
  2022-12-20 14:56 ` [PATCH 5/5] hw/core: Only build CPU reset handlers with " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini, 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é <philmd@linaro.org>
---
 target/s390x/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 96562c516d..b10a8541ff 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -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;
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] hw/core: Only build CPU reset handlers with system emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2022-12-20 14:56 ` [PATCH 4/5] target/s390x: " Philippe Mathieu-Daudé
@ 2022-12-20 14:56 ` Philippe Mathieu-Daudé
  2022-12-20 15:52   ` Peter Maydell
  2022-12-21  1:18 ` [PATCH 0/5] cpus: Remove system reset() API from user emulation Richard Henderson
  2022-12-21  4:00 ` Wilfred Mallawa
  6 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini, 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.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/meson.build b/hw/core/meson.build
index 7a4d02b6c0..ce6fdb0064 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -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(
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/5] hw/core: Only build CPU reset handlers with system emulation
  2022-12-20 14:56 ` [PATCH 5/5] hw/core: Only build CPU reset handlers with " Philippe Mathieu-Daudé
@ 2022-12-20 15:52   ` Peter Maydell
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2022-12-20 15:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Thomas Huth, Paolo Bonzini

On Tue, 20 Dec 2022 at 14:56, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] cpus: Remove system reset() API from user emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2022-12-20 14:56 ` [PATCH 5/5] hw/core: Only build CPU reset handlers with " Philippe Mathieu-Daudé
@ 2022-12-21  1:18 ` Richard Henderson
  2022-12-21  4:00 ` Wilfred Mallawa
  6 siblings, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2022-12-21  1:18 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, David Hildenbrand, Xiaojuan Yang, Thomas Huth,
	Paolo Bonzini

On 12/20/22 06:56, Philippe Mathieu-Daudé wrote:
> 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

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] cpus: Remove system reset() API from user emulation
  2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2022-12-21  1:18 ` [PATCH 0/5] cpus: Remove system reset() API from user emulation Richard Henderson
@ 2022-12-21  4:00 ` Wilfred Mallawa
  6 siblings, 0 replies; 10+ messages in thread
From: Wilfred Mallawa @ 2022-12-21  4:00 UTC (permalink / raw)
  To: qemu-devel@nongnu.org, philmd@linaro.org
  Cc: david@redhat.com, yangxiaojuan@loongson.cn, eduardo@habkost.net,
	peter.maydell@linaro.org, thuth@redhat.com, gaosong@loongson.cn,
	iii@linux.ibm.com, richard.henderson@linaro.org,
	qemu-s390x@nongnu.org, pbonzini@redhat.com

On Tue, 2022-12-20 at 15:56 +0100, Philippe Mathieu-Daudé wrote:
> 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
> 
Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
>  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(-)
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] target/s390x: Restrict sysemu/reset.h to system emulation
  2022-12-20 14:56 ` [PATCH 4/5] target/s390x: " Philippe Mathieu-Daudé
@ 2022-12-29  9:45   ` Thomas Huth
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2022-12-29  9:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Ilya Leoshkevich, Eduardo Habkost, qemu-s390x,
	Song Gao, Richard Henderson, David Hildenbrand, Xiaojuan Yang,
	Paolo Bonzini

On 20/12/2022 15.56, Philippe Mathieu-Daudé wrote:
> 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é <philmd@linaro.org>
> ---
>   target/s390x/cpu.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 96562c516d..b10a8541ff 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -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;

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-12-29  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 14:56 [PATCH 0/5] cpus: Remove system reset() API from user emulation Philippe Mathieu-Daudé
2022-12-20 14:56 ` [PATCH 1/5] target/i386: Restrict qapi/qapi-events-run-state.h to system emulation Philippe Mathieu-Daudé
2022-12-20 14:56 ` [PATCH 2/5] target/i386: Restrict sysemu/reset.h " Philippe Mathieu-Daudé
2022-12-20 14:56 ` [PATCH 3/5] target/loongarch: " Philippe Mathieu-Daudé
2022-12-20 14:56 ` [PATCH 4/5] target/s390x: " Philippe Mathieu-Daudé
2022-12-29  9:45   ` Thomas Huth
2022-12-20 14:56 ` [PATCH 5/5] hw/core: Only build CPU reset handlers with " Philippe Mathieu-Daudé
2022-12-20 15:52   ` Peter Maydell
2022-12-21  1:18 ` [PATCH 0/5] cpus: Remove system reset() API from user emulation Richard Henderson
2022-12-21  4:00 ` Wilfred Mallawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).