powerpc: Add Hypervisor Facility Unavailable handling

Treat Hypervisor Facility Unavailable as an illegal instruction in user
space.  This way programs that use facilities like transactional memory,
which will never be supported as it has been removed from the ISA, will
not crash the kernel.

Tested by:	pkubaj
MFC after:	1 week
This commit is contained in:
Justin Hibbits 2025-03-19 18:22:32 -04:00
parent d9a65c5de1
commit 0b663e0cee
2 changed files with 4 additions and 0 deletions

View file

@ -417,6 +417,7 @@ aim_cpu_init(vm_offset_t toc)
bcopy(&hypertrapcode, (void *)(EXC_HEA + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_HMI + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_HVI + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_HFAC + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_SOFT_PATCH + trap_offset), trapsize);
#endif

View file

@ -138,6 +138,7 @@ static struct powerpc_exception powerpc_exceptions[] = {
{ EXC_VEC, "altivec unavailable" },
{ EXC_VSX, "vsx unavailable" },
{ EXC_FAC, "facility unavailable" },
{ EXC_HFAC, "hypervisor facility unavailable" },
{ EXC_ITMISS, "instruction tlb miss" },
{ EXC_DLMISS, "data load tlb miss" },
{ EXC_DSMISS, "data store tlb miss" },
@ -147,6 +148,7 @@ static struct powerpc_exception powerpc_exceptions[] = {
{ EXC_THRM, "thermal management" },
{ EXC_RUNMODETRC, "run mode/trace" },
{ EXC_SOFT_PATCH, "soft patch exception" },
{ EXC_HVI, "hypervisor virtualization" },
{ EXC_LAST, NULL }
};
@ -351,6 +353,7 @@ trap(struct trapframe *frame)
mtspr(SPR_FSCR, fscr & ~FSCR_IC_MASK);
break;
case EXC_HEA:
case EXC_HFAC:
sig = SIGILL;
ucode = ILL_ILLOPC;
break;