Skip to content

Commit 2aa6195

Browse files
apopplempe
authored andcommitted
powerpc: Enable Prefixed Instructions
Prefix instructions have their own FSCR bit which needs to enabled via a CPU feature. The kernel will save the FSCR for problem state but it needs to be enabled initially. If prefixed instructions are made unavailable by the [H]FSCR, attempting to use them will cause a facility unavailable exception. Add "PREFIX" to the facility_strings[]. Currently there are no prefixed instructions that are actually emulated by emulate_instruction() within facility_unavailable_exception(). However, when caused by a prefixed instructions the SRR1 PREFIXED bit is set. Prepare for dealing with emulated prefixed instructions by checking for this bit. Signed-off-by: Alistair Popple <[email protected]> Signed-off-by: Jordan Niethe <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Reviewed-by: Nicholas Piggin <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0b582db commit 2aa6195

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

arch/powerpc/include/asm/reg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
#define SPRN_RWMR 0x375 /* Region-Weighting Mode Register */
398398

399399
/* HFSCR and FSCR bit numbers are the same */
400+
#define FSCR_PREFIX_LG 13 /* Enable Prefix Instructions */
400401
#define FSCR_SCV_LG 12 /* Enable System Call Vectored */
401402
#define FSCR_MSGP_LG 10 /* Enable MSGP */
402403
#define FSCR_TAR_LG 8 /* Enable Target Address Register */
@@ -408,11 +409,13 @@
408409
#define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */
409410
#define FSCR_FP_LG 0 /* Enable Floating Point */
410411
#define SPRN_FSCR 0x099 /* Facility Status & Control Register */
412+
#define FSCR_PREFIX __MASK(FSCR_PREFIX_LG)
411413
#define FSCR_SCV __MASK(FSCR_SCV_LG)
412414
#define FSCR_TAR __MASK(FSCR_TAR_LG)
413415
#define FSCR_EBB __MASK(FSCR_EBB_LG)
414416
#define FSCR_DSCR __MASK(FSCR_DSCR_LG)
415417
#define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */
418+
#define HFSCR_PREFIX __MASK(FSCR_PREFIX_LG)
416419
#define HFSCR_MSGP __MASK(FSCR_MSGP_LG)
417420
#define HFSCR_TAR __MASK(FSCR_TAR_LG)
418421
#define HFSCR_EBB __MASK(FSCR_EBB_LG)

arch/powerpc/kernel/traps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,7 @@ void facility_unavailable_exception(struct pt_regs *regs)
17371737
[FSCR_TAR_LG] = "TAR",
17381738
[FSCR_MSGP_LG] = "MSGP",
17391739
[FSCR_SCV_LG] = "SCV",
1740+
[FSCR_PREFIX_LG] = "PREFIX",
17401741
};
17411742
char *facility = "unknown";
17421743
u64 value;

0 commit comments

Comments
 (0)