Linux ACPI
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Lorenzo Pieralisi <lpieralisi@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Leo Yan <leo.yan@arm.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	driver-core@lists.linux.dev
Subject: Re: [PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add IRQ mapping -EPROBE_DEFER handling
Date: Fri, 4 Dec 2026 18:59:18 +0000	[thread overview]
Message-ID: <77b863a4-0809-4e67-832c-d8aca811c3cd@arm.com> (raw)
In-Reply-To: <20261130-acpi-static-table-irq-probe-defer-v2-8-7e854fe7aecd@kernel.org>

On 30/11/2026 8:54 am, Lorenzo Pieralisi wrote:
> With the advent of GICv5, IRQs mapping can fail if the interrupt
> controller the wired SMMU interrupts are routed to has not probed
> yet when the SMMU driver probes.
> 
> Handle -EPROBE_DEFER gracefully for IRQ mappings failures.
> 
> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> ---
> Cc: Will Deacon <will@kernel.org>
> Cc: Robin Murphy <robin.murphy@arm.com>
> ---
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 +++++++++++++++++++----------
>   1 file changed, 28 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 6d4520c47308..602a31ea3bd1 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -5779,13 +5779,26 @@ static struct arm_smmu_device *arm_smmu_impl_probe(struct arm_smmu_device *smmu)
>   	return ERR_PTR(ret);
>   }
>   
> +static int arm_smmu_get_irq(struct platform_device *pdev, const char *name,
> +			    int *irq_out)
> +{
> +	int irq = platform_get_irq_byname_optional(pdev, name);
> +
> +	if (irq == -EPROBE_DEFER)
> +		return dev_err_probe(&pdev->dev, irq, "failed to get %s IRQ\n", name);
> +	if (irq > 0)
> +		*irq_out = irq;
> +
> +	return 0;

Might it be simpler to just return max(irq,0) by value here? Such that:

	smmu->irq = arm_smmu_get_irq(dev, name);
	if (smmu->irq < 0) // can only be -EPROBE_DEFER
		return smmu->irq;

Or perhaps it's just me and the fact that I'm never particularly fond of 
output arguments...

Cheers,
Robin.

> +}
> +
>   static int arm_smmu_device_probe(struct platform_device *pdev)
>   {
> -	int irq, ret;
>   	struct resource *res;
>   	resource_size_t ioaddr;
>   	struct arm_smmu_device *smmu;
>   	struct device *dev = &pdev->dev;
> +	int ret;
>   
>   	smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL);
>   	if (!smmu)
> @@ -5833,22 +5846,22 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
>   
>   	/* Interrupt lines */
>   
> -	irq = platform_get_irq_byname_optional(pdev, "combined");
> -	if (irq > 0)
> -		smmu->combined_irq = irq;
> -	else {
> -		irq = platform_get_irq_byname_optional(pdev, "eventq");
> -		if (irq > 0)
> -			smmu->evtq.q.irq = irq;
> +	ret = arm_smmu_get_irq(pdev, "combined", &smmu->combined_irq);
> +	if (ret)
> +		return ret;
>   
> -		irq = platform_get_irq_byname_optional(pdev, "priq");
> -		if (irq > 0)
> -			smmu->priq.q.irq = irq;
> -
> -		irq = platform_get_irq_byname_optional(pdev, "gerror");
> -		if (irq > 0)
> -			smmu->gerr_irq = irq;
> +	if (!smmu->combined_irq) {
> +		ret = arm_smmu_get_irq(pdev, "eventq", &smmu->evtq.q.irq);
> +		if (ret)
> +			return ret;
> +		ret = arm_smmu_get_irq(pdev, "priq", &smmu->priq.q.irq);
> +		if (ret)
> +			return ret;
> +		ret = arm_smmu_get_irq(pdev, "gerror", &smmu->gerr_irq);
> +		if (ret)
> +			return ret;
>   	}
> +
>   	/* Probe the h/w */
>   	ret = arm_smmu_device_hw_probe(smmu);
>   	if (ret)
> 


  reply	other threads:[~2026-12-04 18:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
2026-11-30  8:54 ` [PATCH RFC v2 1/9] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain Lorenzo Pieralisi
2026-11-30  8:54 ` [PATCH RFC v2 2/9] ACPI: Introduce IRQ methods for static fwnodes Lorenzo Pieralisi
2026-12-04 18:10   ` Andy Shevchenko
2026-12-04 18:21     ` Rafael J. Wysocki (Intel)
2026-12-04 18:37       ` Andy Shevchenko
2026-12-04 18:35   ` Rafael J. Wysocki (Intel)
2026-12-04 19:41   ` Robin Murphy
2026-11-30  8:54 ` [PATCH RFC v2 3/9] driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code Lorenzo Pieralisi
2026-11-30  8:54 ` [PATCH RFC v2 4/9] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure Lorenzo Pieralisi
2026-11-30  8:54 ` [PATCH RFC v2 5/9] clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe Lorenzo Pieralisi
2026-12-04 18:17   ` Andy Shevchenko
2026-11-30  8:54 ` [PATCH RFC v2 6/9] ACPI/IORT: Convert IORT devices to use the ACPI static fwnode IRQs Lorenzo Pieralisi
2026-11-30  8:54 ` [PATCH RFC v2 7/9] iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling Lorenzo Pieralisi
2026-12-04 18:34   ` Robin Murphy
2026-11-30  8:54 ` [PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add " Lorenzo Pieralisi
2026-12-04 18:59   ` Robin Murphy [this message]
2026-11-30  8:54 ` [PATCH RFC v2 9/9] perf/arm-smmuv3: " Lorenzo Pieralisi
2026-12-04 18:31   ` Robin Murphy
2026-12-04 18:19 ` [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Andy Shevchenko
2026-12-04 18:33   ` Rafael J. Wysocki (Intel)

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=77b863a4-0809-4e67-832c-d8aca811c3cd@arm.com \
    --to=robin.murphy@arm.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dakr@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=guohanjun@huawei.com \
    --cc=leo.yan@arm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@kernel.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    /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