target/ppc: Extend ppc_radix64_check_prot() with a 'partition_scoped' bool

This prepares ground for partition-scoped Radix translation.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <20200403140056.59465-3-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Cédric Le Goater 2020-04-03 16:00:54 +02:00 committed by David Gibson
parent d92baf00aa
commit 522ad21875
1 changed files with 6 additions and 5 deletions

View File

@ -105,7 +105,8 @@ static void ppc_radix64_raise_si(PowerPCCPU *cpu, int rwx, vaddr eaddr,
static bool ppc_radix64_check_prot(PowerPCCPU *cpu, int rwx, uint64_t pte, static bool ppc_radix64_check_prot(PowerPCCPU *cpu, int rwx, uint64_t pte,
int *fault_cause, int *prot) int *fault_cause, int *prot,
bool partition_scoped)
{ {
CPUPPCState *env = &cpu->env; CPUPPCState *env = &cpu->env;
const int need_prot[] = { PAGE_READ, PAGE_WRITE, PAGE_EXEC }; const int need_prot[] = { PAGE_READ, PAGE_WRITE, PAGE_EXEC };
@ -121,11 +122,11 @@ static bool ppc_radix64_check_prot(PowerPCCPU *cpu, int rwx, uint64_t pte,
} }
/* Determine permissions allowed by Encoded Access Authority */ /* Determine permissions allowed by Encoded Access Authority */
if ((pte & R_PTE_EAA_PRIV) && msr_pr) { /* Insufficient Privilege */ if (!partition_scoped && (pte & R_PTE_EAA_PRIV) && msr_pr) {
*prot = 0; *prot = 0;
} else if (msr_pr || (pte & R_PTE_EAA_PRIV)) { } else if (msr_pr || (pte & R_PTE_EAA_PRIV) || partition_scoped) {
*prot = ppc_radix64_get_prot_eaa(pte); *prot = ppc_radix64_get_prot_eaa(pte);
} else { /* !msr_pr && !(pte & R_PTE_EAA_PRIV) */ } else { /* !msr_pr && !(pte & R_PTE_EAA_PRIV) && !partition_scoped */
*prot = ppc_radix64_get_prot_eaa(pte); *prot = ppc_radix64_get_prot_eaa(pte);
*prot &= ppc_radix64_get_prot_amr(cpu); /* Least combined permissions */ *prot &= ppc_radix64_get_prot_amr(cpu); /* Least combined permissions */
} }
@ -250,7 +251,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx,
g_raddr, g_page_size, &fault_cause, &pte_addr); g_raddr, g_page_size, &fault_cause, &pte_addr);
if (!(pte & R_PTE_VALID) || if (!(pte & R_PTE_VALID) ||
ppc_radix64_check_prot(cpu, rwx, pte, &fault_cause, g_prot)) { ppc_radix64_check_prot(cpu, rwx, pte, &fault_cause, g_prot, false)) {
/* No valid pte or access denied due to protection */ /* No valid pte or access denied due to protection */
if (cause_excp) { if (cause_excp) {
ppc_radix64_raise_si(cpu, rwx, eaddr, fault_cause); ppc_radix64_raise_si(cpu, rwx, eaddr, fault_cause);