Re: [PATCH RESEND v3 00/26] Add definition for the number of standard PCI BARs

2019-09-30 Thread Bjorn Helgaas
On Sat, Sep 28, 2019 at 02:40:26AM +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. The patchset also replaces constant (6)
> with new define PCI_STD_NUM_BARS where appropriate and removes local
> declarations for the number of PCI BARs.
> 
> Changes in v3:
>   - Updated commits description.
>   - Refactored "< PCI_ROM_RESOURCE" with "< PCI_STD_NUM_BARS" in loops.
>   - Refactored "<= BAR_5" with "< PCI_STD_NUM_BARS" in loops.
>   - Removed local define GASKET_NUM_BARS.
>   - Removed local define PCI_NUM_BAR_RESOURCES.
> 
> Changes in v2:
>   - Reversed checks in pci_iomap_range,pci_iomap_wc_range.
>   - Refactored loops in vfio_pci to keep PCI_STD_RESOURCES.
>   - Added 2 new patches to replace the magic constant with new define.
>   - Splitted net patch in v1 to separate stmmac and dwc-xlgmac patches.
> 
> Denis Efremov (26):
>   PCI: Add define for the number of standard PCI BARs
>   PCI: hv: Use PCI_STD_NUM_BARS
>   PCI: dwc: Use PCI_STD_NUM_BARS
>   PCI: endpoint: Use PCI_STD_NUM_BARS
>   misc: pci_endpoint_test: Use PCI_STD_NUM_BARS
>   s390/pci: Use PCI_STD_NUM_BARS
>   x86/PCI: Loop using PCI_STD_NUM_BARS
>   alpha/PCI: Use PCI_STD_NUM_BARS
>   ia64: Use PCI_STD_NUM_BARS
>   stmmac: pci: Loop using PCI_STD_NUM_BARS
>   net: dwc-xlgmac: Loop using PCI_STD_NUM_BARS
>   ixgb: use PCI_STD_NUM_BARS
>   e1000: Use PCI_STD_NUM_BARS
>   rapidio/tsi721: Loop using PCI_STD_NUM_BARS
>   efifb: Loop using PCI_STD_NUM_BARS
>   fbmem: use PCI_STD_NUM_BARS
>   vfio_pci: Loop using PCI_STD_NUM_BARS
>   scsi: pm80xx: Use PCI_STD_NUM_BARS
>   ata: sata_nv: Use PCI_STD_NUM_BARS
>   staging: gasket: Use PCI_STD_NUM_BARS
>   serial: 8250_pci: Use PCI_STD_NUM_BARS
>   pata_atp867x: Use PCI_STD_NUM_BARS
>   memstick: use PCI_STD_NUM_BARS
>   USB: core: Use PCI_STD_NUM_BARS
>   usb: pci-quirks: Use PCI_STD_NUM_BARS
>   devres: use PCI_STD_NUM_BARS
> 
>  arch/alpha/kernel/pci-sysfs.c |  8 ++---
>  arch/ia64/sn/pci/pcibr/pcibr_dma.c|  4 +--
>  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 +-
>  arch/x86/pci/intel_mid_pci.c  |  2 +-
>  drivers/ata/pata_atp867x.c|  2 +-
>  drivers/ata/sata_nv.c |  2 +-
>  drivers/memstick/host/jmb38x_ms.c |  2 +-
>  drivers/misc/pci_endpoint_test.c  |  8 ++---
>  drivers/net/ethernet/intel/e1000/e1000.h  |  1 -
>  drivers/net/ethernet/intel/e1000/e1000_main.c |  2 +-
>  drivers/net/ethernet/intel/ixgb/ixgb.h|  1 -
>  drivers/net/ethernet/intel/ixgb/ixgb_main.c   |  2 +-
>  .../net/ethernet/stmicro/stmmac/stmmac_pci.c  |  4 +--
>  .../net/ethernet/synopsys/dwc-xlgmac-pci.c|  2 +-
>  drivers/pci/controller/dwc/pci-dra7xx.c   |  2 +-
>  .../pci/controller/dwc/pci-layerscape-ep.c|  2 +-
>  drivers/pci/controller/dwc/pcie-artpec6.c |  2 +-
>  .../pci/controller/dwc/pcie-designware-plat.c |  2 +-
>  drivers/pci/controller/dwc/pcie-designware.h  |  2 +-
>  drivers/pci/controller/pci-hyperv.c   | 10 +++---
>  drivers/pci/endpoint/functions/pci-epf-test.c | 10 +++---
>  drivers/pci/pci-sysfs.c   |  4 +--
>  drivers/pci/pci.c | 13 
>  drivers/pci/proc.c|  4 +--
>  drivers/pci/quirks.c  |  4 +--
>  drivers/rapidio/devices/tsi721.c  |  2 +-
>  drivers/scsi/pm8001/pm8001_hwi.c  |  2 +-
>  drivers/scsi/pm8001/pm8001_init.c |  2 +-
>  drivers/staging/gasket/gasket_constants.h |  3 --
>  drivers/staging/gasket/gasket_core.c  | 12 +++
>  drivers/staging/gasket/gasket_core.h  |  4 +--
>  drivers/tty/serial/8250/8250_pci.c|  8 ++---
>  drivers/usb/core/hcd-pci.c|  2 +-
>  drivers/usb/host/pci-quirks.c |  2 +-
>  drivers/vfio/pci/vfio_pci.c   | 11 ---
>  drivers/vfio/pci/vfio_pci_config.c| 32 ++-
>  drivers/vfio/pci/vfio_pci_private.h   |  4 +--
>  drivers/video/fbdev/core/fbmem.c  |  4 +--
>  drivers/video/fbdev/efifb.c   |  2 +-
>  include/linux/pci-epc.h   |  2 +-
>  include/linux/pci.h   |  2 +-
>  include/uapi/linux/pci_regs.h |  1 +
>  lib/devres.c  |  2 +-
>  47 files changed, 112 insertions(+), 115 deletions(-)

