qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/1] target/microblaze: mbar: Trap sleeps from user-space
@ 2020-08-17 17:30 Edgar E. Iglesias
  2020-08-17 17:30 ` [PATCH v1 1/1] " Edgar E. Iglesias
  0 siblings, 1 reply; 3+ messages in thread
From: Edgar E. Iglesias @ 2020-08-17 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

As suggested by Richard, trap mbar/sleeps from user-space.

Cheers,
Edgar

Edgar E. Iglesias (1):
  target/microblaze: mbar: Trap sleeps from user-space

 target/microblaze/translate.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.25.1



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

* [PATCH v1 1/1] target/microblaze: mbar: Trap sleeps from user-space
  2020-08-17 17:30 [PATCH v1 0/1] target/microblaze: mbar: Trap sleeps from user-space Edgar E. Iglesias
@ 2020-08-17 17:30 ` Edgar E. Iglesias
  2020-08-18  0:06   ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Edgar E. Iglesias @ 2020-08-17 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Trap mbar-sleeps from user-space.

Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 target/microblaze/translate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 530c15e5ad..a96cb21d96 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -1250,6 +1250,11 @@ static void dec_br(DisasContext *dc)
 
             LOG_DIS("sleep\n");
 
+            if (trap_userspace(dc, true)) {
+                /* Sleep is a privileged instruction.  */
+                return;
+            }
+
             t_sync_flags(dc);
             tcg_gen_st_i32(tmp_1, cpu_env,
                            -offsetof(MicroBlazeCPU, env)
-- 
2.25.1



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

* Re: [PATCH v1 1/1] target/microblaze: mbar: Trap sleeps from user-space
  2020-08-17 17:30 ` [PATCH v1 1/1] " Edgar E. Iglesias
@ 2020-08-18  0:06   ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2020-08-18  0:06 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, frederic.konrad,
	qemu-arm, philmd, luc.michel

On 8/17/20 10:30 AM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Trap mbar-sleeps from user-space.
> 
> Reported-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  target/microblaze/translate.c | 5 +++++
>  1 file changed, 5 insertions(+)

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

r~


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

end of thread, other threads:[~2020-08-18  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 17:30 [PATCH v1 0/1] target/microblaze: mbar: Trap sleeps from user-space Edgar E. Iglesias
2020-08-17 17:30 ` [PATCH v1 1/1] " Edgar E. Iglesias
2020-08-18  0:06   ` Richard Henderson

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).