From b6e2cf33df8ad7eea657054fadf40cc0745f6e23 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Thu, 30 Apr 2020 20:51:57 -0400 Subject: [PATCH] riscv: Don't use stage-2 PTE lookup protection flags When doing the fist of a two stage lookup (Hypervisor extensions) don't set the current protection flags from the second stage lookup of the base address PTE. Backports commit 384728905441279e54fa3d714b11bf1b1bcbfd27 from qemu --- qemu/target/riscv/cpu_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu/target/riscv/cpu_helper.c b/qemu/target/riscv/cpu_helper.c index 2246b07d..9977fe7a 100644 --- a/qemu/target/riscv/cpu_helper.c +++ b/qemu/target/riscv/cpu_helper.c @@ -446,10 +446,11 @@ restart: hwaddr pte_addr; if (two_stage && first_stage) { + int vbase_prot; hwaddr vbase; /* Do the second stage translation on the base PTE address. */ - get_physical_address(env, &vbase, prot, base, access_type, + get_physical_address(env, &vbase, &vbase_prot, base, access_type, mmu_idx, false, true); pte_addr = vbase + idx * ptesize;