mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: matt@boondocker.io
Cc: "Shawn Lin" <shawn.lin@rock-chips.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Rob Herring" <robh@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Igor Velkov" <iav@iav.lv>,
	maz@kernel.org, arnd@arndb.de
Subject: Re: [PATCH RFC v3 2/6] arm64: Allow synchronous abort fixups for guarded MMIO reads
Date: Tue, 17 Nov 2026 12:04:40 +0000	[thread overview]
Message-ID: <avxC2NbBCa3Ilowr@willie-the-truck> (raw)
In-Reply-To: <20261116-rfc-b4-v3-2-0bf052b68f2a@boondocker.io>

Hi Matt,

On Mon, Nov 16, 2026 at 02:35:44AM -0700, Matt Thompson via B4 Relay wrote:
> From: Matt Thompson <matt@boondocker.io>
> 
> 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@boondocker.io>
> ---
>  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

  reply	other threads:[~2026-11-17 12:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  9:35 [PATCH RFC v3 0/6] PCI: rockchip-host: Handle unavailable downstream config space Matt Thompson via B4 Relay
2026-11-16  9:35 ` [PATCH RFC v3 1/6] PCI: rockchip-host: Skip downstream config access while link is down Matt Thompson via B4 Relay
2026-11-16  9:35 ` [PATCH RFC v3 2/6] arm64: Allow synchronous abort fixups for guarded MMIO reads Matt Thompson via B4 Relay
2026-11-17 12:04   ` Will Deacon [this message]
2026-11-16  9:35 ` [PATCH RFC v3 3/6] PCI: rockchip-host: Recover downstream configuration access Matt Thompson via B4 Relay
2026-11-16  9:35 ` [PATCH RFC v3 4/6] PCI: Resume downstream ports before sysfs Link Control writes Matt Thompson via B4 Relay
2026-11-16  9:35 ` [PATCH RFC v3 5/6] PCI: rockchip-host: Defer retraining during initial link training Matt Thompson via B4 Relay
2026-11-16  9:35 ` [PATCH RFC v3 6/6] PCI: rockchip-host: Mask the client correctable error interrupt Matt Thompson via B4 Relay
2026-11-16 19:10 ` [PATCH RFC v3 0/6] PCI: rockchip-host: Handle unavailable downstream config space Igor Velkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avxC2NbBCa3Ilowr@willie-the-truck \
    --to=will@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=heiko@sntech.de \
    --cc=iav@iav.lv \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt@boondocker.io \
    --cc=maz@kernel.org \
    --cc=robh@kernel.org \
    --cc=shawn.lin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®