Skip to content

Commit ee97b6b

Browse files
bsingharorampe
authored andcommitted
powerpc/mm/radix: Setup AMOR in HV mode to allow key 0
Setup AMOR (Authority Mask Override Register) in HV mode so that the host and guest kernel can in turn setup IAMR. This allows us to enable key 0 in a following patch. Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 378f96d commit ee97b6b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/powerpc/mm/pgtable-radix.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,18 @@ static void update_hid_for_radix(void)
312312
cpu_relax();
313313
}
314314

315+
static void radix_init_amor(void)
316+
{
317+
/*
318+
* In HV mode, we init AMOR (Authority Mask Override Register) so that
319+
* the hypervisor and guest can setup IAMR (Instruction Authority Mask
320+
* Register), enable key 0 and set it to 1.
321+
*
322+
* AMOR = 0b1100 .... 0000 (Mask for key 0 is 11)
323+
*/
324+
mtspr(SPRN_AMOR, (3ul << 62));
325+
}
326+
315327
void __init radix__early_init_mmu(void)
316328
{
317329
unsigned long lpcr;
@@ -368,6 +380,7 @@ void __init radix__early_init_mmu(void)
368380
lpcr = mfspr(SPRN_LPCR);
369381
mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
370382
radix_init_partition_table();
383+
radix_init_amor();
371384
}
372385

373386
memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
@@ -387,6 +400,7 @@ void radix__early_init_mmu_secondary(void)
387400

388401
mtspr(SPRN_PTCR,
389402
__pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
403+
radix_init_amor();
390404
}
391405
}
392406

0 commit comments

Comments
 (0)