public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Joerg Roedel <joro@8bytes.org>,
	Rob Clark <robdclark@chromium.org>,
	linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, Xin Tan <tanxin.ctf@gmail.com>,
	Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>,
	"Isaac J. Manjarres" <isaacm@codeaurora.org>,
	Rob Herring <robh+dt@kernel.org>,
	linux-kernel@vger.kernel.org,
	Prabhakar <prabhakar.csengg@gmail.com>
Subject: Re: [PATCH 1/2] iommu/arm-smmu: Use platform_irq_count() to get the interrupt count
Date: Tue, 8 Feb 2022 15:31:52 +0000	[thread overview]
Message-ID: <20220208153152.GC1802@willie-the-truck> (raw)
In-Reply-To: <f54af077-41a3-e8c3-4349-ecc7f83520a4@arm.com>

On Tue, Feb 08, 2022 at 03:28:50PM +0000, Robin Murphy wrote:
> On 2022-02-08 15:19, Will Deacon wrote:
> > On Thu, Dec 23, 2021 at 02:14:35PM +0000, Robin Murphy wrote:
> > > On 2021-12-23 13:00, Lad Prabhakar wrote:
> > > > platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> > > > allocation of IRQ resources in DT core code, this causes an issue
> > > > when using hierarchical interrupt domains using "interrupts" property
> > > > in the node as this bypasses the hierarchical setup and messes up the
> > > > irq chaining.
> > > > 
> > > > In preparation for removal of static setup of IRQ resource from DT core
> > > > code use platform_get_irq_count().
> > > 
> > > Nit: platform_irq_count()
> > > 
> > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > ---
> > > >    drivers/iommu/arm/arm-smmu/arm-smmu.c | 12 ++++++------
> > > >    1 file changed, 6 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > > > index 4bc75c4ce402..4844cd075644 100644
> > > > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > > > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > > > @@ -2105,12 +2105,12 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
> > > >    	if (IS_ERR(smmu))
> > > >    		return PTR_ERR(smmu);
> > > > -	num_irqs = 0;
> > > > -	while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, num_irqs))) {
> > > > -		num_irqs++;
> > > > -		if (num_irqs > smmu->num_global_irqs)
> > > > -			smmu->num_context_irqs++;
> > > > -	}
> > > > +	num_irqs = platform_irq_count(pdev);
> > > > +	if (num_irqs < 0)
> > > > +		return num_irqs;
> > > > +
> > > > +	if (num_irqs > smmu->num_global_irqs)
> > > > +		smmu->num_context_irqs += (num_irqs - smmu->num_global_irqs);
> > > 
> > > This seems a bit overcomplicated. I reckon:
> > > 
> > > 	smmu->num_context_irqs = num_irqs - smmu->num_global_irqs;
> > > 	if (num_irqs <= smmu->num_global_irqs) {
> > > 		dev_err(...
> > > 
> > > should do it.
> > > 
> > > However, FYI I have some patches refactoring most of the IRQ stuff here that
> > > I plan to post next cycle (didn't quite have time to get them done for 5.17
> > > as I'd hoped...), so unless this needs to go in right now as an urgent fix,
> > > I'm happy to take care of removing platform_get_resource() as part of that
> > > if it's easier.
> > 
> > Did you get anywhere with this? December 23rd is long forgotten by now ;)
> 
> Yup: https://gitlab.arm.com/linux-arm/linux-rm/-/commit/b2a40caaf1622eb35c555074a0d72f4f0513cff9
> 
> I'm still cleaning up the PMU driver that justifies the whole thing, but I
> can send that patch now if you reckon it's not complete nonsense out of
> context. Otherwise, I'll aim to get the whole lot out next week.

Next week is fine, no rush. I was just trying to work out what to do with
Lad's patches in this thread and it sounds like I should ignore them and
wait for your series instead.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-08 15:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 13:00 [PATCH 0/2] iommu/arm-smmu: Use platform_irq_count() Lad Prabhakar
2021-12-23 13:00 ` [PATCH 1/2] iommu/arm-smmu: Use platform_irq_count() to get the interrupt count Lad Prabhakar
2021-12-23 14:14   ` Robin Murphy
2021-12-23 17:36     ` Lad, Prabhakar
2022-02-08 15:19     ` Will Deacon
2022-02-08 15:28       ` Robin Murphy
2022-02-08 15:31         ` Will Deacon [this message]
2021-12-23 13:00 ` [PATCH 2/2] iommu/arm-smmu: Propagate errors from platform_get_irq() Lad Prabhakar
2021-12-23 14:19   ` Robin Murphy

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=20220208153152.GC1802@willie-the-truck \
    --to=will@kernel.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=isaacm@codeaurora.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robdclark@chromium.org \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=saiprakash.ranjan@codeaurora.org \
    --cc=tanxin.ctf@gmail.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