Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pci: Trace more information from pci_dn

Originally, EEH probes on device_node or pci_dev and populates the
corresponding eeh_dev. In the subsequent patches, EEH will probes
on pci_dn and populates the corresponding eeh_dev. So we have to
cache some information in pci_dn, either from device_node or SRIOV
PF's enablement platform hook, to populate the eeh_dev properly.

The motivation to probe pci_dn, instead of device node or pci_dev,
to populate eeh_dev is SRIOV VFs are dynamically created and we
don't have the corresponding device nodes for them.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Gavin Shan and committed by
Benjamin Herrenschmidt
c035ff1d 3532a741

+13
+3
arch/powerpc/include/asm/pci-bridge.h
··· 159 159 160 160 int busno; /* pci bus number */ 161 161 int devfn; /* pci device and function number */ 162 + int vendor_id; /* Vendor ID */ 163 + int device_id; /* Device ID */ 164 + int class_code; /* Device class code */ 162 165 163 166 struct pci_dn *parent; 164 167 struct pci_controller *phb; /* for pci devices */
+10
arch/powerpc/kernel/pci_dn.c
··· 166 166 pdn->devfn = (addr >> 8) & 0xff; 167 167 } 168 168 169 + /* vendor/device IDs and class code */ 170 + regs = of_get_property(dn, "vendor-id", NULL); 171 + pdn->vendor_id = regs ? of_read_number(regs, 1) : 0; 172 + regs = of_get_property(dn, "device-id", NULL); 173 + pdn->device_id = regs ? of_read_number(regs, 1) : 0; 174 + regs = of_get_property(dn, "class-code", NULL); 175 + pdn->class_code = regs ? of_read_number(regs, 1) : 0; 176 + 177 + /* Extended config space */ 169 178 pdn->pci_ext_config_space = (type && of_read_number(type, 1) == 1); 170 179 171 180 /* Attach to parent node */ ··· 264 255 pdn = dn->data; 265 256 if (pdn) { 266 257 pdn->devfn = pdn->busno = -1; 258 + pdn->vendor_id = pdn->device_id = pdn->class_code = 0; 267 259 pdn->phb = phb; 268 260 phb->pci_data = pdn; 269 261 }