From: Andrew Murray <andrew.murray@arm.com> To: Denis Efremov <efremov@linux.com> Cc: Bjorn Helgaas <bhelgaas@google.com>, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Sebastian Ott <sebott@linux.ibm.com>, Gerald Schaefer <gerald.schaefer@de.ibm.com>, "H. Peter Anvin" <hpa@zytor.com>, Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@st.com>, Matt Porter <mporter@kernel.crashing.org>, Alexandre Bounine <alex.bou9@gmail.com>, Peter Jones <pjones@redhat.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>, Cornelia Huck <cohuck@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Jose Abreu <Jose.Abreu@synopsys.com>, kvm@vger.kernel.org, linux-fbdev@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH v2 00/10] Add definition for the number of standard PCI BARs Date: Fri, 16 Aug 2019 11:51:28 +0100 [thread overview] Message-ID: <20190816105128.GD14111@e119886-lin.cambridge.arm.com> (raw) In-Reply-To: <20190816092437.31846-1-efremov@linux.com> On Fri, Aug 16, 2019 at 12:24:27PM +0300, Denis Efremov wrote: > Code that iterates over all standard PCI BARs typically uses > PCI_STD_RESOURCE_END, but this is error-prone because it requires > "i <= PCI_STD_RESOURCE_END" rather than something like > "i < PCI_STD_NUM_BARS". We could add such a definition and use it the same > way PCI_SRIOV_NUM_BARS is used. There is already the definition > PCI_BAR_COUNT for s390 only. Thus, this patchset introduces it globally. > > Changes in v2: > - Reverse checks in pci_iomap_range,pci_iomap_wc_range. > - Refactor loops in vfio_pci to keep PCI_STD_RESOURCES. > - Add 2 new patches to replace the magic constant with new define. > - Split net patch in v1 to separate stmmac and dwc-xlgmac patches. > > Denis Efremov (10): > PCI: Add define for the number of standard PCI BARs > s390/pci: Loop using PCI_STD_NUM_BARS > x86/PCI: Loop using PCI_STD_NUM_BARS > stmmac: pci: Loop using PCI_STD_NUM_BARS > net: dwc-xlgmac: Loop using PCI_STD_NUM_BARS > rapidio/tsi721: Loop using PCI_STD_NUM_BARS > efifb: Loop using PCI_STD_NUM_BARS > vfio_pci: Loop using PCI_STD_NUM_BARS > PCI: hv: Use PCI_STD_NUM_BARS > PCI: Use PCI_STD_NUM_BARS > > arch/s390/include/asm/pci.h | 5 +---- > arch/s390/include/asm/pci_clp.h | 6 +++--- > arch/s390/pci/pci.c | 16 ++++++++-------- > arch/s390/pci/pci_clp.c | 6 +++--- > arch/x86/pci/common.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- > drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- > drivers/pci/controller/pci-hyperv.c | 10 +++++----- > drivers/pci/pci.c | 11 ++++++----- > drivers/pci/quirks.c | 4 ++-- > drivers/rapidio/devices/tsi721.c | 2 +- > drivers/vfio/pci/vfio_pci.c | 11 +++++++---- > drivers/vfio/pci/vfio_pci_config.c | 10 ++++++---- > drivers/vfio/pci/vfio_pci_private.h | 4 ++-- > drivers/video/fbdev/efifb.c | 2 +- > include/linux/pci.h | 2 +- > include/uapi/linux/pci_regs.h | 1 + > 17 files changed, 51 insertions(+), 47 deletions(-) I've come across a few more places where this change can be made. There may be multiple instances in the same file, but only the first is shown below: drivers/misc/pci_endpoint_test.c: for (bar = BAR_0; bar <= BAR_5; bar++) { drivers/net/ethernet/intel/e1000/e1000_main.c: for (i = BAR_1; i <= BAR_5; i++) { drivers/net/ethernet/intel/ixgb/ixgb_main.c: for (i = BAR_1; i <= BAR_5; i++) { drivers/pci/controller/dwc/pci-dra7xx.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/controller/dwc/pci-layerscape-ep.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/controller/dwc/pcie-artpec6.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/controller/dwc/pcie-designware-plat.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/endpoint/functions/pci-epf-test.c: for (bar = BAR_0; bar <= BAR_5; bar++) { include/linux/pci-epc.h: u64 bar_fixed_size[BAR_5 + 1]; drivers/scsi/pm8001/pm8001_hwi.c: for (bar = 0; bar < 6; bar++) { drivers/scsi/pm8001/pm8001_init.c: for (bar = 0; bar < 6; bar++) { drivers/ata/sata_nv.c: for (bar = 0; bar < 6; bar++) drivers/video/fbdev/core/fbmem.c: for (idx = 0, bar = 0; bar < PCI_ROM_RESOURCE; bar++) { drivers/staging/gasket/gasket_core.c: for (i = 0; i < GASKET_NUM_BARS; i++) { drivers/tty/serial/8250/8250_pci.c: for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) { <----------- It looks like BARs are often iterated with PCI_NUM_BAR_RESOURCES, there are a load of these too found with: git grep PCI_ROM_RESOURCE | grep "< " I'm happy to share patches if preferred. Thanks, Andrew Murray > > -- > 2.21.0 >
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Murray <andrew.murray@arm.com> To: Denis Efremov <efremov@linux.com> Cc: Bjorn Helgaas <bhelgaas@google.com>, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Sebastian Ott <sebott@linux.ibm.com>, Gerald Schaefer <gerald.schaefer@de.ibm.com>, "H. Peter Anvin" <hpa@zytor.com>, Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@st.com>, Matt Porter <mporter@kernel.crashing.org>, Alexandre Bounine <alex.bou9@gmail.com>, Peter Jones <pjones@redhat.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>, Cornelia Huck <cohuck@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Jose Abreu <Jose.Abreu@synopsys.com>, kvm@vger.kernel.org, linux-fbdev@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH v2 00/10] Add definition for the number of standard PCI BARs Date: Fri, 16 Aug 2019 10:51:28 +0000 [thread overview] Message-ID: <20190816105128.GD14111@e119886-lin.cambridge.arm.com> (raw) In-Reply-To: <20190816092437.31846-1-efremov@linux.com> On Fri, Aug 16, 2019 at 12:24:27PM +0300, Denis Efremov wrote: > Code that iterates over all standard PCI BARs typically uses > PCI_STD_RESOURCE_END, but this is error-prone because it requires > "i <= PCI_STD_RESOURCE_END" rather than something like > "i < PCI_STD_NUM_BARS". We could add such a definition and use it the same > way PCI_SRIOV_NUM_BARS is used. There is already the definition > PCI_BAR_COUNT for s390 only. Thus, this patchset introduces it globally. > > Changes in v2: > - Reverse checks in pci_iomap_range,pci_iomap_wc_range. > - Refactor loops in vfio_pci to keep PCI_STD_RESOURCES. > - Add 2 new patches to replace the magic constant with new define. > - Split net patch in v1 to separate stmmac and dwc-xlgmac patches. > > Denis Efremov (10): > PCI: Add define for the number of standard PCI BARs > s390/pci: Loop using PCI_STD_NUM_BARS > x86/PCI: Loop using PCI_STD_NUM_BARS > stmmac: pci: Loop using PCI_STD_NUM_BARS > net: dwc-xlgmac: Loop using PCI_STD_NUM_BARS > rapidio/tsi721: Loop using PCI_STD_NUM_BARS > efifb: Loop using PCI_STD_NUM_BARS > vfio_pci: Loop using PCI_STD_NUM_BARS > PCI: hv: Use PCI_STD_NUM_BARS > PCI: Use PCI_STD_NUM_BARS > > arch/s390/include/asm/pci.h | 5 +---- > arch/s390/include/asm/pci_clp.h | 6 +++--- > arch/s390/pci/pci.c | 16 ++++++++-------- > arch/s390/pci/pci_clp.c | 6 +++--- > arch/x86/pci/common.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- > drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- > drivers/pci/controller/pci-hyperv.c | 10 +++++----- > drivers/pci/pci.c | 11 ++++++----- > drivers/pci/quirks.c | 4 ++-- > drivers/rapidio/devices/tsi721.c | 2 +- > drivers/vfio/pci/vfio_pci.c | 11 +++++++---- > drivers/vfio/pci/vfio_pci_config.c | 10 ++++++---- > drivers/vfio/pci/vfio_pci_private.h | 4 ++-- > drivers/video/fbdev/efifb.c | 2 +- > include/linux/pci.h | 2 +- > include/uapi/linux/pci_regs.h | 1 + > 17 files changed, 51 insertions(+), 47 deletions(-) I've come across a few more places where this change can be made. There may be multiple instances in the same file, but only the first is shown below: drivers/misc/pci_endpoint_test.c: for (bar = BAR_0; bar <= BAR_5; bar++) { drivers/net/ethernet/intel/e1000/e1000_main.c: for (i = BAR_1; i <= BAR_5; i++) { drivers/net/ethernet/intel/ixgb/ixgb_main.c: for (i = BAR_1; i <= BAR_5; i++) { drivers/pci/controller/dwc/pci-dra7xx.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/controller/dwc/pci-layerscape-ep.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/controller/dwc/pcie-artpec6.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/controller/dwc/pcie-designware-plat.c: for (bar = BAR_0; bar <= BAR_5; bar++) drivers/pci/endpoint/functions/pci-epf-test.c: for (bar = BAR_0; bar <= BAR_5; bar++) { include/linux/pci-epc.h: u64 bar_fixed_size[BAR_5 + 1]; drivers/scsi/pm8001/pm8001_hwi.c: for (bar = 0; bar < 6; bar++) { drivers/scsi/pm8001/pm8001_init.c: for (bar = 0; bar < 6; bar++) { drivers/ata/sata_nv.c: for (bar = 0; bar < 6; bar++) drivers/video/fbdev/core/fbmem.c: for (idx = 0, bar = 0; bar < PCI_ROM_RESOURCE; bar++) { drivers/staging/gasket/gasket_core.c: for (i = 0; i < GASKET_NUM_BARS; i++) { drivers/tty/serial/8250/8250_pci.c: for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) { <----------- It looks like BARs are often iterated with PCI_NUM_BAR_RESOURCES, there are a load of these too found with: git grep PCI_ROM_RESOURCE | grep "< " I'm happy to share patches if preferred. Thanks, Andrew Murray > > -- > 2.21.0 >
next prev parent reply other threads:[~2019-08-16 10:51 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-16 9:24 [PATCH v2 00/10] Add definition for the number of standard PCI BARs Denis Efremov 2019-08-16 9:24 ` Denis Efremov 2019-08-16 9:24 ` [PATCH v2 01/10] PCI: Add define " Denis Efremov 2019-08-16 9:24 ` Denis Efremov 2019-08-16 9:24 ` [PATCH v2 02/10] s390/pci: Loop using PCI_STD_NUM_BARS Denis Efremov 2019-08-16 10:45 ` Sebastian Ott 2019-08-16 9:24 ` [PATCH v2 03/10] x86/PCI: " Denis Efremov 2019-08-16 9:32 ` Thomas Gleixner 2019-08-16 13:31 ` Bjorn Helgaas 2019-08-16 9:24 ` [PATCH v2 04/10] stmmac: pci: " Denis Efremov 2019-08-16 9:24 ` [PATCH v2 05/10] net: dwc-xlgmac: " Denis Efremov 2019-08-16 9:24 ` [PATCH v2 06/10] rapidio/tsi721: " Denis Efremov 2019-08-16 9:24 ` [PATCH v2 07/10] efifb: " Denis Efremov 2019-08-16 9:24 ` Denis Efremov 2019-08-16 9:24 ` [PATCH v2 08/10] vfio_pci: " Denis Efremov 2019-08-16 16:23 ` Alex Williamson 2019-08-16 9:24 ` [PATCH v2 09/10] PCI: hv: Use PCI_STD_NUM_BARS Denis Efremov 2019-08-16 9:24 ` [PATCH v2 10/10] PCI: " Denis Efremov 2019-08-16 10:51 ` Andrew Murray [this message] 2019-08-16 10:51 ` [PATCH v2 00/10] Add definition for the number of standard PCI BARs Andrew Murray 2019-08-16 13:35 ` Bjorn Helgaas 2019-08-16 13:35 ` Bjorn Helgaas 2019-09-05 19:02 ` Denis Efremov 2019-09-05 19:02 ` Denis Efremov
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=20190816105128.GD14111@e119886-lin.cambridge.arm.com \ --to=andrew.murray@arm.com \ --cc=Jose.Abreu@synopsys.com \ --cc=alex.bou9@gmail.com \ --cc=alex.williamson@redhat.com \ --cc=alexandre.torgue@st.com \ --cc=b.zolnierkie@samsung.com \ --cc=bhelgaas@google.com \ --cc=cohuck@redhat.com \ --cc=efremov@linux.com \ --cc=gerald.schaefer@de.ibm.com \ --cc=hpa@zytor.com \ --cc=kvm@vger.kernel.org \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=linux-s390@vger.kernel.org \ --cc=mporter@kernel.crashing.org \ --cc=netdev@vger.kernel.org \ --cc=peppe.cavallaro@st.com \ --cc=pjones@redhat.com \ --cc=sebott@linux.ibm.com \ --cc=x86@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.