Re: [PATCH RFC v3 2/6] arm64: Allow synchronous abort fixups for guarded MMIO reads
From: Will Deacon
Date: Tue Nov 17 2026 - 07:04:57 EST
Hi Matt,
On Mon, Nov 16, 2026 at 02:35:44AM -0700, Matt Thompson via B4 Relay wrote:
> From: Matt Thompson <matt@xxxxxxxxxxxxx>
>
> An RK3399 PCI configuration read can raise a synchronous external data
> abort if it does not get a usable response. Allow an explicitly annotated
> MMIO load to return an error in this case.
>
> Match only a current-EL synchronous external abort on a read instruction
> with the new exception table type. Keep existing handling for other
> faults, including asynchronous SError and translation table walk aborts.
>
> Signed-off-by: Matt Thompson <matt@xxxxxxxxxxxxx>
> ---
> arch/arm64/include/asm/asm-extable.h | 15 +++++++++++++++
> arch/arm64/mm/extable.c | 20 ++++++++++++++++++++
> arch/arm64/mm/fault.c | 4 ++++
> 3 files changed, 39 insertions(+)
[...]
> diff --git a/arch/arm64/mm/extable.c b/arch/arm64/mm/extable.c
> index 299a244..dcb84d8 100644
> --- a/arch/arm64/mm/extable.c
> +++ b/arch/arm64/mm/extable.c
> @@ -28,6 +28,8 @@ bool insn_may_access_user(unsigned long addr, unsigned long esr)
> return false;
>
> switch (ex->type) {
> + case EX_TYPE_MMIO_READ_ERR_ZERO:
> + return false;
> case EX_TYPE_UACCESS_CPY:
> return cpy_faulted_on_uaccess(ex, esr);
> default:
> @@ -101,6 +103,8 @@ bool fixup_exception(struct pt_regs *regs, unsigned long esr)
> case EX_TYPE_UACCESS_ERR_ZERO:
> case EX_TYPE_KACCESS_ERR_ZERO:
> return ex_handler_uaccess_err_zero(ex, regs);
> + case EX_TYPE_MMIO_READ_ERR_ZERO:
> + return false;
> case EX_TYPE_UACCESS_CPY:
> return ex_handler_uaccess_cpy(ex, regs, esr);
> case EX_TYPE_LOAD_UNALIGNED_ZEROPAD:
> @@ -109,3 +113,19 @@ bool fixup_exception(struct pt_regs *regs, unsigned long esr)
>
> BUG();
> }
> +
> +bool fixup_sea_exception(struct pt_regs *regs, unsigned long esr)
> +{
> + const struct exception_table_entry *ex;
> +
> + if (ESR_ELx_EC(esr) != ESR_ELx_EC_DABT_CUR ||
> + (esr & ESR_ELx_FSC) != ESR_ELx_FSC_EXTABT ||
> + (esr & ESR_ELx_WNR))
> + return false;
> +
> + ex = search_exception_tables(instruction_pointer(regs));
> + if (!ex || ex->type != EX_TYPE_MMIO_READ_ERR_ZERO)
> + return false;
> +
> + return ex_handler_uaccess_err_zero(ex, regs);
> +}
> diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
> index b227368..ebe8054 100644
> --- a/arch/arm64/mm/fault.c
> +++ b/arch/arm64/mm/fault.c
> @@ -30,6 +30,7 @@
> #include <linux/hugetlb.h>
>
> #include <asm/acpi.h>
> +#include <asm/asm-extable.h>
> #include <asm/bug.h>
> #include <asm/cmpxchg.h>
> #include <asm/cpufeature.h>
> @@ -879,6 +880,9 @@ static int do_sea(unsigned long far, unsigned long esr, struct pt_regs *regs)
> const struct fault_info *inf;
> unsigned long siaddr;
>
> + if (fixup_sea_exception(regs, esr))
> + return 0;
> +
We've deliberately avoided exposing an interface such as this from the
architecture code for a variety of reasons, including:
- If you can trigger one of these, you can probably also trigger
asynchronous exceptions (i.e. SError) which we cannot handle using
fixups
- External aborts are usually a sign that something has gone horribly
wrong
- In the general case of MMIO, it's not at all clear what state the
endpoint is left in and so swallowing the abort is likely masking the
issue
- It's not a portable interface for drivers
So rather than trying to fix the symptoms, it would be much better if
you could fix your driver so that the hardware doesn't generate these
things in the first place.
Will