linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Ray Jui <ray.jui@broadcom.com>
Cc: "Sandor Bodo-Merle" <sbodomerle@gmail.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Ray Jui" <rjui@broadcom.com>,
	"Scott Branden" <sbranden@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel
Date: Mon, 7 Jun 2021 23:18:17 +0200	[thread overview]
Message-ID: <20210607211817.fy2necxy5mxow6rg@pali> (raw)
In-Reply-To: <927a977c-5bd5-3df1-c990-d817b0759654@broadcom.com>

On Monday 07 June 2021 09:48:21 Ray Jui wrote:
> On 6/6/2021 5:30 AM, Sandor Bodo-Merle wrote:
> > The interrupt affinity scheme used by this driver is incompatible with
> > multi-MSI as it implies moving the doorbell address to that of another MSI
> > group.  This isn't possible for multi-MSI, as all the MSIs must have the
> > same doorbell address. As such it is restricted to systems with a single
> > CPU.
> > 
> > Fixes: fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")
> > Reported-by: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Sandor Bodo-Merle <sbodomerle@gmail.com>
> > ---
> >  drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c
> > index 557d93dcb3bc..81b4effeb130 100644
> > --- a/drivers/pci/controller/pcie-iproc-msi.c
> > +++ b/drivers/pci/controller/pcie-iproc-msi.c
> > @@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = {
> >  
> >  static struct msi_domain_info iproc_msi_domain_info = {
> >  	.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> > -		MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
> > +		MSI_FLAG_PCI_MSIX,
> >  	.chip = &iproc_msi_irq_chip,
> >  };
> >  
> > @@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,
> >  	struct iproc_msi *msi = domain->host_data;
> >  	int hwirq, i;
> >  
> > +	if (msi->nr_cpus > 1 && nr_irqs > 1)
> > +		return -EINVAL;
> > +
> 
> This should never happen since the framework would have guarded against
> this. But I guess it does not hurt to have the check here.

Yes, this should not happen, but I suggested to add a comment or assert
or some other way to document this kind of constrain. Lot of times code
is copy+pasted to new drivers and because only this one driver has
.alloc function which is using nr_cpus for allocating msi bitmap, it
really makes sense to document this constrain also explicitly.

> >  	mutex_lock(&msi->bitmap_lock);
> >  
> >  	/*
> > @@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
> >  	mutex_init(&msi->bitmap_lock);
> >  	msi->nr_cpus = num_possible_cpus();
> >  
> > +	if (msi->nr_cpus == 1)
> > +		iproc_msi_domain_info.flags |=  MSI_FLAG_MULTI_PCI_MSI;
                                              ^^
Just a small note: there are two spaces instead of just one

Otherwise looks good to me:

Acked-by: Pali Rohár <pali@kernel.org>

> > +
> >  	msi->nr_irqs = of_irq_count(node);
> >  	if (!msi->nr_irqs) {
> >  		dev_err(pcie->dev, "found no MSI GIC interrupt\n");
> > 
> 
> Looks fine to me. Thanks.
> 
> Acked-by: Ray Jui <ray.jui@broadcom.com>

  reply	other threads:[~2021-06-07 21:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 12:30 [PATCH 1/2] PCI: iproc: fix the base vector number allocation for multi-MSI Sandor Bodo-Merle
2021-06-06 12:30 ` [PATCH 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel Sandor Bodo-Merle
2021-06-06 13:28   ` Marc Zyngier
2021-06-07 16:48   ` Ray Jui
2021-06-07 21:18     ` Pali Rohár [this message]
2021-06-21 14:47   ` Lorenzo Pieralisi
2021-06-22 15:26     ` [PATCH v2 1/2] PCI: iproc: Fix multi-MSI base vector number allocation Sandor Bodo-Merle
2021-06-22 15:44       ` Lorenzo Pieralisi
2021-06-22 15:26     ` [PATCH v2 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel Sandor Bodo-Merle
2021-06-06 13:26 ` [PATCH 1/2] PCI: iproc: fix the base vector number allocation for multi-MSI Marc Zyngier
2021-06-06 14:10 ` Pali Rohár
2021-06-07 16:45 ` Ray Jui
2021-06-10 23:32 ` Bjorn Helgaas

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=20210607211817.fy2necxy5mxow6rg@pali \
    --to=pali@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=maz@kernel.org \
    --cc=ray.jui@broadcom.com \
    --cc=rjui@broadcom.com \
    --cc=robh@kernel.org \
    --cc=sbodomerle@gmail.com \
    --cc=sbranden@broadcom.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;
as well as URLs for NNTP newsgroup(s).