Yijing Wang | 24 Apr 08:59 2015

[PATCH v2] PCI: Fix NULL pointer when find parent pcie_link_state

https://bugzilla.kernel.org/show_bug.cgi?id=94361 reported
in ATCA platform, system had unusual pcie topology:

(root port)   (downstream port)   (upstream port)
+-1c.0-[02-0a]----00.0-[03-0a]--+-00.0-[04]--
|                               +-01.0-[05]-- (downstream port)
|                               +-02.0-[06]--
|                               +-03.0-[07]--
|                               +-08.0-[08]--
|                               +-09.0-[09]--
|                               \-0a.0-[0a]--
We assumed root port and downstream port always
have external link, and downstream port always has a
upstream port. So in this case, when we allocated
pcie_link_state for downstream port 02:00.0, it try
to get parent bus pcie_link_state,
parent = pdev->bus->parent->self->link_state;
because root bus self is NULL, system will crash here.

This patch fix this issue based on the following
assumption suggested by Bjorn.
1. Root port is always on the upstream end of a link.
2. The pcie hierarchy should alternate between links
and internal switch logic, there should be no adjacent
links or internal buses in pcie tree.

Suggested-by: Bjorn Helgaas <bhelgaas <at> google.com>
Signed-off-by: Yijing Wang <wangyijing <at> huawei.com>
---
 drivers/pci/pcie/aspm.c |   23 +++++++++++++++++++++--
(Continue reading)

Michael Sander | 24 Apr 07:10 2015

Rescan and devices behind a bridge

“/sys/bus/pci/rescan” is not finding devices connected to a bridge. 

We have a server running CentOS 7.0 and a custom PCIe card with 2 PCIe 
extender cables going to a custom board with 3 PCIe devices. This board has 
a separate power supply. (All examples show a single extender being used.) 

If we power the board on first, then the server, the devices are all 
discovered. Here is what “lspci -tv” shows:

 |           \-13.6  Intel Corporation Xeon E5/Core i7 Ring to QuickPath 
Interconnect Link 1 Performance Monitor
 \-[0000:00]-+-00.0  Intel Corporation Xeon E5/Core i7 DMI2
             +-01.0-[01]--
             +-01.1-[02]--+-00.0  NVIDIA Corporation GT218 [ION]
             |            \-00.1  NVIDIA Corporation High Definition Audio 
Controller
             +-02.0-[03-0b]----00.0-[04-0b]--+-08.0-[05-0a]----00.0-[06-0a]-
-+-04.0-[07]----00.0  Xilinx Corporation Device 064c
             |                               |                               
+-05.0-[08]----00.0  Xilinx Corporation Device 064c
             |                               |                               
+-06.0-[09]----00.0  Xilinx Corporation Device 064c
             |                               |                               
\-07.0-[0a]----00.0  Xilinx Corporation Device 064c
             |                               \-10.0-[0b]--
             +-03.0-[0c]--

If we power the server on first, then the board , neither the devices are 
not discovered. Here is what “lspci -tv” shows:

(Continue reading)

Yijing Wang | 23 Apr 09:41 2015

[PATCH] PCI: Fix NULL pointer when find parent pcie_link_state

https://bugzilla.kernel.org/show_bug.cgi?id=94361 reported
NULL Pointer in pcie_aspm_init_link_state(), Some platform
like ATCA may has strange PCIe topology:
E.g.
---root port---downstream port---upstream port
                              |--downstream port
                              |--downstream port

When we try to alloc pcie_link_state, we assumed downstream port
always has a upstream port, in this case, NULL pointer would
be triggered when try to find the parent pci_link_state,
because downstream port connects to root port directly.

