Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matt Thompson" <matt@boondocker.io>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH RFC v3 3/6] PCI: rockchip-host: Recover downstream configuration access
Date: Mon, 16 Nov 2026 09:52:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-216655@kernel.org> (raw)
In-Reply-To: <20261116-rfc-b4-v3-3-0bf052b68f2a@boondocker.io>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] PCI: rockchip-host: rockchip_pcie_cfg_load() misses SError on
  Cortex-A72
--

commit f728b48c5b51b4d3ce6fd3c2e945b72fecef9c1b
Author: Matt Thompson <matt@boondocker.io>

PCI: rockchip-host: Recover downstream configuration access

This commit adds arm64 exception-table recovery for downstream PCI
configuration loads and clears the controller's AXI link-down latch before
downstream configuration reads and writes.

Link: https://lore.kernel.org/linux-pci/20261024-rockchip-pcie-resume-v1-2-58e54a5cf5f1@iav.lv/

> diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
> index 35105c129de1c..64ac6f42532d9 100644
> --- a/drivers/pci/controller/pcie-rockchip-host.c
> +++ b/drivers/pci/controller/pcie-rockchip-host.c

[ ... ]

> @@ -149,16 +153,36 @@ static bool rockchip_pcie_downstream_ready(struct rockchip_pcie *rockchip)
>  	       PCIE_LINK_TRAINING_DONE(rockchip_pcie_read(rockchip, PCIE_CORE_CTRL));
>  }
>  
> +#ifdef CONFIG_ARM64
> +/*
> + * An absent completion can raise a synchronous external abort even when
> + * the link status indicated up immediately before the config transaction.
> + */
> +#define rockchip_pcie_cfg_load(insn, addr, val)			\
> +	({								\
> +		int err = 0;					\
> +		asm volatile("1: " #insn " %w0, [%2]\n"			\
> +			     "2:\n"					\
> +			     _ASM_EXTABLE_MMIO_READ_ERR_ZERO(1b, 2b,	\
> +							    %w1, %w0)	\
> +			     : "=&r" (val), "+r" (err)			\
> +			     : "r" (addr) : "memory");			\
> +		err;							\
> +	})
> +#endif
> +
>  static int rockchip_pcie_rd_other_conf(struct rockchip_pcie *rockchip,
>  				       struct pci_bus *bus, u32 devfn,
>  				       int where, int size, u32 *val)
>  {
>  	void __iomem *addr;
> +#ifdef CONFIG_ARM64
> +	u32 data;
> +	int err;
> +#endif
>  
> -	if (!rockchip_pcie_downstream_ready(rockchip)) {
> -		*val = ~0U;
> -		return PCIBIOS_DEVICE_NOT_FOUND;
> -	}
> +	if (!rockchip_pcie_downstream_ready(rockchip))
> +		goto absent;
>  
>  	addr = rockchip->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
>  
> @@ -174,6 +198,28 @@ static int rockchip_pcie_rd_other_conf(struct rockchip_pcie *rockchip,
>  		rockchip_pcie_cfg_configuration_accesses(rockchip,
>  						AXI_WRAPPER_TYPE1_CFG);
>  
> +	/* Clear the AXI link-down latch before downstream config traffic. */
> +	rockchip_pcie_write(rockchip, 0, PCIE_CORE_AXI_LINK_DOWN);
> +
> +#ifdef CONFIG_ARM64
> +	if (size == 4) {
> +		err = rockchip_pcie_cfg_load(ldr, addr, data);
> +		*val = le32_to_cpu((__force __le32)data);
> +	} else if (size == 2) {
> +		err = rockchip_pcie_cfg_load(ldrh, addr, data);
> +		*val = le16_to_cpu((__force __le16)data);
> +	} else if (size == 1) {
> +		err = rockchip_pcie_cfg_load(ldrb, addr, data);
> +		*val = data;
> +	} else {
> +		*val = 0;
> +		return PCIBIOS_BAD_REGISTER_NUMBER;
> +	}
> +	if (err)
> +		goto absent;
> +	/* Preserve the I/O read ordering of readl/readw/readb. */
> +	__io_ar(*val);

[Severity: High]
As reported by Igor Velkov on RFC v2 [1], does rockchip_pcie_cfg_load()
still leave Cortex-A72 cores exposed to an unrecoverable SError panic when
a downstream configuration read fails to complete?

This driver targets RK3399, which pairs Cortex-A53 cores with Cortex-A72
cores.  While Cortex-A53 reports AXI slave errors on configuration loads
as synchronous external aborts that _ASM_EXTABLE_MMIO_READ_ERR_ZERO()
catches via fixup_sea_exception(), Cortex-A72 reports them asynchronously
as SError interrupts.  When rockchip_pcie_rd_other_conf() runs on a
Cortex-A72 core and the link drops after rockchip_pcie_downstream_ready()
or fails to return a usable completion, the load instruction retires with
err == 0 and the asynchronous SError fires at the barrier in __io_ar(*val),
panicking the system in do_serror().

[1] https://lore.kernel.org/r/20261116-rockchip-host-rfc-v2-test-1@iav.lv

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-rfc-b4-v3-0-0bf052b68f2a@boondocker.io?part=3

  reply	other threads:[~2026-11-16  9:52 UTC|newest]

Thread overview: 13+ 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:46   ` sashiko-bot
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-16  9:47   ` sashiko-bot
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:52   ` sashiko-bot [this message]
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 10:04   ` sashiko-bot
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:51   ` sashiko-bot
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  9:54   ` sashiko-bot

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=sashiko-outbox-216655@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matt@boondocker.io \
    --cc=sashiko-reviews@lists.linux.dev \
    /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