Applied to pci/resource for v5.5, thanks!

I 

Re: Some Alphas broken by f75b99d5a77d (PCI: Enforce bus address limits in resource allocation)

2018-04-20 Thread Bjorn Helgaas
On Wed, Apr 18, 2018 at 09:48:08PM +0100, Ivan Kokshaysky wrote:
> On Tue, Apr 17, 2018 at 02:43:44PM -0500, Bjorn Helgaas wrote:
> > On Mon, Apr 16, 2018 at 09:43:42PM -0700, Matt Turner wrote:
> > > On Mon, Apr 16, 2018 at 2:50 PM, Bjorn Helgaas <helg...@kernel.org> wrote:
> > > > Hi Matt,
> > > >
> > > > First of all, sorry about breaking Nautilus, and thanks very much for
> > > > tracking it down to this commit.
> > > 
> > > It's a particularly weird case, as far as I've been able to discern :)
> > > 
> > > > On Mon, Apr 16, 2018 at 07:33:57AM -0700, Matt Turner wrote:
> > > >> Commit f75b99d5a77d63f20e07bd276d5a427808ac8ef6 (PCI: Enforce bus
> > > >> address limits in resource allocation) broke Alpha systems using
> > > >> CONFIG_ALPHA_NAUTILUS. Alpha is 64-bit, but Nautilus systems use a
> > > >> 32-bit AMD 751/761 chipset. arch/alpha/kernel/sys_nautilus.c maps PCI
> > > >> into the upper addresses just below 4GB.
> > > >>
> > > >> I can get a working kernel by ifdef'ing out the code in
> > > >> drivers/pci/bus.c:pci_bus_alloc_resource. We can't tie
> > > >> PCI_BUS_ADDR_T_64BIT to ALPHA_NAUTILUS without breaking generic
> > > >> kernels.
> > > >>
> > > >> How can we get Nautilus working again?
> > > >
> > > > Can you collect a complete dmesg log, ideally both before and after
> > > > f75b99d5a77d?  I assume the problem is that after f75b99d5a77d? we
> > > > erroneously assign space for something above 4GB.  But if we know the
> > > > correct host bridge apertures, we shouldn't assign space outside them,
> > > > regardless of the PCI bus address size.
> > > 
> > > I made a mistake in my initial report. Commit f75b99d5a77d is actually
> > > the last *working* commit. My apologies. The next commit is
> > > d56dbf5bab8c (PCI: Allocate 64-bit BARs above 4G when possible) and it
> > > breaks Nautilus I've confirmed.
> > > 
> > > Please find attached dmesgs from those two commits, from the commit
> > > immediately before them, and another from 4.17-rc1 with my hack of #if
> > > 0'ing out the pci_bus_alloc_from_region(..., _high) code.
> > > 
> > > Thanks for having a look!
> > 
> > We're telling the PCI core that the host bridge MMIO aperture is the
> > entire 64-bit address space, so when we assign BARs, some of them end
> > up above 4GB:
> > 
> >   pci_bus :00: root bus resource [mem 0x-0x]
> >   pci :00:09.0: BAR 0: assigned [mem 0x1-0x1 64bit]
> > 
> > But it sounds like the MMIO aperture really ends at 0x, so
> > that's not going to work.
> 
> Correct... This would do as a quick fix, I think:
> 
> diff --git a/arch/alpha/kernel/sys_nautilus.c 
> b/arch/alpha/kernel/sys_nautilus.c
> index ff4f54b..477ba65 100644
> --- a/arch/alpha/kernel/sys_nautilus.c
> +++ b/arch/alpha/kernel/sys_nautilus.c
> @@ -193,6 +193,8 @@ static struct resource irongate_io = {
>  };
>  static struct resource irongate_mem = {
>   .name   = "Irongate PCI MEM",
> + .start  = 0,
> + .end= 0x,
>   .flags  = IORESOURCE_MEM,
>  };
>  static struct resource busn_resource = {
> @@ -218,7 +220,7 @@ nautilus_init_pci(void)
>   return;
>  
>   pci_add_resource(>windows, _resource);
> - pci_add_resource(>windows, _resource);
> + pci_add_resource(>windows, _mem);
>   pci_add_resource(>windows, _resource);
>   bridge->dev.parent = NULL;
>   bridge->sysdata = hose;

If it works for Matt, that looks reasonable to me.

> > There's probably some register in the chipset that tells us where the
> > MMIO aperture starts.  The best thing to do would be to read that
> > register, use it to initialize irongate_mem, and use that as the MMIO
> > aperture.
> 
> Surely there is the register, namely IRONGATE0->pci_mem, but it's
> basically write-only for us as it contains utter crap on bootup.
> 
> > But I don't know where to look in the chipset, and it looks like the
> > current strategy is to infer the base by looking at BAR assignments of
> > PCI devices.  Can you try the patch below (based on v4.17-rc1) and
> > save the dmesg and /proc/iomem and /proc/ioports contents?  I'm
> > guessing at some things here, so I added a few debug printks, too.
> 
> No, the strategy was to do PCI resource allocations from scratch,
> minimizing MMIO ap

Re: Some Alphas broken by f75b99d5a77d (PCI: Enforce bus address limits in resource allocation)

2018-04-17 Thread Bjorn Helgaas
On Mon, Apr 16, 2018 at 09:43:42PM -0700, Matt Turner wrote:
> On Mon, Apr 16, 2018 at 2:50 PM, Bjorn Helgaas <helg...@kernel.org> wrote:
> > Hi Matt,
> >
> > First of all, sorry about breaking Nautilus, and thanks very much for
> > tracking it down to this commit.
> 
> It's a particularly weird case, as far as I've been able to discern :)
> 
> > On Mon, Apr 16, 2018 at 07:33:57AM -0700, Matt Turner wrote:
> >> Commit f75b99d5a77d63f20e07bd276d5a427808ac8ef6 (PCI: Enforce bus
> >> address limits in resource allocation) broke Alpha systems using
> >> CONFIG_ALPHA_NAUTILUS. Alpha is 64-bit, but Nautilus systems use a
> >> 32-bit AMD 751/761 chipset. arch/alpha/kernel/sys_nautilus.c maps PCI
> >> into the upper addresses just below 4GB.
> >>
> >> I can get a working kernel by ifdef'ing out the code in
> >> drivers/pci/bus.c:pci_bus_alloc_resource. We can't tie
> >> PCI_BUS_ADDR_T_64BIT to ALPHA_NAUTILUS without breaking generic
> >> kernels.
> >>
> >> How can we get Nautilus working again?
> >
> > Can you collect a complete dmesg log, ideally both before and after
> > f75b99d5a77d?  I assume the problem is that after f75b99d5a77d? we
> > erroneously assign space for something above 4GB.  But if we know the
> > correct host bridge apertures, we shouldn't assign space outside them,
> > regardless of the PCI bus address size.
> 
> I made a mistake in my initial report. Commit f75b99d5a77d is actually
> the last *working* commit. My apologies. The next commit is
> d56dbf5bab8c (PCI: Allocate 64-bit BARs above 4G when possible) and it
> breaks Nautilus I've confirmed.
> 
> Please find attached dmesgs from those two commits, from the commit
> immediately before them, and another from 4.17-rc1 with my hack of #if
> 0'ing out the pci_bus_alloc_from_region(..., _high) code.
> 
> Thanks for having a look!

