From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754040AbaIZIJe (ORCPT ); Fri, 26 Sep 2014 04:09:34 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:38468 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753922AbaIZIJ0 (ORCPT ); Fri, 26 Sep 2014 04:09:26 -0400 Date: Fri, 26 Sep 2014 10:09:22 +0200 From: Thierry Reding To: Yijing Wang Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Xinwei Hu , Wuyun , 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 , Lucas Stach , David Vrabel , Sergei Shtylyov , Michael Ellerman , Thomas Petazzoni Subject: Re: [PATCH v2 03/22] MSI: Remove the redundant irq_set_chip_data() Message-ID: <20140926080921.GE31106@ulmo> References: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> <1411614872-4009-4-git-send-email-wangyijing@huawei.com> <20140925071919.GH12423@ulmo> <5424C9BD.3040506@huawei.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2qXFWqzzG3v1+95a" Content-Disposition: inline In-Reply-To: <5424C9BD.3040506@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --2qXFWqzzG3v1+95a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2014 at 10:04:45AM +0800, Yijing Wang wrote: > On 2014/9/25 15:19, Thierry Reding wrote: > > On Thu, Sep 25, 2014 at 11:14:13AM +0800, Yijing Wang wrote: > >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers > >> use irq chip_data to save the msi_chip pointer. They > >> already call irq_set_chip_data() in their own MSI irq map > >> functions. So irq_set_chip_data() in arch_setup_msi_irq() > >> is useless. > >=20 > > Again, I think this should be the other way around. If drivers do > > something that's already handled by the core, then the duplicate code > > should be dropped from the drivers. >=20 > Hi Thierry, this is different thing, because chip_data is specific to IRQ > controller, and in other platform, like in x86, chip_data is used to save= irq_cfg. > So we can not call irq_set_chip_data() in core code. >=20 > x86 irq piece code >=20 > int arch_setup_hwirq(unsigned int irq, int node) > { > struct irq_cfg *cfg; > unsigned long flags; > int ret; >=20 > cfg =3D alloc_irq_cfg(irq, node); > if (!cfg) > return -ENOMEM; >=20 > raw_spin_lock_irqsave(&vector_lock, flags); > ret =3D __assign_irq_vector(irq, cfg, apic->target_cpus()); > raw_spin_unlock_irqrestore(&vector_lock, flags); >=20 > if (!ret) > irq_set_chip_data(irq, cfg); ------------->Save irq_cfg > else > free_irq_cfg(irq, cfg); > return ret; > } Okay, makes sense to keep irq_set_chip_data() for driver-specific data then. Thierry --2qXFWqzzG3v1+95a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUJR8xAAoJEN0jrNd/PrOhmZMP/0tFUjT9MXPrTuCEiBWtia+2 ElYucD565UV4FjK6aINM4dHtmn0wUW+dDXB2YDSkAp10Ku534Tfi0zNfQd/xSe6M SLBNIW/EK67YANcL5AvN2W1wSUn/t24SBwWJIvsoZfNJbsAcETvYySMnmLZJ2L05 k1v9mR+KAR52QhCs9nwga/dePFV/DBQ2bFrblq6Rxu/+hxki9EqgM9JtkRXS0F7d DU1BqMERPy9AtP+oX5Wih6+8P15JALo4n/SETOfeeToDkhN2Zbh8Y3AoAmVAL1l1 ym3t6fPW7CFvJIX+Qpt02+wVvFu1amMpY8mXfzQmi18VccvTqQ9ylkaaVQ+ZsK/a M/8qEyiKUc4T8obwUr8qb484vw7QxAlFynvU5A6AX1zlHU+yUVEklTBlVY9Av5jj EW6MzXAPrhro6KKqu3m8h+P0O72K+oSZOT5bPri9/MfRfW3JCzMsCNIjeGXZ50fr Komek7HKSPDIaIoavV7Fym7j9zddKbLvAj8DfkztLT7jmQ7i8EVb6eHwy8uMDXI7 cds9cH4RKRvE3ArNaHaOyEomxAD1fyAsQ3SPM2vuf92pJtiwoXpGc5qgrRusMjHw ZfggWh7lVNYq9TP1fXQalqNmFvATMz3s1HW7lCsIf8AeuNvDkAm3pQRojX1vKPvc uRsheVegzi0JliNoFkzC =m1fq -----END PGP SIGNATURE----- --2qXFWqzzG3v1+95a-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH v2 03/22] MSI: Remove the redundant irq_set_chip_data() Date: Fri, 26 Sep 2014 10:09:22 +0200 Message-ID: <20140926080921.GE31106@ulmo> References: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> <1411614872-4009-4-git-send-email-wangyijing@huawei.com> <20140925071919.GH12423@ulmo> <5424C9BD.3040506@huawei.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0355141641407555745==" Return-path: In-Reply-To: <5424C9BD.3040506-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Yijing Wang Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Russell King , Michael Ellerman , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Sebastian Ott , Benjamin Herrenschmidt , xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org, arnab.basu-KZfg59tc24xl57MIdRCFDg@public.gmane.org, Arnd Bergmann , Chris Metcalf , Bjorn Helgaas , Thomas Gleixner , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Thomas Petazzoni , Xinwei Hu , Tony Luck , Sergei Shtylyov , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ralf Baechle , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, David List-Id: linux-arch.vger.kernel.org --===============0355141641407555745== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2qXFWqzzG3v1+95a" Content-Disposition: inline --2qXFWqzzG3v1+95a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2014 at 10:04:45AM +0800, Yijing Wang wrote: > On 2014/9/25 15:19, Thierry Reding wrote: > > On Thu, Sep 25, 2014 at 11:14:13AM +0800, Yijing Wang wrote: > >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers > >> use irq chip_data to save the msi_chip pointer. They > >> already call irq_set_chip_data() in their own MSI irq map > >> functions. So irq_set_chip_data() in arch_setup_msi_irq() > >> is useless. > >=20 > > Again, I think this should be the other way around. If drivers do > > something that's already handled by the core, then the duplicate code > > should be dropped from the drivers. >=20 > Hi Thierry, this is different thing, because chip_data is specific to IRQ > controller, and in other platform, like in x86, chip_data is used to save= irq_cfg. > So we can not call irq_set_chip_data() in core code. >=20 > x86 irq piece code >=20 > int arch_setup_hwirq(unsigned int irq, int node) > { > struct irq_cfg *cfg; > unsigned long flags; > int ret; >=20 > cfg =3D alloc_irq_cfg(irq, node); > if (!cfg) > return -ENOMEM; >=20 > raw_spin_lock_irqsave(&vector_lock, flags); > ret =3D __assign_irq_vector(irq, cfg, apic->target_cpus()); > raw_spin_unlock_irqrestore(&vector_lock, flags); >=20 > if (!ret) > irq_set_chip_data(irq, cfg); ------------->Save irq_cfg > else > free_irq_cfg(irq, cfg); > return ret; > } Okay, makes sense to keep irq_set_chip_data() for driver-specific data then. Thierry --2qXFWqzzG3v1+95a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUJR8xAAoJEN0jrNd/PrOhmZMP/0tFUjT9MXPrTuCEiBWtia+2 ElYucD565UV4FjK6aINM4dHtmn0wUW+dDXB2YDSkAp10Ku534Tfi0zNfQd/xSe6M SLBNIW/EK67YANcL5AvN2W1wSUn/t24SBwWJIvsoZfNJbsAcETvYySMnmLZJ2L05 k1v9mR+KAR52QhCs9nwga/dePFV/DBQ2bFrblq6Rxu/+hxki9EqgM9JtkRXS0F7d DU1BqMERPy9AtP+oX5Wih6+8P15JALo4n/SETOfeeToDkhN2Zbh8Y3AoAmVAL1l1 ym3t6fPW7CFvJIX+Qpt02+wVvFu1amMpY8mXfzQmi18VccvTqQ9ylkaaVQ+ZsK/a M/8qEyiKUc4T8obwUr8qb484vw7QxAlFynvU5A6AX1zlHU+yUVEklTBlVY9Av5jj EW6MzXAPrhro6KKqu3m8h+P0O72K+oSZOT5bPri9/MfRfW3JCzMsCNIjeGXZ50fr Komek7HKSPDIaIoavV7Fym7j9zddKbLvAj8DfkztLT7jmQ7i8EVb6eHwy8uMDXI7 cds9cH4RKRvE3ArNaHaOyEomxAD1fyAsQ3SPM2vuf92pJtiwoXpGc5qgrRusMjHw ZfggWh7lVNYq9TP1fXQalqNmFvATMz3s1HW7lCsIf8AeuNvDkAm3pQRojX1vKPvc uRsheVegzi0JliNoFkzC =m1fq -----END PGP SIGNATURE----- --2qXFWqzzG3v1+95a-- --===============0355141641407555745== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============0355141641407555745==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Date: Fri, 26 Sep 2014 08:09:22 +0000 Subject: Re: [PATCH v2 03/22] MSI: Remove the redundant irq_set_chip_data() Message-Id: <20140926080921.GE31106@ulmo> MIME-Version: 1 Content-Type: multipart/mixed; boundary="2qXFWqzzG3v1+95a" List-Id: References: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> <1411614872-4009-4-git-send-email-wangyijing@huawei.com> <20140925071919.GH12423@ulmo> <5424C9BD.3040506@huawei.com> In-Reply-To: <5424C9BD.3040506-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> To: Yijing Wang Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Russell King , Michael Ellerman , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Sebastian Ott , Benjamin Herrenschmidt , xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org, arnab.basu-KZfg59tc24xl57MIdRCFDg@public.gmane.org, Arnd Bergmann , Chris Metcalf , Bjorn Helgaas , Thomas Gleixner , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Thomas Petazzoni , Xinwei Hu , Tony Luck , Sergei Shtylyov , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ralf Baechle , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, David --2qXFWqzzG3v1+95a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2014 at 10:04:45AM +0800, Yijing Wang wrote: > On 2014/9/25 15:19, Thierry Reding wrote: > > On Thu, Sep 25, 2014 at 11:14:13AM +0800, Yijing Wang wrote: > >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers > >> use irq chip_data to save the msi_chip pointer. They > >> already call irq_set_chip_data() in their own MSI irq map > >> functions. So irq_set_chip_data() in arch_setup_msi_irq() > >> is useless. > >=20 > > Again, I think this should be the other way around. If drivers do > > something that's already handled by the core, then the duplicate code > > should be dropped from the drivers. >=20 > Hi Thierry, this is different thing, because chip_data is specific to IRQ > controller, and in other platform, like in x86, chip_data is used to save= irq_cfg. > So we can not call irq_set_chip_data() in core code. >=20 > x86 irq piece code >=20 > int arch_setup_hwirq(unsigned int irq, int node) > { > struct irq_cfg *cfg; > unsigned long flags; > int ret; >=20 > cfg =3D alloc_irq_cfg(irq, node); > if (!cfg) > return -ENOMEM; >=20 > raw_spin_lock_irqsave(&vector_lock, flags); > ret =3D __assign_irq_vector(irq, cfg, apic->target_cpus()); > raw_spin_unlock_irqrestore(&vector_lock, flags); >=20 > if (!ret) > irq_set_chip_data(irq, cfg); ------------->Save irq_cfg > else > free_irq_cfg(irq, cfg); > return ret; > } Okay, makes sense to keep irq_set_chip_data() for driver-specific data then. Thierry --2qXFWqzzG3v1+95a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUJR8xAAoJEN0jrNd/PrOhmZMP/0tFUjT9MXPrTuCEiBWtia+2 ElYucD565UV4FjK6aINM4dHtmn0wUW+dDXB2YDSkAp10Ku534Tfi0zNfQd/xSe6M SLBNIW/EK67YANcL5AvN2W1wSUn/t24SBwWJIvsoZfNJbsAcETvYySMnmLZJ2L05 k1v9mR+KAR52QhCs9nwga/dePFV/DBQ2bFrblq6Rxu/+hxki9EqgM9JtkRXS0F7d DU1BqMERPy9AtP+oX5Wih6+8P15JALo4n/SETOfeeToDkhN2Zbh8Y3AoAmVAL1l1 ym3t6fPW7CFvJIX+Qpt02+wVvFu1amMpY8mXfzQmi18VccvTqQ9ylkaaVQ+ZsK/a M/8qEyiKUc4T8obwUr8qb484vw7QxAlFynvU5A6AX1zlHU+yUVEklTBlVY9Av5jj EW6MzXAPrhro6KKqu3m8h+P0O72K+oSZOT5bPri9/MfRfW3JCzMsCNIjeGXZ50fr Komek7HKSPDIaIoavV7Fym7j9zddKbLvAj8DfkztLT7jmQ7i8EVb6eHwy8uMDXI7 cds9cH4RKRvE3ArNaHaOyEomxAD1fyAsQ3SPM2vuf92pJtiwoXpGc5qgrRusMjHw ZfggWh7lVNYq9TP1fXQalqNmFvATMz3s1HW7lCsIf8AeuNvDkAm3pQRojX1vKPvc uRsheVegzi0JliNoFkzC =m1fq -----END PGP SIGNATURE----- --2qXFWqzzG3v1+95a-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com [IPv6:2a00:1450:400c:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 38B0E1A0003 for ; Fri, 26 Sep 2014 18:09:27 +1000 (EST) Received: by mail-wg0-f48.google.com with SMTP id x13so5970547wgg.31 for ; Fri, 26 Sep 2014 01:09:24 -0700 (PDT) Date: Fri, 26 Sep 2014 10:09:22 +0200 From: Thierry Reding To: Yijing Wang Subject: Re: [PATCH v2 03/22] MSI: Remove the redundant irq_set_chip_data() Message-ID: <20140926080921.GE31106@ulmo> References: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> <1411614872-4009-4-git-send-email-wangyijing@huawei.com> <20140925071919.GH12423@ulmo> <5424C9BD.3040506@huawei.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2qXFWqzzG3v1+95a" In-Reply-To: <5424C9BD.3040506@huawei.com> 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, Thomas Petazzoni , Xinwei Hu , Tony Luck , Sergei Shtylyov , linux-kernel@vger.kernel.org, Ralf Baechle , iommu@lists.linux-foundation.org, David Vrabel , Wuyun , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , Lucas Stach List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , --2qXFWqzzG3v1+95a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2014 at 10:04:45AM +0800, Yijing Wang wrote: > On 2014/9/25 15:19, Thierry Reding wrote: > > On Thu, Sep 25, 2014 at 11:14:13AM +0800, Yijing Wang wrote: > >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers > >> use irq chip_data to save the msi_chip pointer. They > >> already call irq_set_chip_data() in their own MSI irq map > >> functions. So irq_set_chip_data() in arch_setup_msi_irq() > >> is useless. > >=20 > > Again, I think this should be the other way around. If drivers do > > something that's already handled by the core, then the duplicate code > > should be dropped from the drivers. >=20 > Hi Thierry, this is different thing, because chip_data is specific to IRQ > controller, and in other platform, like in x86, chip_data is used to save= irq_cfg. > So we can not call irq_set_chip_data() in core code. >=20 > x86 irq piece code >=20 > int arch_setup_hwirq(unsigned int irq, int node) > { > struct irq_cfg *cfg; > unsigned long flags; > int ret; >=20 > cfg =3D alloc_irq_cfg(irq, node); > if (!cfg) > return -ENOMEM; >=20 > raw_spin_lock_irqsave(&vector_lock, flags); > ret =3D __assign_irq_vector(irq, cfg, apic->target_cpus()); > raw_spin_unlock_irqrestore(&vector_lock, flags); >=20 > if (!ret) > irq_set_chip_data(irq, cfg); ------------->Save irq_cfg > else > free_irq_cfg(irq, cfg); > return ret; > } Okay, makes sense to keep irq_set_chip_data() for driver-specific data then. Thierry --2qXFWqzzG3v1+95a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUJR8xAAoJEN0jrNd/PrOhmZMP/0tFUjT9MXPrTuCEiBWtia+2 ElYucD565UV4FjK6aINM4dHtmn0wUW+dDXB2YDSkAp10Ku534Tfi0zNfQd/xSe6M SLBNIW/EK67YANcL5AvN2W1wSUn/t24SBwWJIvsoZfNJbsAcETvYySMnmLZJ2L05 k1v9mR+KAR52QhCs9nwga/dePFV/DBQ2bFrblq6Rxu/+hxki9EqgM9JtkRXS0F7d DU1BqMERPy9AtP+oX5Wih6+8P15JALo4n/SETOfeeToDkhN2Zbh8Y3AoAmVAL1l1 ym3t6fPW7CFvJIX+Qpt02+wVvFu1amMpY8mXfzQmi18VccvTqQ9ylkaaVQ+ZsK/a M/8qEyiKUc4T8obwUr8qb484vw7QxAlFynvU5A6AX1zlHU+yUVEklTBlVY9Av5jj EW6MzXAPrhro6KKqu3m8h+P0O72K+oSZOT5bPri9/MfRfW3JCzMsCNIjeGXZ50fr Komek7HKSPDIaIoavV7Fym7j9zddKbLvAj8DfkztLT7jmQ7i8EVb6eHwy8uMDXI7 cds9cH4RKRvE3ArNaHaOyEomxAD1fyAsQ3SPM2vuf92pJtiwoXpGc5qgrRusMjHw ZfggWh7lVNYq9TP1fXQalqNmFvATMz3s1HW7lCsIf8AeuNvDkAm3pQRojX1vKPvc uRsheVegzi0JliNoFkzC =m1fq -----END PGP SIGNATURE----- --2qXFWqzzG3v1+95a-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: thierry.reding@gmail.com (Thierry Reding) Date: Fri, 26 Sep 2014 10:09:22 +0200 Subject: [PATCH v2 03/22] MSI: Remove the redundant irq_set_chip_data() In-Reply-To: <5424C9BD.3040506@huawei.com> References: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> <1411614872-4009-4-git-send-email-wangyijing@huawei.com> <20140925071919.GH12423@ulmo> <5424C9BD.3040506@huawei.com> Message-ID: <20140926080921.GE31106@ulmo> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Sep 26, 2014 at 10:04:45AM +0800, Yijing Wang wrote: > On 2014/9/25 15:19, Thierry Reding wrote: > > On Thu, Sep 25, 2014 at 11:14:13AM +0800, Yijing Wang wrote: > >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers > >> use irq chip_data to save the msi_chip pointer. They > >> already call irq_set_chip_data() in their own MSI irq map > >> functions. So irq_set_chip_data() in arch_setup_msi_irq() > >> is useless. > > > > Again, I think this should be the other way around. If drivers do > > something that's already handled by the core, then the duplicate code > > should be dropped from the drivers. > > Hi Thierry, this is different thing, because chip_data is specific to IRQ > controller, and in other platform, like in x86, chip_data is used to save irq_cfg. > So we can not call irq_set_chip_data() in core code. > > x86 irq piece code > > int arch_setup_hwirq(unsigned int irq, int node) > { > struct irq_cfg *cfg; > unsigned long flags; > int ret; > > cfg = alloc_irq_cfg(irq, node); > if (!cfg) > return -ENOMEM; > > raw_spin_lock_irqsave(&vector_lock, flags); > ret = __assign_irq_vector(irq, cfg, apic->target_cpus()); > raw_spin_unlock_irqrestore(&vector_lock, flags); > > if (!ret) > irq_set_chip_data(irq, cfg); ------------->Save irq_cfg > else > free_irq_cfg(irq, cfg); > return ret; > } Okay, makes sense to keep irq_set_chip_data() for driver-specific data then. Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Date: Fri, 26 Sep 2014 08:09:22 +0000 Subject: Re: [PATCH v2 03/22] MSI: Remove the redundant irq_set_chip_data() Message-Id: <20140926080921.GE31106@ulmo> MIME-Version: 1 Content-Type: multipart/mixed; boundary="2qXFWqzzG3v1+95a" List-Id: References: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> <1411614872-4009-4-git-send-email-wangyijing@huawei.com> <20140925071919.GH12423@ulmo> <5424C9BD.3040506@huawei.com> In-Reply-To: <5424C9BD.3040506@huawei.com> To: Yijing Wang Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Xinwei Hu , Wuyun , 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 , Lucas Stach , David Vrabel , Sergei Shtylyov , Michael Ellerman , Thomas Petazzoni --2qXFWqzzG3v1+95a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2014 at 10:04:45AM +0800, Yijing Wang wrote: > On 2014/9/25 15:19, Thierry Reding wrote: > > On Thu, Sep 25, 2014 at 11:14:13AM +0800, Yijing Wang wrote: > >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers > >> use irq chip_data to save the msi_chip pointer. They > >> already call irq_set_chip_data() in their own MSI irq map > >> functions. So irq_set_chip_data() in arch_setup_msi_irq() > >> is useless. > >=20 > > Again, I think this should be the other way around. If drivers do > > something that's already handled by the core, then the duplicate code > > should be dropped from the drivers. >=20 > Hi Thierry, this is different thing, because chip_data is specific to IRQ > controller, and in other platform, like in x86, chip_data is used to save= irq_cfg. > So we can not call irq_set_chip_data() in core code. >=20 > x86 irq piece code >=20 > int arch_setup_hwirq(unsigned int irq, int node) > { > struct irq_cfg *cfg; > unsigned long flags; > int ret; >=20 > cfg =3D alloc_irq_cfg(irq, node); > if (!cfg) > return -ENOMEM; >=20 > raw_spin_lock_irqsave(&vector_lock, flags); > ret =3D __assign_irq_vector(irq, cfg, apic->target_cpus()); > raw_spin_unlock_irqrestore(&vector_lock, flags); >=20 > if (!ret) > irq_set_chip_data(irq, cfg); ------------->Save irq_cfg > else > free_irq_cfg(irq, cfg); > return ret; > } Okay, makes sense to keep irq_set_chip_data() for driver-specific data then. Thierry --2qXFWqzzG3v1+95a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUJR8xAAoJEN0jrNd/PrOhmZMP/0tFUjT9MXPrTuCEiBWtia+2 ElYucD565UV4FjK6aINM4dHtmn0wUW+dDXB2YDSkAp10Ku534Tfi0zNfQd/xSe6M SLBNIW/EK67YANcL5AvN2W1wSUn/t24SBwWJIvsoZfNJbsAcETvYySMnmLZJ2L05 k1v9mR+KAR52QhCs9nwga/dePFV/DBQ2bFrblq6Rxu/+hxki9EqgM9JtkRXS0F7d DU1BqMERPy9AtP+oX5Wih6+8P15JALo4n/SETOfeeToDkhN2Zbh8Y3AoAmVAL1l1 ym3t6fPW7CFvJIX+Qpt02+wVvFu1amMpY8mXfzQmi18VccvTqQ9ylkaaVQ+ZsK/a M/8qEyiKUc4T8obwUr8qb484vw7QxAlFynvU5A6AX1zlHU+yUVEklTBlVY9Av5jj EW6MzXAPrhro6KKqu3m8h+P0O72K+oSZOT5bPri9/MfRfW3JCzMsCNIjeGXZ50fr Komek7HKSPDIaIoavV7Fym7j9zddKbLvAj8DfkztLT7jmQ7i8EVb6eHwy8uMDXI7 cds9cH4RKRvE3ArNaHaOyEomxAD1fyAsQ3SPM2vuf92pJtiwoXpGc5qgrRusMjHw ZfggWh7lVNYq9TP1fXQalqNmFvATMz3s1HW7lCsIf8AeuNvDkAm3pQRojX1vKPvc uRsheVegzi0JliNoFkzC =m1fq -----END PGP SIGNATURE----- --2qXFWqzzG3v1+95a--