diff options
author | Khalid Aziz <khalid.aziz@oracle.com> | 2018-02-21 12:15:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-18 10:38:46 -0400 |
commit | 52df948d1bff7954f416085a821e299a188424b8 (patch) | |
tree | 627a491f027738807c0fb7e8a585e9d9d895596b | |
parent | 750375003deae240967eed6b13529a4bfc8ca11e (diff) |
sparc64: Add HV fault type handlers for ADI related faults
ADI (Application Data Integrity) feature on M7 and newer processors
adds new fault types for hypervisor - Invalid ASI and MCD disabled.
This patch expands data access exception handler to handle these
faults.
Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
Reviewed-by: Anthony Yznaga <anthony.yznaga@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/kernel/traps_64.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index fc73baa588f6..d273a65a0a10 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
@@ -397,12 +397,35 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig | |||
397 | if (is_no_fault_exception(regs)) | 397 | if (is_no_fault_exception(regs)) |
398 | return; | 398 | return; |
399 | 399 | ||
400 | info.si_signo = SIGSEGV; | 400 | /* MCD (Memory Corruption Detection) disabled trap (TT=0x19) in HV |
401 | * is vectored thorugh data access exception trap with fault type | ||
402 | * set to HV_FAULT_TYPE_MCD_DIS. Check for MCD disabled trap. | ||
403 | * Accessing an address with invalid ASI for the address, for | ||
404 | * example setting an ADI tag on an address with ASI_MCD_PRIMARY | ||
405 | * when TTE.mcd is not set for the VA, is also vectored into | ||
406 | * kerbel by HV as data access exception with fault type set to | ||
407 | * HV_FAULT_TYPE_INV_ASI. | ||
408 | */ | ||
401 | info.si_errno = 0; | 409 | info.si_errno = 0; |
402 | info.si_code = SEGV_MAPERR; | ||
403 | info.si_addr = (void __user *) addr; | 410 | info.si_addr = (void __user *) addr; |
404 | info.si_trapno = 0; | 411 | info.si_trapno = 0; |
405 | force_sig_info(SIGSEGV, &info, current); | 412 | switch (type) { |
413 | case HV_FAULT_TYPE_INV_ASI: | ||
414 | info.si_signo = SIGILL; | ||
415 | info.si_code = ILL_ILLADR; | ||
416 | force_sig_info(SIGILL, &info, current); | ||
417 | break; | ||
418 | case HV_FAULT_TYPE_MCD_DIS: | ||
419 | info.si_signo = SIGSEGV; | ||
420 | info.si_code = SEGV_ACCADI; | ||
421 | force_sig_info(SIGSEGV, &info, current); | ||
422 | break; | ||
423 | default: | ||
424 | info.si_signo = SIGSEGV; | ||
425 | info.si_code = SEGV_MAPERR; | ||
426 | force_sig_info(SIGSEGV, &info, current); | ||
427 | break; | ||
428 | } | ||
406 | } | 429 | } |
407 | 430 | ||
408 | void sun4v_data_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx) | 431 | void sun4v_data_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx) |