linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryder Lee <ryder.lee@mediatek.com>
To: Marc Zyngier <maz@kernel.org>
Cc: <frank-w@public-files.de>, <linux-mediatek@lists.infradead.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	Frank Wunderlich <linux@fw-web.de>,
	<linux-kernel@vger.kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-pci@vger.kernel.org>, Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH] pci: mediatek: fix warning in msi.h
Date: Mon, 2 Nov 2020 01:54:21 +0800	[thread overview]
Message-ID: <1604253261.22363.0.camel@mtkswgap22> (raw)
In-Reply-To: <87lfflti8q.wl-maz@kernel.org>

On Sun, 2020-11-01 at 11:43 +0000, Marc Zyngier wrote:
> On Sun, 01 Nov 2020 09:25:04 +0000,
> Frank Wunderlich <frank-w@public-files.de> wrote:
> > 
> > Am 31. Oktober 2020 22:49:14 MEZ schrieb Thomas Gleixner <tglx@linutronix.de>:
> > 
> > >That's not a fix. It's just supressing the warning.
> > 
> > Ok sorry
> > 
> > >So it needs to be figured out why the domain association is not there.
> > 
> > It looks like for mt7623 there is no msi domain setup (done via
> > mtk_pcie_setup_irq callback + mtk_pcie_init_irq_domain) in mtk pcie
> > driver.
> 
> Does this mean that this SoC never handled MSIs the first place? Which
> would explain the warning, as there is no MSI domain registered for
> the device, and we end-up falling back to arch_setup_msi_irqs().
> 
> If this system truly is unable to handle MSIs, one potential
> workaround would be to register a PCI-MSI domain that would always
> fail its allocation with -ENOSPC. It is really ugly, but would keep
> the horror localised. See the patchlet below, which I can't test.
> 
> If this situation is more common than we expect, we may need something
> in core code instead.
> 
> 	M.
> 
Yea, mt7623 (mtk_pcie_soc_v1) does not support MSI, so that's a way to
handle it.

@Frank, could you help to test it?

Ryder

> diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
> index cf4c18f0c25a..52758b546d40 100644
> --- a/drivers/pci/controller/pcie-mediatek.c
> +++ b/drivers/pci/controller/pcie-mediatek.c
> @@ -151,6 +151,7 @@ struct mtk_pcie_port;
>  struct mtk_pcie_soc {
>  	bool need_fix_class_id;
>  	bool need_fix_device_id;
> +	bool no_msi;
>  	unsigned int device_id;
>  	struct pci_ops *ops;
>  	int (*startup)(struct mtk_pcie_port *port);
> @@ -435,6 +436,9 @@ static int mtk_pcie_irq_domain_alloc(struct irq_domain *domain, unsigned int vir
>  	struct mtk_pcie_port *port = domain->host_data;
>  	unsigned long bit;
>  
> +	if (port->pcie->soc->no_msi)
> +		return -ENOSPC;
> +
>  	WARN_ON(nr_irqs != 1);
>  	mutex_lock(&port->lock);
>  
> @@ -966,11 +970,13 @@ static int mtk_pcie_parse_port(struct mtk_pcie *pcie,
>  	port->slot = slot;
>  	port->pcie = pcie;
>  
> -	if (pcie->soc->setup_irq) {
> +	if (pcie->soc->setup_irq)
>  		err = pcie->soc->setup_irq(port, node);
> -		if (err)
> -			return err;
> -	}
> +	else
> +		err = mtk_pcie_allocate_msi_domains(port);
> +
> +	if (err)
> +		return err;
>  
>  	INIT_LIST_HEAD(&port->list);
>  	list_add_tail(&port->list, &pcie->ports);
> @@ -1173,6 +1179,7 @@ static const struct dev_pm_ops mtk_pcie_pm_ops = {
>  };
>  
>  static const struct mtk_pcie_soc mtk_pcie_soc_v1 = {
> +	.no_msi = true,
>  	.ops = &mtk_pcie_ops,
>  	.startup = mtk_pcie_startup_port,
>  };
> 


  parent reply	other threads:[~2020-11-01 17:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 14:03 [PATCH] pci: mediatek: fix warning in msi.h Frank Wunderlich
2020-10-31 21:49 ` Thomas Gleixner
2020-11-01  9:25   ` Frank Wunderlich
2020-11-01 11:17     ` Thomas Gleixner
2020-11-01 11:43     ` Marc Zyngier
2020-11-01 15:58       ` Aw: " Frank Wunderlich
2020-11-01 17:54       ` Ryder Lee [this message]
2020-11-01 18:27         ` Frank Wunderlich
2020-11-01 21:47           ` Marc Zyngier
2020-11-01 22:27             ` Thomas Gleixner
2020-11-02 11:30               ` Marc Zyngier
2020-11-02 11:56                 ` Aw: " Frank Wunderlich
2020-11-02 13:58                   ` Marc Zyngier
2020-11-02 14:27                     ` Aw: " Frank Wunderlich
2020-11-02 16:16                 ` Aw: " Thomas Gleixner
2020-11-02 22:18                   ` Thomas Gleixner
2020-11-03  9:54                     ` Marc Zyngier
2020-11-03 10:16                       ` Thomas Gleixner
2020-11-03 10:29                         ` Marc Zyngier
2020-11-04 16:49                         ` Aw: " Frank Wunderlich
2020-11-04 23:14                           ` Thomas Gleixner
2020-11-05  9:20                             ` Marc Zyngier
2020-11-05 13:59                               ` Aw: " Frank Wunderlich
2020-11-05 23:00                               ` Aw: " Thomas Gleixner
2020-11-06  9:43                                 ` Marc Zyngier
2020-11-21 16:12                                   ` Aw: " Frank Wunderlich
2021-01-03 13:08                                     ` Frank Wunderlich
2021-02-02 16:21                                   ` Frank Wunderlich
2020-11-03 10:31                       ` Aw: " Thomas Gleixner
2020-11-03 11:41                         ` Marc Zyngier
2020-11-03 14:23                           ` Thomas Gleixner

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=1604253261.22363.0.camel@mtkswgap22 \
    --to=ryder.lee@mediatek.com \
    --cc=bhelgaas@google.com \
    --cc=frank-w@public-files.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@fw-web.de \
    --cc=matthias.bgg@gmail.com \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /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).