Signed-off-by: Yijing Wang <wangyijing <at> huawei.com>
---
 drivers/pci/pcie/aspm.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 7d4fcdc..f295824 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
 <at>  <at>  -526,8 +526,17  <at>  <at>  static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
 	INIT_LIST_HEAD(&link->link);
 	link->pdev = pdev;
 	if (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM) {
-		struct pcie_link_state *parent;
-		parent = pdev->bus->parent->self->link_state;
+		struct pci_bus *pbus = pdev->bus;
+		struct pcie_link_state *parent = NULL;
(Continue reading)

Matthew Wilcox | 22 Apr 22:27 2015
Picon

[PATCH] Report NUMA node in lspci -v


In multi-socket systems, it's useful to see which node a particular
PCI device belongs to.  Linux provides this information through sysfs,
but some users don't like poking through sysfs themselves to find it,
and it's pretty straightforward to report it in lspci.

I should note that when there is no NUMA node for a particular device,
Linux reports -1.  I've chosen to continue that convention in pciutils,
and simply omit the information if the device does not belong to a NUMA
node (eg on single-socket systems, or devices which are not preferentially
attached to a particular node, like Nehalem-based systems).

This is going to break the library ABI again (and I don't feel confident
adding those bits to this patch); might it be worth adding some more
padding to struct pci_dev?

diff --git a/lib/access.c b/lib/access.c
index d292085..a547d2c 100644
--- a/lib/access.c
+++ b/lib/access.c
 <at>  <at>  -28,6 +28,7  <at>  <at>  pci_alloc_dev(struct pci_access *a)
   d->access = a;
   d->methods = a->methods;
   d->hdrtype = -1;
+  d->numa_node = -1;
   if (d->methods->init_dev)
     d->methods->init_dev(d);
   return d;
diff --git a/lib/pci.h b/lib/pci.h
index bd6f6a1..0ccfbe3 100644
(Continue reading)

Bjorn Helgaas | 22 Apr 17:35 2015
Picon

[GIT PULL] PCI fixes for v4.1

Hi Linus,

These fix an ia64 regression caused by tighter resource checking we merged
during the merge window and remove an invalid email address from
MAINTAINERS.

Bjorn

The following changes since commit 3be1b98e073bdd4c1bb3144201a927c4a21330ba:

  Merge tag 'pci-v4.1-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
(2015-04-13 15:45:47 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git tags/pci-v4.1-fixes-1

for you to fetch changes up to 9fbbda5c8e0ab9c391e4160a0eb3a06260f9f668:

  ia64/PCI: Treat all host bridge Address Space Descriptors (even consumers) as windows (2015-04-21
15:29:39 -0500)

----------------------------------------------------------------
PCI updates for v4.1:

  Resource management
    - ia64: Treat all Address Space Descriptors as windows (Bjorn Helgaas)

  Miscellaneous
    - MAINTAINERS: Remove Mohit Kumar (email bounces) (Bjorn Helgaas)
(Continue reading)

Zhichang Yuan | 22 Apr 15:35 2015

[[PATCH v1]] of/pci: fix a bug in function pci_pio_to_address

In the patch whose commit id is 41f8bba7f5552d0, function pci_pio_to_address
was introduced to retieve the corresponding I/O port by CPU address. But the
convertion processing is not correct. It will return a wrong I/O port.
This patch will fix it.

Signed-off-by: Zhichang Yuan <yuanzhichang <at> hisilicon.com>
---
 drivers/of/address.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 78a7dcb..6906a3f 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
 <at>  <at>  -765,7 +765,7  <at>  <at>  unsigned long __weak pci_address_to_pio(phys_addr_t address)
 	spin_lock(&io_range_lock);
 	list_for_each_entry(res, &io_range_list, list) {
 		if (address >= res->start && address < res->start + res->size) {
-			addr = res->start - address + offset;
+			addr = address - res->start + offset;
 			break;
 		}
 		offset += res->size;
--

-- 
1.9.1

Jisheng Zhang | 22 Apr 14:58 2015

[PATCH 0/2] PCI: designware: improve iATU programming and usage

The outbound iATU programming functions are similar, so PATCH1 consolidates
them into one.

Most transactions' type are cfg0 and MEM, so current iATU usage is not
balanced. PATCH2 adopts idea from Minghuan Lian <Minghuan.Lian <at> freescale.com>:

 http://www.spinics.net/lists/linux-pci/msg40440.html

to change the iATU allocation: iATU0 for cfg and IO, iATU1 for MEM.

Jisheng Zhang (2):
  PCI: designware: consolidate outbound iATU programming functions
  PCI: designware: use iATU0 for cfg and IO, iATU1 for MEM

 drivers/pci/host/pcie-designware.c | 144 ++++++++++++++++---------------------
 1 file changed, 62 insertions(+), 82 deletions(-)

--

-- 
2.1.4

Bjorn Helgaas | 21 Apr 21:46 2015
Picon

[PATCH] MAINTAINERS: Remove Mohit Kumar (email bounces)

Email to Mohit Kumar <mohit.kumar <at> st.com> has been bouncing, so remove the
address from MAINTAINERS.  Let me know if you have an updated address or a
replacement.

Signed-off-by: Bjorn Helgaas <bhelgaas <at> google.com>
---
 MAINTAINERS |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 40eaa356e355..81cb034878e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
 <at>  <at>  -7515,7 +7515,6  <at>  <at>  S:	Maintained
 F:	drivers/pci/host/pci-exynos.c

 PCI DRIVER FOR SYNOPSIS DESIGNWARE
-M:	Mohit Kumar <mohit.kumar <at> st.com>
 M:	Jingoo Han <jg1.han <at> samsung.com>
 L:	linux-pci <at> vger.kernel.org
 S:	Maintained
 <at>  <at>  -7530,9 +7529,8  <at>  <at>  F:	Documentation/devicetree/bindings/pci/host-generic-pci.txt
 F:	drivers/pci/host/pci-host-generic.c

 PCIE DRIVER FOR ST SPEAR13XX
-M:	Mohit Kumar <mohit.kumar <at> st.com>
 L:	linux-pci <at> vger.kernel.org
-S:	Maintained
+S:	Orphan
 F:	drivers/pci/host/*spear*
(Continue reading)

Sonny Rao | 21 Apr 21:33 2015

[PATCHv2] perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver

This keeps all the related PCI IDs together in the driver where they
are used.

Signed-off-by: Sonny Rao <sonnyrao <at> chromium.org>
Acked-by: Bjorn Helgaas <bhelgaas <at> google.com>
---
 arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c | 6 +++++-
 include/linux/pci_ids.h                           | 4 ----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
index ca75e70..4562e9e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
 <at>  <at>  -1,7 +1,11  <at>  <at> 
 /* Nehalem/SandBridge/Haswell uncore support */
 #include "perf_event_intel_uncore.h"

-/* Uncore IMC PCI Id */
+/* Uncore IMC PCI IDs */
+#define PCI_DEVICE_ID_INTEL_SNB_IMC	0x0100
+#define PCI_DEVICE_ID_INTEL_IVB_IMC	0x0154
+#define PCI_DEVICE_ID_INTEL_IVB_E3_IMC	0x0150
+#define PCI_DEVICE_ID_INTEL_HSW_IMC	0x0c00
 #define PCI_DEVICE_ID_INTEL_HSW_U_IMC	0x0a04

 /* SNB event control */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 38cff8f..2f7b9a4 100644
--- a/include/linux/pci_ids.h
(Continue reading)

Sonny Rao | 21 Apr 21:09 2015

[PATCH] perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver

This keeps all the related PCI IDs together in the driver where they
are used.

Signed-off-by: Sonny Rao <sonnyrao <at> chromium.org>
---
 arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c | 6 +++++-
 include/linux/pci_ids.h                           | 4 ----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
index ca75e70..02c1a13 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
 <at>  <at>  -1,7 +1,11  <at>  <at> 
 /* Nehalem/SandBridge/Haswell uncore support */
 #include "perf_event_intel_uncore.h"

-/* Uncore IMC PCI Id */
+/* Uncore IMC PCI Ids */
+#define PCI_DEVICE_ID_INTEL_SNB_IMC	0x0100
+#define PCI_DEVICE_ID_INTEL_IVB_IMC	0x0154
+#define PCI_DEVICE_ID_INTEL_IVB_E3_IMC	0x0150
+#define PCI_DEVICE_ID_INTEL_HSW_IMC	0x0c00
 #define PCI_DEVICE_ID_INTEL_HSW_U_IMC	0x0a04

 /* SNB event control */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 38cff8f..2f7b9a4 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
(Continue reading)

Bjorn Helgaas | 21 Apr 01:30 2015
Picon

[PATCH] ia64/PCI: Treat all host bridge Address Space Descriptors (even consumers) as windows

Prior to c770cb4cb505 ("PCI: Mark invalid BARs as unassigned"), if we tried
to claim a PCI BAR but could not find an upstream bridge window that
matched it, we complained but still allowed the device to be enabled.

c770cb4cb505 broke devices that previously worked (mptsas and igb in the
case Tony reported, but it could be any devices) because it marks those
BARs as IORESOURCE_UNSET, which makes pci_enable_device() complain and
return failure:

  igb 0000:81:00.0: can't enable device: BAR 0 [mem size 0x00020000] not assigned
  igb: probe of 0000:81:00.0 failed with error -22

The underlying cause is an ACPI Address Space Descriptor for a PCI host
bridge window that is marked as "consumer".  This is a firmware defect:
resources that are produced on the downstream side of a bridge should be
marked "producer".  But rejecting these BARs that we previously allowed is
a functionality regression, and firmware has not used the producer/consumer
bit consistently, so we can't rely on it anyway.

Stop checking the producer/consumer bit, and assume all bridge Address
Space Descriptors are for bridge windows.

Note that this change does not affect I/O Port or Fixed Location I/O Port
Descriptors, which are commonly used for the [io 0x0cf8-0x0cff] config
access range.  That range is a "consumer" range and should not be treated
as a window.

Fixes: c770cb4cb505 ("PCI: Mark invalid BARs as unassigned")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=96961
Reported-and-tested-by: Tony Luck <tony.luck <at> intel.com>
(Continue reading)


Gmane