We're telling the PCI core that the host bridge MMIO aperture is the
entire 64-bit address space, so when we assign BARs, some of them end
up above 4GB:

  pci_bus :00: root bus resource [mem 0x-0x]
  pci :00:09.0: BAR 0: assigned [mem 0x1-0x1 64bit]

But it sounds like the MMIO aperture really ends at 0x, so
that's not going to work.

There's probably some register in the chipset that tells us where the
MMIO aperture starts.  The best thing to do would be to read that
register, use it to initialize irongate_mem, and use that as the MMIO
aperture.

But I don't know where to look in the chipset, and it looks like the
current strategy is to infer the base by looking at BAR assignments of
PCI devices.  Can you try the patch below (based on v4.17-rc1) and
save the dmesg and /proc/iomem and /proc/ioports contents?  I'm
guessing at some things here, so I added a few debug printks, too.


diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index ff4f54b86c7f..093ad6e5c75f 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -189,10 +189,14 @@ extern void pcibios_claim_one_bus(struct pci_bus *);
 
 static struct resource irongate_io = {
.name   = "Irongate PCI IO",
+   .start  = 0,
+   .end= 0x,
.flags  = IORESOURCE_IO,
 };
 static struct resource irongate_mem = {
.name   = "Irongate PCI MEM",
+   .start  = 0,
+   .end= 0x,
.flags  = IORESOURCE_MEM,
 };
 static struct resource busn_resource = {
@@ -208,7 +212,6 @@ nautilus_init_pci(void)
struct pci_controller *hose = hose_head;
struct pci_host_bridge *bridge;
struct pci_bus *bus;
-   struct pci_dev *irongate;
unsigned long bus_align, bus_size, pci_mem;
unsigned long memtop = max_low_pfn << PAGE_SHIFT;
int ret;
@@ -217,8 +220,8 @@ nautilus_init_pci(void)
if (!bridge)
return;
 
-   pci_add_resource(>windows, _resource);
-   pci_add_resource(>windows, _resource);
+   pci_add_resource(>windows, _io);
+   pci_add_resource(>windows, _mem);
pci_add_resource(>windows, _resource);
bridge->dev.parent = NULL;
bridge->sysdata = hose;
@@ -237,33 +240,30 @@ nautilus_init_pci(void)
bus = hose->bus = bridge->bus;
pcibios_claim_one_bus(bus);
 
-   irongate = pci_get_domain_bus_and_slot(pci_domain_nr(bus), 0, 0);
-   bus->self = irongate;
-   bus->resource[0] = _io;
-   bus->resource[1] = _mem;
-
pci_bus_size_bridges(bus);
 
-   /* IO port range. */
-   bus->resource[0]->start = 0;
-   bus->resource[0]->end = 0x;
-
+   printk("bus->resource[1] %pR\n", >resource[1]);
/* Set up PCI memory range - limit is hardwi

Re: Some Alphas broken by f75b99d5a77d (PCI: Enforce bus address limits in resource allocation)

2018-04-16 Thread Bjorn Helgaas
Hi Matt,

First of all, sorry about breaking Nautilus, and thanks very much for
tracking it down to this commit.

On Mon, Apr 16, 2018 at 07:33:57AM -0700, Matt Turner wrote:
> Commit f75b99d5a77d63f20e07bd276d5a427808ac8ef6 (PCI: Enforce bus
> address limits in resource allocation) broke Alpha systems using
> CONFIG_ALPHA_NAUTILUS. Alpha is 64-bit, but Nautilus systems use a
> 32-bit AMD 751/761 chipset. arch/alpha/kernel/sys_nautilus.c maps PCI
> into the upper addresses just below 4GB.
> 
> I can get a working kernel by ifdef'ing out the code in
> drivers/pci/bus.c:pci_bus_alloc_resource. We can't tie
> PCI_BUS_ADDR_T_64BIT to ALPHA_NAUTILUS without breaking generic
> kernels.
> 
> How can we get Nautilus working again?

Can you collect a complete dmesg log, ideally both before and after
f75b99d5a77d?  I assume the problem is that after f75b99d5a77d? we
erroneously assign space for something above 4GB.  But if we know the
correct host bridge apertures, we shouldn't assign space outside them,
regardless of the PCI bus address size.

Coincidentally, Christoph is replacing CONFIG_PCI_BUS_ADDR_T_64BIT
with CONFIG_ARCH_DMA_ADDR_T_64BIT, but I think that change is a no-op
with respect to the problem you're seeing.

[1] https://lkml.kernel.org/r/20180415145947.1248-10-...@lst.de
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: the patch "alpha/PCI: Replace pci_fixup_irqs()" breaks networking

2018-01-02 Thread Bjorn Helgaas
[+cc linux-pci]

Thanks for the report!  Lorenzo has been on vacation and is probably
buried in email, but I'm sure he'll be on this as soon as he digs out.

On Tue, Jan 2, 2018 at 3:32 PM, Mikulas Patocka  wrote:
> Hi
>
> The patch 0e4c2eeb758a91e68b9eaf7a4bee9bd5ed97ff2b ("alpha/PCI: Replace
> pci_fixup_irqs() call with host bridge IRQ mapping hooks") breaks
> networking on Alpha for me. I have an Alpha Avanti server with tulip
> network card.
>
> The patch 0e4c2eeb breaks it so that I get MCE when the network card
> driver is loaded. The patch 814eae59 fixes the MCE, the system boot
> completes, but the network card doesn't receive any interrupts (and soon
> it reports warning about timeout on tx queue). All kernels in the 4.14
> branch have this bug.
>
> Mikulas
>
>
> # cat /proc/interrupts
>CPU0
>   1:  3XT-PIC  i8042
>   2:  0XT-PIC  cascade
>   4:752XT-PIC  ttyS0
>   8:  58118 dummy-RTC   timer
>  10:   1613XT-PIC  ide0, ide1
>  11:739XT-PIC  sym53c8xx
>  12:  5XT-PIC  i8042
>  15:  0XT-PIC  eth0 <--- note that the counter is zero
> PMI:  0   Performance Monitoring
> ERR:  0
>
> # lspci -vv
> 00:06.0 SCSI storage controller: LSI Logic / Symbios Logic 53c810 (rev 01)
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ 
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
> SERR-  Latency: 255
> Interrupt: pin A routed to IRQ 11
> Region 0: I/O ports at 8000 [size=256]
> Region 1: Memory at 0130 (32-bit, non-prefetchable) [size=256]
> Kernel driver in use: sym53c8xx
> Kernel modules: sym53c8xx
>
> 00:07.0 ISA bridge: Intel Corporation 82378ZB/IB, 82379AB (SIO, SIO.A) PCI to 
> ISA Bridge (rev 43)
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
> SERR-  Latency: 0
>
> 00:0b.0 Ethernet controller: Digital Equipment Corporation DECchip 21140 
> [FasterNet] (rev 22)
> Subsystem: Digital Equipment Corporation DECchip 21140 [FasterNet]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr+ 
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
> SERR-  Latency: 255 (5000ns min, 1ns max), Cache Line Size: 64 bytes
> Interrupt: pin A routed to IRQ 15
> Region 0: I/O ports at 8400 [size=128]
> Region 1: Memory at 01302000 (32-bit, non-prefetchable) [size=128]
> Expansion ROM at 0128 [disabled] [size=256K]
> Kernel driver in use: tulip
> Kernel modules: tulip
>
> 00:0c.0 Display controller: Digital Equipment Corporation DECchip 21030 [TGA] 
> (rev 02)
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
> Stepping+ SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
> SERR-  Latency: 255
> Interrupt: pin A routed to IRQ 5
> Region 0: Memory at 0200 (32-bit, prefetchable) [size=32M]
> Expansion ROM at 012c [disabled] [size=256K]
> Kernel driver in use: tgafb
>
> 00:0d.0 RAID bus controller: Silicon Image, Inc. PCI0680 Ultra ATA-133 Host 
> Controller (rev 02)
> Subsystem: Silicon Image, Inc. Winic W-680 (Silicon Image 680 based)
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ 
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
> SERR-  Latency: 240, Cache Line Size: 4 bytes
> Interrupt: pin A routed to IRQ 10
> Region 0: I/O ports at 8490 [size=8]
> Region 1: I/O ports at 84a0 [size=4]
> Region 2: I/O ports at 8498 [size=8]
> Region 3: I/O ports at 84a4 [size=4]
> Region 4: I/O ports at 8480 [size=16]
> Region 5: Memory at 01301000 (32-bit, non-prefetchable) [size=256]
> Expansion ROM at 0120 [disabled] [size=512K]
> Capabilities: [60] Power Management version 2
> Flags: PMEClk- DSI+ D1+ D2+ AuxCurrent=0mA 
> PME(D0-,D1-,D2-,D3hot-,D3cold-)
> Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=2 PME-
> Kernel driver in use: SiI_IDE
>
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] PCI: Remove unused declarations

2017-10-05 Thread Bjorn Helgaas
From: Bjorn Helgaas <bhelg...@google.com>

Remove these unused declarations:

  pcibios_config_init()  # never defined anywhere
  pcibios_scan_root()# only defined by x86
  pcibios_get_irq_routing_table()# only defined by x86
  pcibios_set_irq_routing()  # only defined by x86

Signed-off-by: Bjorn Helgaas <bhelg...@google.com>
---
 arch/cris/include/asm/pci.h |6 --
 arch/ia64/include/asm/pci.h |2 --
 arch/mn10300/unit-asb2305/pci-asb2305.h |3 ---
 arch/x86/include/asm/pci.h  |1 -
 4 files changed, 12 deletions(-)

diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index 8ea640560a46..141337bf16bc 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -16,12 +16,6 @@
 
 #define PCIBIOS_MIN_CARDBUS_IO 0x4000
 
-void pcibios_config_init(void);
-struct pci_bus * pcibios_scan_root(int bus);
-
-struct irq_routing_table *pcibios_get_irq_routing_table(void);
-int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
-
 /* Dynamic DMA mapping stuff.
  * i386 has everything mapped statically.
  */
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 8c4b37f6be3d..915531ede6a5 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -29,8 +29,6 @@ struct pci_vector_struct {
 #define PCIBIOS_MIN_IO 0x1000
 #define PCIBIOS_MIN_MEM0x1000
 
-void pcibios_config_init(void);
-
 /*
  * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
  * correspondence between device bus addresses and CPU physical addresses.
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h 
b/arch/mn10300/unit-asb2305/pci-asb2305.h
index 96c484b12226..0667f613b023 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.h
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.h
@@ -30,9 +30,6 @@ extern void pcibios_resource_survey(void);
 
 extern struct pci_ops *pci_root_ops;
 
-extern struct irq_routing_table *pcibios_get_irq_routing_table(void);
-extern int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
-
 /* pci-irq.c */
 
 struct irq_info {
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 645019085bb8..53873a875c01 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -88,7 +88,6 @@ extern unsigned long pci_mem_start;
 #define PCIBIOS_MIN_CARDBUS_IO 0x4000
 
 extern int pcibios_enabled;
-void pcibios_config_init(void);
 void pcibios_scan_root(int bus);
 
 struct irq_routing_table *pcibios_get_irq_routing_table(void);

--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] PCI: Remove redundant pci_dev, pci_bus, resource declarations

2017-10-05 Thread Bjorn Helgaas
From: Bjorn Helgaas <bhelg...@google.com>

 defines struct pci_bus and struct pci_dev and includes the
struct resource definition before including .  Nobody includes
 directly, so they don't need their own declarations.

Remove the redundant struct pci_dev, pci_bus, resource declarations.

Signed-off-by: Bjorn Helgaas <bhelg...@google.com>
---
 arch/alpha/include/asm/pci.h|3 ---
 arch/cris/include/asm/pci.h |2 --
 arch/frv/include/asm/pci.h  |2 --
 arch/ia64/include/asm/pci.h |2 --
 arch/mips/include/asm/pci.h |2 --
 arch/mn10300/include/asm/pci.h  |2 --
 arch/parisc/include/asm/pci.h   |7 ---
 arch/powerpc/include/asm/pci.h  |2 --
 arch/sh/include/asm/pci.h   |2 --
 arch/sparc/include/asm/pci_32.h |2 --
 arch/xtensa/include/asm/pci.h   |2 --
 11 files changed, 28 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index 777be3114fda..0a10ff93b174 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -12,9 +12,6 @@
  * The following structure is used to manage multiple PCI busses.
  */
 
-struct pci_dev;
-struct pci_bus;
-struct resource;
 struct pci_iommu_arena;
 struct page;
 
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index c6ac59d9f815..8ea640560a46 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -32,8 +32,6 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int 
irq);
 #include 
 #include 
 
-struct pci_dev;
-
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
diff --git a/arch/frv/include/asm/pci.h b/arch/frv/include/asm/pci.h
index a6957014e74e..895af9d558ba 100644
--- a/arch/frv/include/asm/pci.h
+++ b/arch/frv/include/asm/pci.h
@@ -17,8 +17,6 @@
 #include 
 #include 
 
-struct pci_dev;
-
 #define pcibios_assign_all_busses()0
 
 #ifdef CONFIG_MMU
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 6459f2d46200..8c4b37f6be3d 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -31,8 +31,6 @@ struct pci_vector_struct {
 
 void pcibios_config_init(void);
 
-struct pci_dev;
-
 /*
  * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
  * correspondence between device bus addresses and CPU physical addresses.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 0f8528c34753..2339f42f047a 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -121,8 +121,6 @@ extern unsigned long PCIBIOS_MIN_MEM;
 #include 
 #include 
 
-struct pci_dev;
-
 /*
  * The PCI address space does equal the physical memory address space.
  * The networking and block device layers use this boolean for bounce
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index bdacb618d6af..5b75a1b2c4f6 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -57,8 +57,6 @@ extern void unit_pci_init(void);
 #include 
 #include 
 
-struct pci_dev;
-
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index b5730f83b941..8cc009e26a28 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -86,13 +86,6 @@ struct pci_hba_data {
 #define PCI_F_EXTEND   0UL
 #endif /* !CONFIG_64BIT */
 
-/*
-** KLUGE: linux/pci.h include asm/pci.h BEFORE declaring struct pci_bus
-** (This eliminates some of the warnings).
-*/
-struct pci_bus;
-struct pci_dev;
-
 /*
  * If the PCI device's view of memory is the same as the CPU's view of memory,
  * PCI_DMA_BUS_IS_PHYS is true.  The networking and block device layers use
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index c8975dac535f..8dc32eacc97c 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -28,8 +28,6 @@
 #define PCIBIOS_MIN_IO 0x1000
 #define PCIBIOS_MIN_MEM0x1000
 
-struct pci_dev;
-
 /* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
 #define IOBASE_BRIDGE_NUMBER   0
 #define IOBASE_MEMORY  1
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 063c8003b169..6c2d68e08a57 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -63,8 +63,6 @@ extern int pci_is_66mhz_capable(struct pci_channel *hose,
 
 extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
 
-struct pci_dev;
-
 #define HAVE_PCI_MMAP
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index b7c092df3134..8b0e26232c78 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@

Re: alpha runtime warnings due to commit 0e4c2eeb758 ("alpha/PCI: Replace pci_fixup_irqs() call with host ...")

2017-09-28 Thread Bjorn Helgaas
On Thu, Sep 28, 2017 at 10:25:33AM +0100, Lorenzo Pieralisi wrote:
> On Wed, Sep 27, 2017 at 02:55:02PM -0500, Bjorn Helgaas wrote:
> > On Wed, Sep 27, 2017 at 11:30:34AM +0100, Lorenzo Pieralisi wrote:
> > > On Wed, Sep 20, 2017 at 12:31:04PM +0100, Lorenzo Pieralisi wrote:
> > > > On Tue, Sep 19, 2017 at 11:02:33AM -0700, Guenter Roeck wrote:
> > > > > On Tue, Sep 19, 2017 at 10:12:32AM +0100, Lorenzo Pieralisi wrote:
> > > > > > On Mon, Sep 18, 2017 at 07:00:55PM -0700, Guenter Roeck wrote:

> > > > > > > I see the following runtime warnings in mainline when running 
> > > > > > > alpha images in qemu.
> > > > > > > 
> > > > > > > 
> > > > > > > Floppy drive(s): fd0 is 2.88M
> > > > > > > ide0: disabled, no IRQ
> > > > > > > ide0: failed to initialize IDE interface
> > > > > > > ide0: disabling port
> > > > > > > cmd64x :00:02.0: IDE controller (0x1095:0x0646 rev 0x07)
> > > > > > > CMD64x_IDE :00:02.0: BAR 0: can't reserve [io  0x8050-0x8057]
> > > > > > > cmd64x :00:02.0: can't reserve resources
> > > > > > > CMD64x_IDE: probe of :00:02.0 failed with error -16
> > > > > > > ide_generic: please use "probe_mask=0x3f" module parameter for 
> > > > > > > probing all legacy ISA IDE ports
> > > > > > > [ cut here ]
> > > > > > > WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 
> > > > > > > sysfs_warn_dup+0x94/0xd0
> > > > > > > sysfs: cannot create duplicate filename '/class/ide_port/ide0'
> > > > > > > ...
> > > > > > > 
> > > > > > > Trace:
> > > > > > > [] __warn+0x160/0x190
> > > > > > > [] sysfs_warn_dup+0x94/0xd0
> > > > > > > [] warn_slowpath_fmt+0x58/0x70
> > > > > > > [] sysfs_warn_dup+0x94/0xd0
> > > > > > > [] kernfs_path_from_node+0x30/0x60
> > > > > > > [] kernfs_put+0x16c/0x2c0
> > > > > > > [] kernfs_put+0x16c/0x2c0
> > > > > > > [] sysfs_do_create_link_sd.isra.2+0x100/0x120
> > > > > > > [] device_add+0x2a4/0x7c0
> > > > > > > [] device_create_groups_vargs+0x14c/0x170
> > > > > > > [] device_create_groups_vargs+0x98/0x170
> > > > > > > [] device_create+0x50/0x70
> > > > > > > [] ide_host_register+0x48c/0xa00
> > > > > > > [] ide_host_register+0x450/0xa00
> > > > > > > [] device_register+0x20/0x50
> > > > > > > [] ide_host_register+0x450/0xa00
> > > > > > > [] ide_host_add+0x64/0xe0
> > > > > > > [] kobject_uevent_env+0x16c/0x710
> > > > > > > [] do_one_initcall+0x68/0x260
> > > > > > > [] kernel_init+0x1c/0x1a0
> > > > > > > [] kernel_init+0x0/0x1a0
> > > > > > > [] ret_from_kernel_thread+0x18/0x20
> > > > > > > [] kernel_init+0x0/0x1a0
> > > > > > > 
> > > > > > > ---[ end trace 24a70433c3e4d374 ]---
> > > > > > > ide0: disabling port
> > > > > > > 
> > > > > > > [ multiple times ]
> > > > > > > 
> > > > > > > A complete log is available at 
> > > > > > > http://kerneltests.org/builders/qemu-alpha-master.
> > > > > > > 
> > > > > > > Prior to the offending commit, the kernel log looks as follows.
> > > > > > > 
> > > > > > > ...
> > > > > > > Uniform Multi-Platform E-IDE driver
> > > > > > > cmd64x :00:02.0: IDE controller (0x1095:0x0646 rev 0x07)
> > > > > > > cmd64x :00:02.0: IDE port disabled
> > > > > > > cmd64x :00:02.0: 100% native mode on irq 28
> > > > > > > PCI: Setting latency timer of device :00:02.0 to 64
> > > > > > > ide0: BM-DMA at 0x8040-0x8047
> > > > > > > Floppy drive(s): fd0 is 2.88M
> > > > > > > ide0 at 0x8050-0x8057,0x8062 on irq 28 (serialized)
> > > > > > > ide_generic: please use "probe_mask=0x3f" module parameter for 
> > > > > > > probing all legacy ISA IDE ports

Re: [PATCH] pci: Add and use PCI_GENERIC_SETUP Kconfig entry

2017-06-27 Thread Bjorn Helgaas
[+cc Lorenzo]

Hi Palmer,

On Fri, Jun 23, 2017 at 02:45:38PM -0700, Palmer Dabbelt wrote:
> We wanted to add RISC-V to the list of architectures that used the
> generic PCI setup-irq.o inside the Makefile and it was suggested that
> instead we define a Kconfig entry and use that.
> 
> I've done very minimal testing on this: I just checked to see that
> an aarch64 defconfig still build setup-irq.o with the patch applied.
> The intention is that this patch doesn't change the behavior of any
> build.
> 
> Signed-off-by: Palmer Dabbelt 

Lorenzo Pieralisi's "ARM/ARM64: remove pci_fixup_irqs() usage" series
overlaps with this quite a bit, and includes this patch:

https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/enumeration=5b64036feff4

which makes it so we build setup-irq.o on *all* arches.  Can you check
out the pci/enumeration branch and see whether it accomplishes what
you need?

https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=pci/enumeration

> ---
>  arch/alpha/Kconfig |  1 +
>  arch/arc/Kconfig   |  1 +
>  arch/arm/Kconfig   |  1 +
>  arch/arm64/Kconfig |  1 +
>  arch/m68k/Kconfig  |  1 +
>  arch/mips/Kconfig  |  1 +
>  arch/sh/Kconfig|  1 +
>  arch/sparc/Kconfig |  1 +
>  arch/tile/Kconfig  |  1 +
>  arch/unicore32/Kconfig |  1 +
>  drivers/pci/Kconfig|  3 +++
>  drivers/pci/Makefile   | 11 +--
>  12 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index 0e49d39ea74a..30f4e711f681 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -26,6 +26,7 @@ config ALPHA
>   select ODD_RT_SIGACTION
>   select OLD_SIGSUSPEND
>   select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
> + select PCI_GENERIC_SETUP
>   help
> The Alpha is a 64-bit general-purpose processor designed and
> marketed by the Digital Equipment Corporation of blessed memory,
> diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
> index a5459698f0ee..dd1f64858118 100644
> --- a/arch/arc/Kconfig
> +++ b/arch/arc/Kconfig
> @@ -44,6 +44,7 @@ config ARC
>   select HAVE_GENERIC_DMA_COHERENT
>   select HAVE_KERNEL_GZIP
>   select HAVE_KERNEL_LZMA
> + select PCI_GENERIC_SETUP
>  
>  config MIGHT_HAVE_PCI
>   bool
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 4c1a35f15838..86872246951c 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -96,6 +96,7 @@ config ARM
>   select PERF_USE_VMALLOC
>   select RTC_LIB
>   select SYS_SUPPORTS_APM_EMULATION
> + select PCI_GENERIC_SETUP
>   # Above selects are sorted alphabetically; please add new ones
>   # according to that.  Thanks.
>   help
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index b2024db225a9..6c684d8c8816 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -115,6 +115,7 @@ config ARM64
>   select SPARSE_IRQ
>   select SYSCTL_EXCEPTION_TRACE
>   select THREAD_INFO_IN_TASK
> + select PCI_GENERIC_SETUP
>   help
> ARM 64-bit (AArch64) Linux support.
>  
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index d140206d5d29..c16214344f1c 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -22,6 +22,7 @@ config M68K
>   select MODULES_USE_ELF_RELA
>   select OLD_SIGSUSPEND3
>   select OLD_SIGACTION
> + select PCI_GENERIC_SETUP
>  
>  config RWSEM_GENERIC_SPINLOCK
>   bool
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 2828ecde133d..474a7c710686 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -70,6 +70,7 @@ config MIPS
>   select HAVE_EXIT_THREAD
>   select HAVE_REGS_AND_STACK_ACCESS_API
>   select HAVE_COPY_THREAD_TLS
> + select PCI_GENERIC_SETUP
>  
>  menu "Machine selection"
>  
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index ee086958b2b2..90a98ac526fb 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -48,6 +48,7 @@ config SUPERH
>   select HAVE_ARCH_AUDITSYSCALL
>   select HAVE_FUTEX_CMPXCHG if FUTEX
>   select HAVE_NMI
> + select PCI_GENERIC_SETUP
>   help
> The SuperH is a RISC processor targeted for use in embedded systems
> and consumer electronics; it was also used in the Sega Dreamcast
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 5639c9fe5b55..24cea64104bd 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -424,6 +424,7 @@ config SPARC_LEON
>   depends on SPARC32
>   select USB_EHCI_BIG_ENDIAN_MMIO
>   select USB_EHCI_BIG_ENDIAN_DESC
> + select PCI_GENERIC_SETUP
>   ---help---
> If you say Y here if you are running on a SPARC-LEON processor.
> The LEON processor is a synthesizable VHDL model of the
> diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
> index 4583c0320059..6679af85a882 100644
> --- a/arch/tile/Kconfig
> +++ b/arch/tile/Kconfig
> @@ -33,6