diff options
author | Balbir Singh <bsingharora@gmail.com> | 2016-11-15 07:56:14 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-11-25 05:01:31 +0100 |
commit | ee97b6b99f42285d29d439f2e5376e03b2760e09 (patch) | |
tree | 6641b7b9cadada6f94d1989e8f8ac1f9cd23e5dd /arch | |
parent | powernv: Clear SPRN_PSSCR when a POWER9 CPU comes online (diff) | |
download | linux-ee97b6b99f42285d29d439f2e5376e03b2760e09.tar.xz linux-ee97b6b99f42285d29d439f2e5376e03b2760e09.zip |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/mm/pgtable-radix.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c index 8d00ab4222a7..29e502953688 100644 --- a/arch/powerpc/mm/pgtable-radix.c +++ b/arch/powerpc/mm/pgtable-radix.c @@ -312,6 +312,18 @@ static void update_hid_for_radix(void) cpu_relax(); } +static void radix_init_amor(void) +{ + /* + * In HV mode, we init AMOR (Authority Mask Override Register) so that + * the hypervisor and guest can setup IAMR (Instruction Authority Mask + * Register), enable key 0 and set it to 1. + * + * AMOR = 0b1100 .... 0000 (Mask for key 0 is 11) + */ + mtspr(SPRN_AMOR, (3ul << 62)); +} + void __init radix__early_init_mmu(void) { unsigned long lpcr; @@ -368,6 +380,7 @@ void __init radix__early_init_mmu(void) lpcr = mfspr(SPRN_LPCR); mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR); radix_init_partition_table(); + radix_init_amor(); } memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); @@ -387,6 +400,7 @@ void radix__early_init_mmu_secondary(void) mtspr(SPRN_PTCR, __pa(partition_tb) | (PATB_SIZE_SHIFT - 12)); + radix_init_amor(); } } |