qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/riscv: Fix privilege mode of G-stage translation for debugging
@ 2024-02-28  8:10 Hiroaki Yamamoto
  2024-03-07  2:30 ` Alistair Francis
  2024-03-07  2:36 ` Alistair Francis
  0 siblings, 2 replies; 3+ messages in thread
From: Hiroaki Yamamoto @ 2024-02-28  8:10 UTC (permalink / raw)
  To: qemu-devel

G-stage translation should be considered to be user-level access in riscv_cpu_get_phys_page_debug(), as already done in riscv_cpu_tlb_fill().

This fixes a bug that prevents gdb from reading memory while the VM is running in VS-mode.

Signed-off-by: Hiroaki Yamamoto <hrak1529@gmail.com>
---
 target/riscv/cpu_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index d462d95ee1..6e13069da7 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -1212,7 +1212,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
 
     if (env->virt_enabled) {
         if (get_physical_address(env, &phys_addr, &prot, phys_addr, NULL,
-                                 0, mmu_idx, false, true, true)) {
+                                 0, MMUIdx_U, false, true, true)) {
             return -1;
         }
     }
-- 
2.43.2



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

* Re: [PATCH] target/riscv: Fix privilege mode of G-stage translation for debugging
  2024-02-28  8:10 [PATCH] target/riscv: Fix privilege mode of G-stage translation for debugging Hiroaki Yamamoto
@ 2024-03-07  2:30 ` Alistair Francis
  2024-03-07  2:36 ` Alistair Francis
  1 sibling, 0 replies; 3+ messages in thread
From: Alistair Francis @ 2024-03-07  2:30 UTC (permalink / raw)
  To: Hiroaki Yamamoto; +Cc: qemu-devel

On Wed, Feb 28, 2024 at 10:14 PM Hiroaki Yamamoto <hrak1529@gmail.com> wrote:
>
> G-stage translation should be considered to be user-level access in riscv_cpu_get_phys_page_debug(), as already done in riscv_cpu_tlb_fill().
>
> This fixes a bug that prevents gdb from reading memory while the VM is running in VS-mode.

Thanks for the patch. In the future can you ensure your commit message
wraps at around 70 characters?

>
> Signed-off-by: Hiroaki Yamamoto <hrak1529@gmail.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/cpu_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
> index d462d95ee1..6e13069da7 100644
> --- a/target/riscv/cpu_helper.c
> +++ b/target/riscv/cpu_helper.c
> @@ -1212,7 +1212,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
>
>      if (env->virt_enabled) {
>          if (get_physical_address(env, &phys_addr, &prot, phys_addr, NULL,
> -                                 0, mmu_idx, false, true, true)) {
> +                                 0, MMUIdx_U, false, true, true)) {
>              return -1;
>          }
>      }
> --
> 2.43.2
>
>


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

* Re: [PATCH] target/riscv: Fix privilege mode of G-stage translation for debugging
  2024-02-28  8:10 [PATCH] target/riscv: Fix privilege mode of G-stage translation for debugging Hiroaki Yamamoto
  2024-03-07  2:30 ` Alistair Francis
@ 2024-03-07  2:36 ` Alistair Francis
  1 sibling, 0 replies; 3+ messages in thread
From: Alistair Francis @ 2024-03-07  2:36 UTC (permalink / raw)
  To: Hiroaki Yamamoto; +Cc: qemu-devel

On Wed, Feb 28, 2024 at 10:14 PM Hiroaki Yamamoto <hrak1529@gmail.com> wrote:
>
> G-stage translation should be considered to be user-level access in riscv_cpu_get_phys_page_debug(), as already done in riscv_cpu_tlb_fill().
>
> This fixes a bug that prevents gdb from reading memory while the VM is running in VS-mode.
>
> Signed-off-by: Hiroaki Yamamoto <hrak1529@gmail.com>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  target/riscv/cpu_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
> index d462d95ee1..6e13069da7 100644
> --- a/target/riscv/cpu_helper.c
> +++ b/target/riscv/cpu_helper.c
> @@ -1212,7 +1212,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
>
>      if (env->virt_enabled) {
>          if (get_physical_address(env, &phys_addr, &prot, phys_addr, NULL,
> -                                 0, mmu_idx, false, true, true)) {
> +                                 0, MMUIdx_U, false, true, true)) {
>              return -1;
>          }
>      }
> --
> 2.43.2
>
>


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

end of thread, other threads:[~2024-03-07  2:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28  8:10 [PATCH] target/riscv: Fix privilege mode of G-stage translation for debugging Hiroaki Yamamoto
2024-03-07  2:30 ` Alistair Francis
2024-03-07  2:36 ` Alistair Francis

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