Skip to content

Commit 293c30c

Browse files
npiggingregkh
authored andcommitted
powerpc/powernv: Enable HAIL (HV AIL) for ISA v3.1 processors
commit 49c1d07 upstream. Starting with ISA v3.1, LPCR[AIL] no longer controls the interrupt mode for HV=1 interrupts. Instead, a new LPCR[HAIL] bit is defined which behaves like AIL=3 for HV interrupts when set. Set HAIL on bare metal to give us mmu-on interrupts and improve performance. This also fixes an scv bug: we don't implement scv real mode (AIL=0) vectors because they are at an inconvenient location, so we just disable scv support when AIL can not be set. However powernv assumes that LPCR[AIL] will enable AIL mode so it enables scv support despite HV interrupts being AIL=0, which causes scv interrupts to go off into the weeds. Fixes: 7fa95f9 ("powerpc/64s: system call support for scv/rfscv instructions") Cc: stable@vger.kernel.org # v5.9+ Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210402024124.545826-1-npiggin@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 643243e commit 293c30c

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎arch/powerpc/include/asm/reg.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@
444444
#define LPCR_VRMA_LP1 ASM_CONST(0x0000800000000000)
445445
#define LPCR_RMLS 0x1C000000 /* Implementation dependent RMO limit sel */
446446
#define LPCR_RMLS_SH 26
447+
#define LPCR_HAIL ASM_CONST(0x0000000004000000) /* HV AIL (ISAv3.1) */
447448
#define LPCR_ILE ASM_CONST(0x0000000002000000) /* !HV irqs set MSR:LE */
448449
#define LPCR_AIL ASM_CONST(0x0000000001800000) /* Alternate interrupt location */
449450
#define LPCR_AIL_0 ASM_CONST(0x0000000000000000) /* MMU off exception offset 0x0 */

‎arch/powerpc/kernel/setup_64.c‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,23 @@ static void cpu_ready_for_interrupts(void)
231231
* If we are not in hypervisor mode the job is done once for
232232
* the whole partition in configure_exceptions().
233233
*/
234-
if (cpu_has_feature(CPU_FTR_HVMODE) &&
235-
cpu_has_feature(CPU_FTR_ARCH_207S)) {
234+
if (cpu_has_feature(CPU_FTR_HVMODE)) {
236235
unsigned long lpcr = mfspr(SPRN_LPCR);
237-
mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
236+
unsigned long new_lpcr = lpcr;
237+
238+
if (cpu_has_feature(CPU_FTR_ARCH_31)) {
239+
/* P10 DD1 does not have HAIL */
240+
if (pvr_version_is(PVR_POWER10) &&
241+
(mfspr(SPRN_PVR) & 0xf00) == 0x100)
242+
new_lpcr |= LPCR_AIL_3;
243+
else
244+
new_lpcr |= LPCR_HAIL;
245+
} else if (cpu_has_feature(CPU_FTR_ARCH_207S)) {
246+
new_lpcr |= LPCR_AIL_3;
247+
}
248+
249+
if (new_lpcr != lpcr)
250+
mtspr(SPRN_LPCR, new_lpcr);
238251
}
239252

240253
/*

0 commit comments

Comments
 (0)