Mark Salter | 4 Mar 23:24 2015

[PATCH] PCI: xgene: fix breakage from generic config usage

Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config
accessors") breaks PCI on the X-Gene platform. It creates two
problems with the xgene_pcie_map_bus() function. First, it returns
an int but should return a void __iomem *, but that's just a
compile-time warning. The breakage is caused by the offset not
being added to the base of the config map. So all config reads
and writes operate on the first four bytes of config space. This
patch fixes both issues.

Signed-off-by: Mark Salter <msalter <at>>
 drivers/pci/host/pci-xgene.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 52bb25c..b87f80b 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
 <at>  <at>  -129,17 +129,21  <at>  <at>  static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
 	return false;

-static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
-			      int offset)
+static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
+					int offset)
 	struct xgene_pcie_port *port = bus->sysdata;
+	void __iomem *base;

(Continue reading)

Yijing Wang | 4 Mar 07:16 2015

[PATCH] ia64/PCI: Fix the build warning of pci_domain_nr()

We should pass pci_bus * instead of pci_dev * to pci_domain_nr().

Signed-off-by: Yijing Wang <wangyijing <at>>
CC: Tony Luck <tony.luck <at>>
CC: Fenghua Yu <fenghua.yu <at>>
CC: linux-ia64 <at>
CC: stable <at>
Signed-off-by: Bjorn Helgaas <bhelgaas <at>>
 arch/ia64/sn/kernel/io_acpi_init.c |    6 +++---
 arch/ia64/sn/kernel/io_init.c      |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index 0640739..2fd7414 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
 <at>  <at>  -364,12 +364,12  <at>  <at>  sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
         status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL,
         if (ACPI_SUCCESS(status)) {
-		if (segment != pci_domain_nr(dev)) {
+		if (segment != pci_domain_nr(dev->bus)) {
 			acpi_get_name(rootbus_handle, ACPI_FULL_PATHNAME,
 			       "%s: Segment number mismatch, 0x%llx vs 0x%x for: %s\n",
-			       __func__, segment, pci_domain_nr(dev),
+			       __func__, segment, pci_domain_nr(dev->bus),
 			       (char *)name_buffer.pointer);
(Continue reading)

Wei Yang | 4 Mar 06:18 2015

[PATCH V13 00/21] Enable SRIOV on Power8

This patchset enables the SRIOV on POWER8.

The gerneral idea is put each VF into one individual PE and allocate required
resources like MMIO/DMA/MSI. The major difficulty comes from the MMIO
allocation and adjustment for PF's IOV BAR.

On P8, we use M64BT to cover a PF's IOV BAR, which could make an individual VF
sit in its own PE. This gives more flexiblity, while at the mean time it
brings on some restrictions on the PF's IOV BAR size and alignment.

To achieve this effect, we need to do some hack on pci devices's resources.
1. Expand the IOV BAR properly.
   Done by pnv_pci_ioda_fixup_iov_resources().
2. Shift the IOV BAR properly.
   Done by pnv_pci_vf_resource_shift().
3. IOV BAR alignment is calculated by arch dependent function instead of an
   individual VF BAR size.
   Done by pnv_pcibios_sriov_resource_alignment().
4. Take the IOV BAR alignment into consideration in the sizing and assigning.
   This is achieved by commit: "PCI: Take additional IOV BAR alignment in
   sizing and assigning"

Test Environment:
       The SRIOV device tested is Emulex Lancer(10df:e220) and
       Mellanox ConnectX-3(15b3:1003) on POWER8.

Examples on pass through a VF to guest through vfio:
	1. unbind the original driver and bind to vfio-pci driver
	   echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
	   echo  1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
(Continue reading)

Tomasz Nowicki | 27 Feb 16:00 2015

[PATCH v2 0/9] PCI: MMCONFIG clean up

MCFG ACPI table and PCI ECAM standard have no arch dependencies so it can be
used across all architectures. Currently MMCONFIG related code resides in
arch/x86 directories. This patch set is going to isolate non-architecure
specific code and make it accessible for all architectures.

v1 -> v2 changes:
- use generic readb/readw etc. accessors instead of AMD Fam10h workaround
- separate ACPI and ECAM code
- improve ECAM code naming

Tomasz Nowicki (9):
  x86, pci: Clean up comment about buggy MMIO config space access for
    AMD Fam10h CPUs.
  x86, pci: Abstract PCI config accessors and use AMD Fam10h workaround
  x86, pci: Reorder logic of pci_mmconfig_insert() function
  x86, pci, acpi: Move arch-agnostic MMCONFIG (aka ECAM) and ACPI code
    out of arch/x86/ directory
  pci, acpi, mcfg: Provide generic implementation of MCFG code
  x86, pci: mmconfig_{32,64}.c code refactoring - remove code
  x86, pci, ecam: mmconfig_64.c becomes default implementation for ECAM
  pci, acpi, mcfg: Share ACPI PCI config space accessors.
  pci, ecam: Improve naming for ecam.c content and areas where it is

 arch/x86/Kconfig               |   3 +
 arch/x86/include/asm/pci_x86.h |  34 +---
(Continue reading)

kbuild test robot | 27 Feb 02:06 2015

[pci:pci/enumeration 21/30] drivers/pci/pci.c:111:15: sparse: symbol 'pci_bus_max_busnr' was not declared. Should it be static?

tree:   git:// pci/enumeration
head:   84dad4dda42cbf93ecf029c5a6b0af35305d6f75
commit: 762f920d602e28bf32d27003c93ca05244957aff [21/30] PCI: Introduce pci_bus_child_max_busnr()
  # apt-get install sparse
  git checkout 762f920d602e28bf32d27003c93ca05244957aff
  make ARCH=x86_64 allmodconfig
  make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

>> drivers/pci/pci.c:111:15: sparse: symbol 'pci_bus_max_busnr' was not declared. Should it be static?
   drivers/pci/pci.c:579:13: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:579:21: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:579:31: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:579:39: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:586:35: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:586:54: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:587:19: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:587:37: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:609:23: sparse: invalid assignment: |=
   drivers/pci/pci.c:609:23:    left side has type unsigned short
   drivers/pci/pci.c:609:23:    right side has type restricted pci_power_t
   drivers/pci/pci.c:614:57: sparse: restricted pci_power_t degrades to integer
   drivers/pci/pci.c:634:28: sparse: incorrect type in assignment (different base types)
   drivers/pci/pci.c:634:28:    expected restricted pci_power_t [usertype] current_state
   drivers/pci/pci.c:634:28:    got int
   drivers/pci/pci.c:683:36: sparse: incorrect type in assignment (different base types)
   drivers/pci/pci.c:683:36:    expected restricted pci_power_t [usertype] current_state
   drivers/pci/pci.c:683:36:    got int
(Continue reading)

Alnie | 26 Feb 02:12 2015

PCI Issues with ExpressCard/54 Audio Device

Hi, I am seeking feedback in regards to issues with a ExpressCard/54 audio card
under Linux (same card has been working fine in Win 7). After recently having a conversation on alsa-devel
about it, it was decided it seems to be a PCI issue. The "devices" in question....

05:00.0 PCI bridge: Creative Labs [SB X-Fi Xtreme Audio] CA0110-IBG PCI to PCIe Bridge (prog-if 00 [Normal decode])
     Physical Slot: 3
     Flags: bus master, fast devsel, latency 0
     Bus: primary=05, secondary=06, subordinate=0c, sec-latency=36
     Memory behind bridge: f4300000-f43fffff
     Capabilities: [50] Power Management version 3
     Capabilities: [60] MSI: Enable- Count=1/16 Maskable- 64bit+
     Capabilities: [80] Subsystem: Creative Labs Device 0040
     Capabilities: [90] Express PCI-Express to PCI/PCI-X Bridge, MSI 00
     Capabilities: [100] Advanced Error Reporting

06:00.0 Audio device: Creative Labs [SB X-Fi Xtreme Audio] CA0110-IBG
     Subsystem: Creative Labs SB1040
     Flags: bus master, fast Back2Back, medium devsel, latency 32, IRQ 19
     Memory at f4300000 (32-bit, non-prefetchable) [size=16K]
     Capabilities: [dc] Power Management version 3
     Kernel driver in use: snd_hda_intel

dmesg output...

and comments in regard to it...
> [ 2619.199658] pciehp 0000:00:1c.3:pcie04: Card not present on Slot(3)
> [ 2619.199666] pciehp 0000:00:1c.3:pcie04: slot(3): Link Down event
> [ 2619.199674] pciehp 0000:00:1c.3:pcie04: Link Down event ignored on 
(Continue reading)

Arnd Bergmann | 25 Feb 16:15 2015

[PATCH] pci-versatile.c: Update for API change in list_for_each_entry()

From: Joachim Nilsson <troglobit <at>>

In Linux 4.0-rc1 ARM Versatile PCI build fails to build due to what
appears to be an API update.  This patch is a very simple correction,
merely posted as a heads-up to the maintainers.  Hopefully a better
fix can be forwarded to Linus.

[arnd: the patch actually looks correct, so let's take this version]

Signed-off-by: Joachim Nilsson <troglobit <at>>
Signed-off-by: Arnd Bergmann <arnd <at>>

Joachim reported the bug, and I independently found the same problem.
The patch he sent to the list did not apply for me for an unknown reason,
but I fixed it up and forward it now to the right list of recipients.

diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c
index 1ec694a52379..464bf492ee2a 100644
--- a/drivers/pci/host/pci-versatile.c
+++ b/drivers/pci/host/pci-versatile.c
 <at>  <at>  -80,7 +80,7  <at>  <at>  static int versatile_pci_parse_request_of_pci_ranges(struct device *dev,
 	if (err)
 		return err;

-	resource_list_for_each_entry(win, res, list) {
+	resource_list_for_each_entry(win, res) {
 		struct resource *parent, *res = win->res;

 		switch (resource_type(res)) {
(Continue reading)

Rasmus Villemoes | 24 Feb 23:50 2015

[PATCH] PCI/AER: Avoid info leak in __print_tlp_header

Commit fab4c256a58b ("PCI/AER: Add a TLP header print helper")
introduced the helper function __print_tlp_header, but contrary to the
intention, the behaviour did change: Since we're taking the address of
the parameter t, the first 4 or 8 bytes printed will be the value of
the pointer t itself, and the remaining 12 or 8 bytes will be
who-knows-what (something from the stack).

We want to treat the four members of the struct aer_header_log_regs as
little-endian 32 bit numbers and print those. That can be done without
ugly and confusing casts.

Fixes: fab4c256a58b ("PCI/AER: Add a TLP header print helper")
Signed-off-by: Rasmus Villemoes <linux <at>>
 drivers/pci/pcie/aer/aerdrv_errprint.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index c6849d9e86ce..e328978038c1 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
 <at>  <at>  -132,16 +132,9  <at>  <at>  static const char *aer_agent_string[] = {
 static void __print_tlp_header(struct pci_dev *dev,
 			       struct aer_header_log_regs *t)
-	unsigned char *tlp = (unsigned char *)&t;
-	dev_err(&dev->dev, "  TLP Header:"
-		" %02x%02x%02x%02x %02x%02x%02x%02x"
-		" %02x%02x%02x%02x %02x%02x%02x%02x\n",
(Continue reading)

Bjorn Helgaas | 24 Feb 09:32 2015

[PATCH v12 00/21] Enable SRIOV on Power8

Wei Yang's most recent POWER8 SR-IOV patchset was v11, posted on Jan 15,

I'm having a hard time keeping everything straight between the tweaks I've
made on my branch and incremental updates.  I think it's easier to repost
the whole series so one can easily collect everything that goes together.
So here'a a v12 with the changes I've made.

Wei, please follow up with a v13 to fix anything I broke here.  Here's how
I would do that using stgit:

  git checkout -b pci/virtualization-v13 pci/virtualization-v12
  stg init
  stg uncommit -n 21
  <hack on the patches>
  stg mail -v v13 ... pci-print-more-info-in..powerpc-pci-add-pci-resource

I put v10, v11, and v12 on branches based on v4.0-rc1:

  pci/virtualization-v10	(posted 12/22/2014)
  pci/virtualization-v11	(posted 01/15/2015)
  pci/virtualization-v12	(this posting)

This makes it relatively easy to diff the versions, e.g.,

  git diff pci/virtualization-v11 pci/virtualization-v12

These branches are at
(Continue reading)

Phong Tran | 23 Feb 11:21 2015

[PATCH] PCI: xgene: Fix the map_bus callback prototype

The return value should be void __iomem *.
Tested by compile only.

Signed-off-by: Phong Tran <tranmanphong <at>>
 drivers/pci/host/pci-xgene.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index aab5547..9c3bfd8 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
 <at>  <at>  -127,7 +127,7  <at>  <at>  static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
 	return false;

-static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
+static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
 			      int offset)
 	struct xgene_pcie_port *port = bus->sysdata;


Matwey V. Kornilov | 19 Feb 18:41 2015

[PATCH v3] pci: spear: Drop __initdata from spear13xx_pcie_driver

spear13xx_pcie_driver.driver is allocated in text.init section
and then the pointer to it is passed futher. This patch is to avoid
crashes like the following, when freed memory is used.

Also, __init has been dropped from the probe() function referred from the struct
and all called functions.

 #0  __device_attach (drv=0xc0ed5608 <spear13xx_pcie_driver+20>, data=0xdb622610) at ../drivers/base/dd.c:409
 #1  0xc07a4798 in bus_for_each_drv (bus=<optimized out>, start=<optimized out>, data=0xda0,
fn=0xc07a6740 <__device_attach>)
    at ../drivers/base/bus.c:463
 #2  0xc07a6324 in device_attach (dev=0xdb622610) at ../drivers/base/dd.c:447
 #3  0xc07a5814 in bus_probe_device (dev=0xdb622610) at ../drivers/base/bus.c:558
 #4  0xc07a38d8 in device_add (dev=<optimized out>) at ../drivers/base/core.c:1058
 #5  0xc08b6a5c in of_device_add (ofdev=<optimized out>) at ../drivers/of/device.c:66
 #6  0xc08b742c in of_platform_device_create_pdata (np=<optimized out>, bus_id=0x0
<__vectors_start>, platform_data=0x0 <__vectors_start>,
    parent=<optimized out>) at ../drivers/of/platform.c:241
 #7  0xc08b7568 in of_platform_bus_create (bus=0xdfa46780, matches=0x0 <__vectors_start>,
lookup=0x0 <__vectors_start>, parent=0xdb183410,
    strict=true) at ../drivers/of/platform.c:414
 #8  0xc08b79bc in of_platform_populate (root=0xc0ed5608 <spear13xx_pcie_driver+20>,
matches=0xdb622610, lookup=0xda0,
    parent=0xc07a6740 <__device_attach>) at ../drivers/of/platform.c:501
 #9  0xbf000030 in am335x_child_probe (pdev=0xdb183400) at ../drivers/usb/musb/musb_am335x.c:12
 #10 0xc07a83f0 in platform_drv_probe (_dev=0xdb183410) at ../drivers/base/platform.c:512
 #11 0xc07a64e8 in really_probe (drv=<optimized out>, dev=<optimized out>) at ../drivers/base/dd.c:302
 #12 driver_probe_device (drv=0xbf000234, dev=0xdb183410) at ../drivers/base/dd.c:399
 #13 0xc07a6820 in __driver_attach (dev=0xdb183410, data=0xbf000234) at ../drivers/base/dd.c:477
 #14 0xc07a46e8 in bus_for_each_dev (bus=<optimized out>, start=<optimized out>, data=0xda0,
(Continue reading)