[PATCH] target/ppc: fix ISI fault cause for Radix MMU

Leandro Lupori posted 1 patch 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220309192756.145283-1-leandro.lupori@eldorado.org.br
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>
target/ppc/mmu-radix64.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] target/ppc: fix ISI fault cause for Radix MMU
Posted by Leandro Lupori 2 years, 1 month ago
Fix Instruction Storage Interrupt (ISI) fault cause for Radix MMU,
when caused by missing PAGE_EXEC permission, to be
SRR1_NOEXEC_GUARD instead of DSISR_PROTFAULT.
This matches POWER9 hardware behavior.

Fixes: d5fee0bbe68 ("target/ppc: Implement ISA V3.00 radix page fault handler")
Signed-off-by: Leandro Lupori <leandro.lupori@eldorado.org.br>
---
 target/ppc/mmu-radix64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c
index 67c38f065b..5414fd63c1 100644
--- a/target/ppc/mmu-radix64.c
+++ b/target/ppc/mmu-radix64.c
@@ -204,7 +204,8 @@ static bool ppc_radix64_check_prot(PowerPCCPU *cpu, MMUAccessType access_type,
     /* Check if requested access type is allowed */
     need_prot = prot_for_access_type(access_type);
     if (need_prot & ~*prot) { /* Page Protected for that Access */
-        *fault_cause |= DSISR_PROTFAULT;
+        *fault_cause |= access_type == MMU_INST_FETCH ? SRR1_NOEXEC_GUARD :
+                                                        DSISR_PROTFAULT;
         return true;
     }
 
-- 
2.25.1
Re: [PATCH] target/ppc: fix ISI fault cause for Radix MMU
Posted by Cédric Le Goater 2 years, 1 month ago
On 3/9/22 20:27, Leandro Lupori wrote:
> Fix Instruction Storage Interrupt (ISI) fault cause for Radix MMU,
> when caused by missing PAGE_EXEC permission, to be
> SRR1_NOEXEC_GUARD instead of DSISR_PROTFAULT.
> This matches POWER9 hardware behavior.
> 
> Fixes: d5fee0bbe68 ("target/ppc: Implement ISA V3.00 radix page fault handler")
> Signed-off-by: Leandro Lupori <leandro.lupori@eldorado.org.br>
> ---
>   target/ppc/mmu-radix64.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)


Queued for 7.0

Thanks,

C.