From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Stach Subject: Re: [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip Date: Mon, 15 Sep 2014 16:42:34 +0200 Message-ID: <1410792154.3314.7.camel@pengutronix.de> References: <1409911806-10519-1-git-send-email-wangyijing@huawei.com> <1409911806-10519-6-git-send-email-wangyijing@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1409911806-10519-6-git-send-email-wangyijing@huawei.com> Sender: linux-pci-owner@vger.kernel.org List-Archive: List-Post: To: Yijing Wang Cc: Bjorn Helgaas , Xinwei Hu , Wuyun , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , linux-arch@vger.kernel.org, arnab.basu@freescale.com, Bharat.Bhushan@freescale.com, x86@kernel.org, Arnd Bergmann , Thomas Gleixner , Konrad Rzeszutek Wilk , xen-devel@lists.xenproject.org, Joerg Roedel , iommu@lists.linux-foundation.org, linux-mips@linux-mips.org, Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Sebastian Ott , Tony Luck , linux-ia64@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Chris Metcalf List-ID: Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: > Introduce weak arch_find_msi_chip() to find the match msi_chip. > Currently, MSI chip associates pci bus to msi_chip. Because in > ARM platform, there may be more than one MSI controller in system. > Associate pci bus to msi_chip help pci device to find the match > msi_chip and setup MSI/MSI-X irq correctly. But in other platform, > like in x86. we only need one MSI chip, because all device use > the same MSI address/data and irq etc. So it's no need to associate > pci bus to MSI chip, just use a arch function, arch_find_msi_chip() > to return the MSI chip for simplicity. The default weak > arch_find_msi_chip() used in ARM platform, find the MSI chip > by pci bus. > Hm, while one weak function sounds much better than the plethora we have now, I wonder how much work it would be to associate the msi_chip with the pci bus on other arches the same way as done on ARM. This way we could kill this calling into arch specific functions which would make things a bit clearer to follow I think. Regards, Lucas > Signed-off-by: Yijing Wang > --- > drivers/pci/msi.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index a77e7f7..539c11d 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -29,9 +29,14 @@ static int pci_msi_enable = 1; > > /* Arch hooks */ > > +struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev) > +{ > + return dev->bus->msi; > +} > + > int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) > { > - struct msi_chip *chip = dev->bus->msi; > + struct msi_chip *chip = arch_find_msi_chip(dev); > int err; > > if (!chip || !chip->setup_irq) -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <1410792154.3314.7.camel@pengutronix.de> Subject: Re: [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip From: Lucas Stach To: Yijing Wang Cc: Bjorn Helgaas , Xinwei Hu , Wuyun , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , linux-arch@vger.kernel.org, arnab.basu@freescale.com, Bharat.Bhushan@freescale.com, x86@kernel.org, Arnd Bergmann , Thomas Gleixner , Konrad Rzeszutek Wilk , xen-devel@lists.xenproject.org, Joerg Roedel , iommu@lists.linux-foundation.org, linux-mips@linux-mips.org, Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Sebastian Ott , Tony Luck , linux-ia64@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Chris Metcalf , Ralf Baechle Date: Mon, 15 Sep 2014 16:42:34 +0200 In-Reply-To: <1409911806-10519-6-git-send-email-wangyijing@huawei.com> References: <1409911806-10519-1-git-send-email-wangyijing@huawei.com> <1409911806-10519-6-git-send-email-wangyijing@huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Sender: linux-arch-owner@vger.kernel.org List-ID: Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: > Introduce weak arch_find_msi_chip() to find the match msi_chip. > Currently, MSI chip associates pci bus to msi_chip. Because in > ARM platform, there may be more than one MSI controller in system. > Associate pci bus to msi_chip help pci device to find the match > msi_chip and setup MSI/MSI-X irq correctly. But in other platform, > like in x86. we only need one MSI chip, because all device use > the same MSI address/data and irq etc. So it's no need to associate > pci bus to MSI chip, just use a arch function, arch_find_msi_chip() > to return the MSI chip for simplicity. The default weak > arch_find_msi_chip() used in ARM platform, find the MSI chip > by pci bus. > Hm, while one weak function sounds much better than the plethora we have now, I wonder how much work it would be to associate the msi_chip with the pci bus on other arches the same way as done on ARM. This way we could kill this calling into arch specific functions which would make things a bit clearer to follow I think. Regards, Lucas > Signed-off-by: Yijing Wang > --- > drivers/pci/msi.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index a77e7f7..539c11d 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -29,9 +29,14 @@ static int pci_msi_enable = 1; > > /* Arch hooks */ > > +struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev) > +{ > + return dev->bus->msi; > +} > + > int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) > { > - struct msi_chip *chip = dev->bus->msi; > + struct msi_chip *chip = arch_find_msi_chip(dev); > int err; > > if (!chip || !chip->setup_irq) -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Stach Date: Mon, 15 Sep 2014 14:42:34 +0000 Subject: Re: [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip Message-Id: <1410792154.3314.7.camel@pengutronix.de> List-Id: References: <1409911806-10519-1-git-send-email-wangyijing@huawei.com> <1409911806-10519-6-git-send-email-wangyijing@huawei.com> In-Reply-To: <1409911806-10519-6-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Yijing Wang Cc: Bjorn Helgaas , Xinwei Hu , Wuyun , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , linux-arch@vger.kernel.org, arnab.basu@freescale.com, Bharat.Bhushan@freescale.com, x86@kernel.org, Arnd Bergmann , Thomas Gleixner , Konrad Rzeszutek Wilk , xen-devel@lists.xenproject.org, Joerg Roedel , iommu@lists.linux-foundation.org, linux-mips@linux-mips.org, Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Sebastian Ott , Tony Luck , linux-ia64@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Chris Metcalf Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: > Introduce weak arch_find_msi_chip() to find the match msi_chip. > Currently, MSI chip associates pci bus to msi_chip. Because in > ARM platform, there may be more than one MSI controller in system. > Associate pci bus to msi_chip help pci device to find the match > msi_chip and setup MSI/MSI-X irq correctly. But in other platform, > like in x86. we only need one MSI chip, because all device use > the same MSI address/data and irq etc. So it's no need to associate > pci bus to MSI chip, just use a arch function, arch_find_msi_chip() > to return the MSI chip for simplicity. The default weak > arch_find_msi_chip() used in ARM platform, find the MSI chip > by pci bus. > Hm, while one weak function sounds much better than the plethora we have now, I wonder how much work it would be to associate the msi_chip with the pci bus on other arches the same way as done on ARM. This way we could kill this calling into arch specific functions which would make things a bit clearer to follow I think. Regards, Lucas > Signed-off-by: Yijing Wang > --- > drivers/pci/msi.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index a77e7f7..539c11d 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -29,9 +29,14 @@ static int pci_msi_enable = 1; > > /* Arch hooks */ > > +struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev) > +{ > + return dev->bus->msi; > +} > + > int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) > { > - struct msi_chip *chip = dev->bus->msi; > + struct msi_chip *chip = arch_find_msi_chip(dev); > int err; > > if (!chip || !chip->setup_irq) -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from metis.ext.pengutronix.de (unknown [IPv6:2001:6f8:1178:4:290:27ff:fe1d:cc33]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 2DE681A0027 for ; Tue, 16 Sep 2014 00:43:32 +1000 (EST) Message-ID: <1410792154.3314.7.camel@pengutronix.de> Subject: Re: [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip From: Lucas Stach To: Yijing Wang Date: Mon, 15 Sep 2014 16:42:34 +0200 In-Reply-To: <1409911806-10519-6-git-send-email-wangyijing@huawei.com> References: <1409911806-10519-1-git-send-email-wangyijing@huawei.com> <1409911806-10519-6-git-send-email-wangyijing@huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org, Bharat.Bhushan@freescale.com, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Russell King , Joerg Roedel , x86@kernel.org, Sebastian Ott , xen-devel@lists.xenproject.org, arnab.basu@freescale.com, Arnd Bergmann , Konrad Rzeszutek Wilk , Chris Metcalf , Bjorn Helgaas , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Xinwei Hu , Tony Luck , Ralf Baechle , iommu@lists.linux-foundation.org, Wuyun , linuxppc-dev@lists.ozlabs.org, "David S. Miller" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: > Introduce weak arch_find_msi_chip() to find the match msi_chip. > Currently, MSI chip associates pci bus to msi_chip. Because in > ARM platform, there may be more than one MSI controller in system. > Associate pci bus to msi_chip help pci device to find the match > msi_chip and setup MSI/MSI-X irq correctly. But in other platform, > like in x86. we only need one MSI chip, because all device use > the same MSI address/data and irq etc. So it's no need to associate > pci bus to MSI chip, just use a arch function, arch_find_msi_chip() > to return the MSI chip for simplicity. The default weak > arch_find_msi_chip() used in ARM platform, find the MSI chip > by pci bus. > Hm, while one weak function sounds much better than the plethora we have now, I wonder how much work it would be to associate the msi_chip with the pci bus on other arches the same way as done on ARM. This way we could kill this calling into arch specific functions which would make things a bit clearer to follow I think. Regards, Lucas > Signed-off-by: Yijing Wang > --- > drivers/pci/msi.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index a77e7f7..539c11d 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -29,9 +29,14 @@ static int pci_msi_enable = 1; > > /* Arch hooks */ > > +struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev) > +{ > + return dev->bus->msi; > +} > + > int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) > { > - struct msi_chip *chip = dev->bus->msi; > + struct msi_chip *chip = arch_find_msi_chip(dev); > int err; > > if (!chip || !chip->setup_irq) -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | From mboxrd@z Thu Jan 1 00:00:00 1970 From: l.stach@pengutronix.de (Lucas Stach) Date: Mon, 15 Sep 2014 16:42:34 +0200 Subject: [PATCH v1 05/21] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip In-Reply-To: <1409911806-10519-6-git-send-email-wangyijing@huawei.com> References: <1409911806-10519-1-git-send-email-wangyijing@huawei.com> <1409911806-10519-6-git-send-email-wangyijing@huawei.com> Message-ID: <1410792154.3314.7.camel@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang: > Introduce weak arch_find_msi_chip() to find the match msi_chip. > Currently, MSI chip associates pci bus to msi_chip. Because in > ARM platform, there may be more than one MSI controller in system. > Associate pci bus to msi_chip help pci device to find the match > msi_chip and setup MSI/MSI-X irq correctly. But in other platform, > like in x86. we only need one MSI chip, because all device use > the same MSI address/data and irq etc. So it's no need to associate > pci bus to MSI chip, just use a arch function, arch_find_msi_chip() > to return the MSI chip for simplicity. The default weak > arch_find_msi_chip() used in ARM platform, find the MSI chip > by pci bus. > Hm, while one weak function sounds much better than the plethora we have now, I wonder how much work it would be to associate the msi_chip with the pci bus on other arches the same way as done on ARM. This way we could kill this calling into arch specific functions which would make things a bit clearer to follow I think. Regards, Lucas > Signed-off-by: Yijing Wang > --- > drivers/pci/msi.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index a77e7f7..539c11d 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -29,9 +29,14 @@ static int pci_msi_enable = 1; > > /* Arch hooks */ > > +struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev) > +{ > + return dev->bus->msi; > +} > + > int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) > { > - struct msi_chip *chip = dev->bus->msi; > + struct msi_chip *chip = arch_find_msi_chip(dev); > int err; > > if (!chip || !chip->setup_irq) -- Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |