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

Merge branch 'pci/misc'

- Reorder struct pci_dev to avoid holes and reduce size (Christophe
JAILLET)

- Change pdev->rom_attr_enabled to single bit since it's only a boolean
value (Christophe JAILLET)

- Use struct_size() in pirq_convert_irt_table() instead of hand-writing it
(Christophe JAILLET)

- Explicitly include correct DT includes to untangle headers (Rob Herring)

- Fix a DOE race between destroy_work_on_stack() and the stack-allocated
task->work struct going out of scope in pci_doe() (Ira Weiny)

- Use pci_dev_id() when possible instead of manually composing ID from
dev->bus->number and dev->devfn (Xiongfeng Wang, Zheng Zengkai)

- Move pci_create_resource_files() declarations to linux/pci.h for alpha
build warnings (Arnd Bergmann)

- Remove unused hotplug function declarations (Yue Haibing)

- Remove unused mvebu struct mvebu_pcie.busn (Pali Rohár)

- Unexport pcie_port_bus_type (Bjorn Helgaas)

- Remove unnecessary sysfs ID local variable initialization (Bjorn Helgaas)

- Fix BAR value printk formatting to accommodate 32-bit values (Bjorn
Helgaas)

- Use consistent pointer types for config access syscall get_user() and
put_user() uses (Bjorn Helgaas)

- Simplify AER_RECOVER_RING_SIZE definition (Bjorn Helgaas)

- Simplify pci_pio_to_address() (Bjorn Helgaas)

- Simplify pci_dev_driver() (Bjorn Helgaas)

- Fix pci_bus_resetable(), pci_slot_resetable() name typos (Bjorn Helgaas)

- Fix code and doc typos and code formatting (Bjorn Helgaas)

- Tidy config space save/restore messages (Bjorn Helgaas)

* pci/misc:
PCI: Tidy config space save/restore messages
PCI: Fix code formatting inconsistencies
PCI: Fix typos in docs and comments
PCI: Fix pci_bus_resetable(), pci_slot_resetable() name typos
PCI: Simplify pci_dev_driver()
PCI: Simplify pci_pio_to_address()
PCI/AER: Simplify AER_RECOVER_RING_SIZE definition
PCI: Use consistent put_user() pointer types
PCI: Fix printk field formatting
PCI: Remove unnecessary initializations
PCI: Unexport pcie_port_bus_type
PCI: mvebu: Remove unused busn member
PCI: Remove unused function declarations
PCI/sysfs: Move declarations to linux/pci.h
PCI/P2PDMA: Use pci_dev_id() to simplify the code
PCI/IOV: Use pci_dev_id() to simplify the code
PCI/AER: Use pci_dev_id() to simplify the code
PCI: apple: Use pci_dev_id() to simplify the code
PCI/DOE: Fix destroy_work_on_stack() race
PCI: Explicitly include correct DT includes
x86/PCI: Use struct_size() in pirq_convert_irt_table()
PCI: Change pdev->rom_attr_enabled to single bit
PCI: Reorder pci_dev fields to reduce holes

+118 -148
+6 -6
Documentation/PCI/pci-error-recovery.rst
··· 17 17 and the PCI-host bridges found on IBM Power4, Power5 and Power6-based 18 18 pSeries boxes. A typical action taken is to disconnect the affected device, 19 19 halting all I/O to it. The goal of a disconnection is to avoid system 20 - corruption; for example, to halt system memory corruption due to DMA's 20 + corruption; for example, to halt system memory corruption due to DMAs 21 21 to "wild" addresses. Typically, a reconnection mechanism is also 22 22 offered, so that the affected PCI device(s) are reset and put back 23 23 into working condition. The reset phase requires coordination ··· 178 178 complex and not worth implementing. 179 179 180 180 The current powerpc implementation doesn't much care if the device 181 - attempts I/O at this point, or not. I/O's will fail, returning 181 + attempts I/O at this point, or not. I/Os will fail, returning 182 182 a value of 0xff on read, and writes will be dropped. If more than 183 - EEH_MAX_FAILS I/O's are attempted to a frozen adapter, EEH 183 + EEH_MAX_FAILS I/Os are attempted to a frozen adapter, EEH 184 184 assumes that the device driver has gone into an infinite loop 185 185 and prints an error to syslog. A reboot is then required to 186 186 get the device working again. ··· 204 204 .. note:: 205 205 206 206 The following is proposed; no platform implements this yet: 207 - Proposal: All I/O's should be done _synchronously_ from within 207 + Proposal: All I/Os should be done _synchronously_ from within 208 208 this callback, errors triggered by them will be returned via 209 209 the normal pci_check_whatever() API, no new error_detected() 210 210 callback will be issued due to an error happening here. However, ··· 258 258 soft reset(default) and fundamental(optional) reset. 259 259 260 260 Powerpc soft reset consists of asserting the adapter #RST line and then 261 - restoring the PCI BAR's and PCI configuration header to a state 261 + restoring the PCI BARs and PCI configuration header to a state 262 262 that is equivalent to what it would be after a fresh system 263 263 power-on followed by power-on BIOS/system firmware initialization. 264 264 Soft reset is also known as hot-reset. ··· 362 362 the operator will probably want to remove and replace the device. 363 363 Note, however, not all failures are truly "permanent". Some are 364 364 caused by over-heating, some by a poorly seated card. Many 365 - PCI error events are caused by software bugs, e.g. DMA's to 365 + PCI error events are caused by software bugs, e.g. DMAs to 366 366 wild addresses or bogus split transactions due to programming 367 367 errors. See the discussion in Documentation/powerpc/eeh-pci-error-recovery.rst 368 368 for additional detail on real-life experience of the causes of
-3
arch/alpha/include/asm/pci.h
··· 88 88 enum pci_mmap_state mmap_type); 89 89 #define HAVE_PCI_LEGACY 1 90 90 91 - extern int pci_create_resource_files(struct pci_dev *dev); 92 - extern void pci_remove_resource_files(struct pci_dev *dev); 93 - 94 91 #endif /* __ALPHA_PCI_H */
+2 -2
arch/x86/pci/irq.c
··· 136 136 if (ir->signature != IRT_SIGNATURE || !ir->used || ir->size < ir->used) 137 137 return NULL; 138 138 139 - size = sizeof(*ir) + ir->used * sizeof(ir->slots[0]); 139 + size = struct_size(ir, slots, ir->used); 140 140 if (size > limit - addr) 141 141 return NULL; 142 142 143 143 DBG(KERN_DEBUG "PCI: $IRT Interrupt Routing Table found at 0x%lx\n", 144 144 __pa(ir)); 145 145 146 - size = sizeof(*rt) + ir->used * sizeof(rt->slots[0]); 146 + size = struct_size(rt, slots, ir->used); 147 147 rt = kzalloc(size, GFP_KERNEL); 148 148 if (!rt) 149 149 return NULL;
+1 -1
drivers/pci/controller/cadence/pci-j721e.c
··· 14 14 #include <linux/irqdomain.h> 15 15 #include <linux/mfd/syscon.h> 16 16 #include <linux/of.h> 17 - #include <linux/of_device.h> 18 17 #include <linux/pci.h> 18 + #include <linux/platform_device.h> 19 19 #include <linux/pm_runtime.h> 20 20 #include <linux/regmap.h> 21 21
+1 -2
drivers/pci/controller/cadence/pcie-cadence-plat.c
··· 6 6 * Author: Tom Joseph <tjoseph@cadence.com> 7 7 */ 8 8 #include <linux/kernel.h> 9 - #include <linux/of_address.h> 9 + #include <linux/of.h> 10 10 #include <linux/of_pci.h> 11 11 #include <linux/platform_device.h> 12 12 #include <linux/pm_runtime.h> 13 - #include <linux/of_device.h> 14 13 #include "pcie-cadence.h" 15 14 16 15 #define CDNS_PLAT_CPU_TO_BUS_ADDR 0x0FFFFFFF
+1
drivers/pci/controller/cadence/pcie-cadence.c
··· 4 4 // Author: Cyrille Pitchen <cyrille.pitchen@free-electrons.com> 5 5 6 6 #include <linux/kernel.h> 7 + #include <linux/of.h> 7 8 8 9 #include "pcie-cadence.h" 9 10
+1 -1
drivers/pci/controller/cadence/pcie-cadence.h
··· 32 32 #define CDNS_PCIE_LM_ID_SUBSYS(sub) \ 33 33 (((sub) << CDNS_PCIE_LM_ID_SUBSYS_SHIFT) & CDNS_PCIE_LM_ID_SUBSYS_MASK) 34 34 35 - /* Root Port Requestor ID Register */ 35 + /* Root Port Requester ID Register */ 36 36 #define CDNS_PCIE_LM_RP_RID (CDNS_PCIE_LM_BASE + 0x0228) 37 37 #define CDNS_PCIE_LM_RP_RID_MASK GENMASK(15, 0) 38 38 #define CDNS_PCIE_LM_RP_RID_SHIFT 0
+1 -1
drivers/pci/controller/dwc/pci-dra7xx.c
··· 16 16 #include <linux/irqdomain.h> 17 17 #include <linux/kernel.h> 18 18 #include <linux/module.h> 19 - #include <linux/of_device.h> 19 + #include <linux/of.h> 20 20 #include <linux/of_gpio.h> 21 21 #include <linux/of_pci.h> 22 22 #include <linux/pci.h>
+1 -1
drivers/pci/controller/dwc/pci-exynos.c
··· 14 14 #include <linux/interrupt.h> 15 15 #include <linux/kernel.h> 16 16 #include <linux/init.h> 17 - #include <linux/of_device.h> 18 17 #include <linux/pci.h> 19 18 #include <linux/platform_device.h> 20 19 #include <linux/phy/phy.h> 21 20 #include <linux/regulator/consumer.h> 21 + #include <linux/mod_devicetable.h> 22 22 #include <linux/module.h> 23 23 24 24 #include "pcie-designware.h"
+1 -1
drivers/pci/controller/dwc/pci-imx6.c
··· 17 17 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 18 18 #include <linux/mfd/syscon/imx7-iomuxc-gpr.h> 19 19 #include <linux/module.h> 20 + #include <linux/of.h> 20 21 #include <linux/of_gpio.h> 21 - #include <linux/of_device.h> 22 22 #include <linux/of_address.h> 23 23 #include <linux/pci.h> 24 24 #include <linux/platform_device.h>
-1
drivers/pci/controller/dwc/pci-keystone.c
··· 19 19 #include <linux/mfd/syscon.h> 20 20 #include <linux/msi.h> 21 21 #include <linux/of.h> 22 - #include <linux/of_device.h> 23 22 #include <linux/of_irq.h> 24 23 #include <linux/of_pci.h> 25 24 #include <linux/phy/phy.h>
+1 -1
drivers/pci/controller/dwc/pci-meson.c
··· 9 9 #include <linux/clk.h> 10 10 #include <linux/delay.h> 11 11 #include <linux/gpio/consumer.h> 12 - #include <linux/of_device.h> 13 12 #include <linux/of_gpio.h> 14 13 #include <linux/pci.h> 15 14 #include <linux/platform_device.h> ··· 16 17 #include <linux/resource.h> 17 18 #include <linux/types.h> 18 19 #include <linux/phy/phy.h> 20 + #include <linux/mod_devicetable.h> 19 21 #include <linux/module.h> 20 22 21 23 #include "pcie-designware.h"
+1 -1
drivers/pci/controller/dwc/pcie-artpec6.c
··· 10 10 #include <linux/delay.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 - #include <linux/of_device.h> 13 + #include <linux/of.h> 14 14 #include <linux/pci.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/resource.h>
+1 -1
drivers/pci/controller/dwc/pcie-designware-plat.c
··· 12 12 #include <linux/interrupt.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 - #include <linux/of_device.h> 15 + #include <linux/of.h> 16 16 #include <linux/pci.h> 17 17 #include <linux/platform_device.h> 18 18 #include <linux/resource.h>
+1 -1
drivers/pci/controller/dwc/pcie-designware.c
··· 16 16 #include <linux/gpio/consumer.h> 17 17 #include <linux/ioport.h> 18 18 #include <linux/of.h> 19 - #include <linux/of_platform.h> 19 + #include <linux/platform_device.h> 20 20 #include <linux/sizes.h> 21 21 #include <linux/types.h> 22 22
+1 -1
drivers/pci/controller/dwc/pcie-dw-rockchip.c
··· 14 14 #include <linux/irqdomain.h> 15 15 #include <linux/mfd/syscon.h> 16 16 #include <linux/module.h> 17 - #include <linux/of_device.h> 17 + #include <linux/of.h> 18 18 #include <linux/of_irq.h> 19 19 #include <linux/phy/phy.h> 20 20 #include <linux/platform_device.h>
+2
drivers/pci/controller/dwc/pcie-intel-gw.c
··· 9 9 #include <linux/clk.h> 10 10 #include <linux/gpio/consumer.h> 11 11 #include <linux/iopoll.h> 12 + #include <linux/mod_devicetable.h> 12 13 #include <linux/pci_regs.h> 13 14 #include <linux/phy/phy.h> 14 15 #include <linux/platform_device.h> 16 + #include <linux/property.h> 15 17 #include <linux/reset.h> 16 18 17 19 #include "../../pci.h"
+1 -2
drivers/pci/controller/dwc/pcie-kirin.c
··· 16 16 #include <linux/gpio/consumer.h> 17 17 #include <linux/interrupt.h> 18 18 #include <linux/mfd/syscon.h> 19 - #include <linux/of_address.h> 20 - #include <linux/of_device.h> 19 + #include <linux/of.h> 21 20 #include <linux/of_gpio.h> 22 21 #include <linux/of_pci.h> 23 22 #include <linux/phy/phy.h>
+1 -1
drivers/pci/controller/dwc/pcie-qcom.c
··· 19 19 #include <linux/iopoll.h> 20 20 #include <linux/kernel.h> 21 21 #include <linux/init.h> 22 - #include <linux/of_device.h> 22 + #include <linux/of.h> 23 23 #include <linux/of_gpio.h> 24 24 #include <linux/pci.h> 25 25 #include <linux/pm_runtime.h>
-1
drivers/pci/controller/dwc/pcie-tegra194.c
··· 20 20 #include <linux/kernel.h> 21 21 #include <linux/module.h> 22 22 #include <linux/of.h> 23 - #include <linux/of_device.h> 24 23 #include <linux/of_gpio.h> 25 24 #include <linux/of_pci.h> 26 25 #include <linux/pci.h>
+1 -1
drivers/pci/controller/dwc/pcie-uniphier-ep.c
··· 11 11 #include <linux/delay.h> 12 12 #include <linux/init.h> 13 13 #include <linux/iopoll.h> 14 - #include <linux/of_device.h> 14 + #include <linux/of.h> 15 15 #include <linux/pci.h> 16 16 #include <linux/phy/phy.h> 17 17 #include <linux/platform_device.h>
-3
drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/module.h> 19 19 #include <linux/msi.h> 20 - #include <linux/of_address.h> 21 - #include <linux/of_irq.h> 22 - #include <linux/of_platform.h> 23 20 #include <linux/of_pci.h> 24 21 #include <linux/pci.h> 25 22 #include <linux/platform_device.h>
+1 -2
drivers/pci/controller/pci-ftpci100.c
··· 15 15 #include <linux/interrupt.h> 16 16 #include <linux/io.h> 17 17 #include <linux/kernel.h> 18 - #include <linux/of_address.h> 19 - #include <linux/of_device.h> 18 + #include <linux/of.h> 20 19 #include <linux/of_irq.h> 21 20 #include <linux/of_pci.h> 22 21 #include <linux/pci.h>
+1 -1
drivers/pci/controller/pci-host-common.c
··· 9 9 10 10 #include <linux/kernel.h> 11 11 #include <linux/module.h> 12 + #include <linux/of.h> 12 13 #include <linux/of_address.h> 13 - #include <linux/of_device.h> 14 14 #include <linux/of_pci.h> 15 15 #include <linux/pci-ecam.h> 16 16 #include <linux/platform_device.h>
+1 -2
drivers/pci/controller/pci-ixp4xx.c
··· 19 19 #include <linux/init.h> 20 20 #include <linux/io.h> 21 21 #include <linux/kernel.h> 22 - #include <linux/of_address.h> 23 - #include <linux/of_device.h> 22 + #include <linux/of.h> 24 23 #include <linux/of_pci.h> 25 24 #include <linux/pci.h> 26 25 #include <linux/platform_device.h>
+1 -1
drivers/pci/controller/pci-loongson.c
··· 5 5 * Copyright (C) 2020 Jiaxun Yang <jiaxun.yang@flygoat.com> 6 6 */ 7 7 8 - #include <linux/of_device.h> 8 + #include <linux/of.h> 9 9 #include <linux/of_pci.h> 10 10 #include <linux/pci.h> 11 11 #include <linux/pci_ids.h>
-1
drivers/pci/controller/pci-mvebu.c
··· 87 87 struct resource io; 88 88 struct resource realio; 89 89 struct resource mem; 90 - struct resource busn; 91 90 int nports; 92 91 }; 93 92
+1 -2
drivers/pci/controller/pci-v3-semi.c
··· 20 20 #include <linux/interrupt.h> 21 21 #include <linux/io.h> 22 22 #include <linux/kernel.h> 23 - #include <linux/of_address.h> 24 - #include <linux/of_device.h> 23 + #include <linux/of.h> 25 24 #include <linux/of_pci.h> 26 25 #include <linux/pci.h> 27 26 #include <linux/platform_device.h>
+2 -3
drivers/pci/controller/pcie-altera.c
··· 9 9 #include <linux/delay.h> 10 10 #include <linux/interrupt.h> 11 11 #include <linux/irqchip/chained_irq.h> 12 + #include <linux/irqdomain.h> 12 13 #include <linux/init.h> 13 14 #include <linux/module.h> 14 - #include <linux/of_address.h> 15 - #include <linux/of_device.h> 16 - #include <linux/of_irq.h> 15 + #include <linux/of.h> 17 16 #include <linux/of_pci.h> 18 17 #include <linux/pci.h> 19 18 #include <linux/platform_device.h>
+2 -2
drivers/pci/controller/pcie-apple.c
··· 670 670 static int apple_pcie_add_device(struct apple_pcie_port *port, 671 671 struct pci_dev *pdev) 672 672 { 673 - u32 sid, rid = PCI_DEVID(pdev->bus->number, pdev->devfn); 673 + u32 sid, rid = pci_dev_id(pdev); 674 674 int idx, err; 675 675 676 676 dev_dbg(&pdev->dev, "added to bus %s, index %d\n", ··· 701 701 static void apple_pcie_release_device(struct apple_pcie_port *port, 702 702 struct pci_dev *pdev) 703 703 { 704 - u32 rid = PCI_DEVID(pdev->bus->number, pdev->devfn); 704 + u32 rid = pci_dev_id(pdev); 705 705 int idx; 706 706 707 707 mutex_lock(&port->pcie->lock);
+1 -3
drivers/pci/controller/pcie-rockchip-host.c
··· 24 24 #include <linux/kernel.h> 25 25 #include <linux/mfd/syscon.h> 26 26 #include <linux/module.h> 27 - #include <linux/of_address.h> 28 - #include <linux/of_device.h> 27 + #include <linux/of.h> 29 28 #include <linux/of_pci.h> 30 - #include <linux/of_platform.h> 31 29 #include <linux/pci.h> 32 30 #include <linux/pci_ids.h> 33 31 #include <linux/phy/phy.h>
+1
drivers/pci/controller/pcie-rockchip.c
··· 15 15 #include <linux/delay.h> 16 16 #include <linux/gpio/consumer.h> 17 17 #include <linux/iopoll.h> 18 + #include <linux/of.h> 18 19 #include <linux/of_pci.h> 19 20 #include <linux/phy/phy.h> 20 21 #include <linux/platform_device.h>
+1 -1
drivers/pci/doe.c
··· 293 293 static void signal_task_complete(struct pci_doe_task *task, int rv) 294 294 { 295 295 task->rv = rv; 296 - task->complete(task); 297 296 destroy_work_on_stack(&task->work); 297 + task->complete(task); 298 298 } 299 299 300 300 static void signal_task_abort(struct pci_doe_task *task, int rv)
+16 -16
drivers/pci/endpoint/functions/pci-epf-vntb.c
··· 986 986 /*==== virtual PCI bus driver, which only load virtual NTB PCI driver ====*/ 987 987 988 988 static u32 pci_space[] = { 989 - 0xffffffff, /*DeviceID, Vendor ID*/ 990 - 0, /*Status, Command*/ 991 - 0xffffffff, /*Class code, subclass, prog if, revision id*/ 992 - 0x40, /*bist, header type, latency Timer, cache line size*/ 993 - 0, /*BAR 0*/ 994 - 0, /*BAR 1*/ 995 - 0, /*BAR 2*/ 996 - 0, /*BAR 3*/ 997 - 0, /*BAR 4*/ 998 - 0, /*BAR 5*/ 999 - 0, /*Cardbus cis point*/ 1000 - 0, /*Subsystem ID Subystem vendor id*/ 1001 - 0, /*ROM Base Address*/ 1002 - 0, /*Reserved, Cap. Point*/ 1003 - 0, /*Reserved,*/ 1004 - 0, /*Max Lat, Min Gnt, interrupt pin, interrupt line*/ 989 + 0xffffffff, /* Device ID, Vendor ID */ 990 + 0, /* Status, Command */ 991 + 0xffffffff, /* Base Class, Subclass, Prog Intf, Revision ID */ 992 + 0x40, /* BIST, Header Type, Latency Timer, Cache Line Size */ 993 + 0, /* BAR 0 */ 994 + 0, /* BAR 1 */ 995 + 0, /* BAR 2 */ 996 + 0, /* BAR 3 */ 997 + 0, /* BAR 4 */ 998 + 0, /* BAR 5 */ 999 + 0, /* Cardbus CIS Pointer */ 1000 + 0, /* Subsystem ID, Subsystem Vendor ID */ 1001 + 0, /* ROM Base Address */ 1002 + 0, /* Reserved, Capabilities Pointer */ 1003 + 0, /* Reserved */ 1004 + 0, /* Max_Lat, Min_Gnt, Interrupt Pin, Interrupt Line */ 1005 1005 }; 1006 1006 1007 1007 static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
-1
drivers/pci/endpoint/pci-epc-core.c
··· 9 9 #include <linux/device.h> 10 10 #include <linux/slab.h> 11 11 #include <linux/module.h> 12 - #include <linux/of_device.h> 13 12 14 13 #include <linux/pci-epc.h> 15 14 #include <linux/pci-epf.h>
-1
drivers/pci/hotplug/acpiphp.h
··· 178 178 int acpiphp_enable_slot(struct acpiphp_slot *slot); 179 179 int acpiphp_disable_slot(struct acpiphp_slot *slot); 180 180 u8 acpiphp_get_power_status(struct acpiphp_slot *slot); 181 - u8 acpiphp_get_attention_status(struct acpiphp_slot *slot); 182 181 u8 acpiphp_get_latch_status(struct acpiphp_slot *slot); 183 182 u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot); 184 183
-2
drivers/pci/hotplug/cpci_hotplug.h
··· 83 83 * board/chassis drivers. 84 84 */ 85 85 u8 cpci_get_attention_status(struct slot *slot); 86 - u8 cpci_get_latch_status(struct slot *slot); 87 - u8 cpci_get_adapter_status(struct slot *slot); 88 86 u16 cpci_get_hs_csr(struct slot *slot); 89 87 int cpci_set_attention_status(struct slot *slot, int status); 90 88 int cpci_check_and_clear_ins(struct slot *slot);
-2
drivers/pci/hotplug/ibmphp.h
··· 264 264 void ibmphp_free_ebda_hpc_queue(void); 265 265 int ibmphp_access_ebda(void); 266 266 struct slot *ibmphp_get_slot_from_physical_num(u8); 267 - int ibmphp_get_total_hp_slots(void); 268 - void ibmphp_free_ibm_slot(struct slot *); 269 267 void ibmphp_free_bus_info_queue(void); 270 268 void ibmphp_free_ebda_pci_rsrc_queue(void); 271 269 struct bus_info *ibmphp_find_same_bus_num(u32);
+1 -2
drivers/pci/iov.c
··· 41 41 return -EINVAL; 42 42 43 43 pf = pci_physfn(dev); 44 - return (((dev->bus->number << 8) + dev->devfn) - 45 - ((pf->bus->number << 8) + pf->devfn + pf->sriov->offset)) / 44 + return (pci_dev_id(dev) - (pci_dev_id(pf) + pf->sriov->offset)) / 46 45 pf->sriov->stride; 47 46 } 48 47 EXPORT_SYMBOL_GPL(pci_iov_vf_id);
+2 -2
drivers/pci/msi/irqdomain.c
··· 336 336 if (!irq_domain_is_msi_parent(domain)) { 337 337 /* 338 338 * For "global" PCI/MSI interrupt domains the associated 339 - * msi_domain_info::flags is the authoritive source of 339 + * msi_domain_info::flags is the authoritative source of 340 340 * information. 341 341 */ 342 342 info = domain->host_data; ··· 344 344 } else { 345 345 /* 346 346 * For MSI parent domains the supported feature set 347 - * is avaliable in the parent ops. This makes checks 347 + * is available in the parent ops. This makes checks 348 348 * possible before actually instantiating the 349 349 * per device domain because the parent is never 350 350 * expanding the PCI/MSI functionality.
+2 -3
drivers/pci/p2pdma.c
··· 435 435 /* Intel Xeon E7 v3/Xeon E5 v3/Core i7 */ 436 436 {PCI_VENDOR_ID_INTEL, 0x2f00, REQ_SAME_HOST_BRIDGE}, 437 437 {PCI_VENDOR_ID_INTEL, 0x2f01, REQ_SAME_HOST_BRIDGE}, 438 - /* Intel SkyLake-E */ 438 + /* Intel Skylake-E */ 439 439 {PCI_VENDOR_ID_INTEL, 0x2030, 0}, 440 440 {PCI_VENDOR_ID_INTEL, 0x2031, 0}, 441 441 {PCI_VENDOR_ID_INTEL, 0x2032, 0}, ··· 532 532 533 533 static unsigned long map_types_idx(struct pci_dev *client) 534 534 { 535 - return (pci_domain_nr(client->bus) << 16) | 536 - (client->bus->number << 8) | client->devfn; 535 + return (pci_domain_nr(client->bus) << 16) | pci_dev_id(client); 537 536 } 538 537 539 538 /*
+9 -9
drivers/pci/pci-driver.c
··· 193 193 u32 vendor, device, subvendor = PCI_ANY_ID, 194 194 subdevice = PCI_ANY_ID, class = 0, class_mask = 0; 195 195 unsigned long driver_data = 0; 196 - int fields = 0; 196 + int fields; 197 197 int retval = 0; 198 198 199 199 fields = sscanf(buf, "%x %x %x %x %x %x %lx", ··· 260 260 struct pci_driver *pdrv = to_pci_driver(driver); 261 261 u32 vendor, device, subvendor = PCI_ANY_ID, 262 262 subdevice = PCI_ANY_ID, class = 0, class_mask = 0; 263 - int fields = 0; 263 + int fields; 264 264 size_t retval = -ENODEV; 265 265 266 266 fields = sscanf(buf, "%x %x %x %x %x %x", ··· 1474 1474 */ 1475 1475 struct pci_driver *pci_dev_driver(const struct pci_dev *dev) 1476 1476 { 1477 + int i; 1478 + 1477 1479 if (dev->driver) 1478 1480 return dev->driver; 1479 - else { 1480 - int i; 1481 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) 1482 - if (dev->resource[i].flags & IORESOURCE_BUSY) 1483 - return &pci_compat_driver; 1484 - } 1481 + 1482 + for (i = 0; i <= PCI_ROM_RESOURCE; i++) 1483 + if (dev->resource[i].flags & IORESOURCE_BUSY) 1484 + return &pci_compat_driver; 1485 + 1485 1486 return NULL; 1486 1487 } 1487 1488 EXPORT_SYMBOL(pci_dev_driver); ··· 1706 1705 .name = "pci_express", 1707 1706 .match = pcie_port_bus_match, 1708 1707 }; 1709 - EXPORT_SYMBOL_GPL(pcie_port_bus_type); 1710 1708 #endif 1711 1709 1712 1710 static int __init pci_driver_init(void)
+12 -16
drivers/pci/pci.c
··· 1291 1291 * 1292 1292 * Call pci_power_up() to put @dev into D0, read from its PCI_PM_CTRL register 1293 1293 * to confirm the state change, restore its BARs if they might be lost and 1294 - * reconfigure ASPM in acordance with the new power state. 1294 + * reconfigure ASPM in accordance with the new power state. 1295 1295 * 1296 1296 * If pci_restore_state() is going to be called right after a power state change 1297 1297 * to D0, it is more efficient to use pci_power_up() directly instead of this ··· 1686 1686 /* XXX: 100% dword access ok here? */ 1687 1687 for (i = 0; i < 16; i++) { 1688 1688 pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]); 1689 - pci_dbg(dev, "saving config space at offset %#x (reading %#x)\n", 1689 + pci_dbg(dev, "save config %#04x: %#010x\n", 1690 1690 i * 4, dev->saved_config_space[i]); 1691 1691 } 1692 1692 dev->state_saved = true; ··· 1717 1717 return; 1718 1718 1719 1719 for (;;) { 1720 - pci_dbg(pdev, "restoring config space at offset %#x (was %#x, writing %#x)\n", 1720 + pci_dbg(pdev, "restore config %#04x: %#010x -> %#010x\n", 1721 1721 offset, val, saved_val); 1722 1722 pci_write_config_dword(pdev, offset, saved_val); 1723 1723 if (retry-- <= 0) ··· 4205 4205 4206 4206 phys_addr_t pci_pio_to_address(unsigned long pio) 4207 4207 { 4208 - phys_addr_t address = (phys_addr_t)OF_BAD_ADDR; 4209 - 4210 4208 #ifdef PCI_IOBASE 4211 - if (pio >= MMIO_UPPER_LIMIT) 4212 - return address; 4213 - 4214 - address = logic_pio_to_hwaddr(pio); 4209 + if (pio < MMIO_UPPER_LIMIT) 4210 + return logic_pio_to_hwaddr(pio); 4215 4211 #endif 4216 4212 4217 - return address; 4213 + return (phys_addr_t) OF_BAD_ADDR; 4218 4214 } 4219 4215 EXPORT_SYMBOL_GPL(pci_pio_to_address); 4220 4216 ··· 5637 5641 EXPORT_SYMBOL_GPL(pci_try_reset_function); 5638 5642 5639 5643 /* Do any devices on or below this bus prevent a bus reset? */ 5640 - static bool pci_bus_resetable(struct pci_bus *bus) 5644 + static bool pci_bus_resettable(struct pci_bus *bus) 5641 5645 { 5642 5646 struct pci_dev *dev; 5643 5647 ··· 5647 5651 5648 5652 list_for_each_entry(dev, &bus->devices, bus_list) { 5649 5653 if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || 5650 - (dev->subordinate && !pci_bus_resetable(dev->subordinate))) 5654 + (dev->subordinate && !pci_bus_resettable(dev->subordinate))) 5651 5655 return false; 5652 5656 } 5653 5657 ··· 5705 5709 } 5706 5710 5707 5711 /* Do any devices on or below this slot prevent a bus reset? */ 5708 - static bool pci_slot_resetable(struct pci_slot *slot) 5712 + static bool pci_slot_resettable(struct pci_slot *slot) 5709 5713 { 5710 5714 struct pci_dev *dev; 5711 5715 ··· 5717 5721 if (!dev->slot || dev->slot != slot) 5718 5722 continue; 5719 5723 if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || 5720 - (dev->subordinate && !pci_bus_resetable(dev->subordinate))) 5724 + (dev->subordinate && !pci_bus_resettable(dev->subordinate))) 5721 5725 return false; 5722 5726 } 5723 5727 ··· 5853 5857 { 5854 5858 int rc; 5855 5859 5856 - if (!slot || !pci_slot_resetable(slot)) 5860 + if (!slot || !pci_slot_resettable(slot)) 5857 5861 return -ENOTTY; 5858 5862 5859 5863 if (!probe) ··· 5920 5924 { 5921 5925 int ret; 5922 5926 5923 - if (!bus->self || !pci_bus_resetable(bus)) 5927 + if (!bus->self || !pci_bus_resettable(bus)) 5924 5928 return -ENOTTY; 5925 5929 5926 5930 if (probe)
+14 -21
drivers/pci/pci.h
··· 153 153 void pci_create_legacy_files(struct pci_bus *bus); 154 154 void pci_remove_legacy_files(struct pci_bus *bus); 155 155 #else 156 - static inline void pci_create_legacy_files(struct pci_bus *bus) { return; } 157 - static inline void pci_remove_legacy_files(struct pci_bus *bus) { return; } 156 + static inline void pci_create_legacy_files(struct pci_bus *bus) { } 157 + static inline void pci_remove_legacy_files(struct pci_bus *bus) { } 158 158 #endif 159 159 160 160 /* Lock for read/write access to pci device and bus lists */ ··· 428 428 pci_ers_result_t dpc_reset_link(struct pci_dev *pdev); 429 429 bool pci_dpc_recovered(struct pci_dev *pdev); 430 430 #else 431 - static inline void pci_save_dpc_state(struct pci_dev *dev) {} 432 - static inline void pci_restore_dpc_state(struct pci_dev *dev) {} 433 - static inline void pci_dpc_init(struct pci_dev *pdev) {} 431 + static inline void pci_save_dpc_state(struct pci_dev *dev) { } 432 + static inline void pci_restore_dpc_state(struct pci_dev *dev) { } 433 + static inline void pci_dpc_init(struct pci_dev *pdev) { } 434 434 static inline bool pci_dpc_recovered(struct pci_dev *pdev) { return false; } 435 435 #endif 436 436 ··· 442 442 int (*cb)(struct pci_dev *, void *), 443 443 void *userdata); 444 444 #else 445 - static inline void pci_rcec_init(struct pci_dev *dev) {} 446 - static inline void pci_rcec_exit(struct pci_dev *dev) {} 447 - static inline void pcie_link_rcec(struct pci_dev *rcec) {} 445 + static inline void pci_rcec_init(struct pci_dev *dev) { } 446 + static inline void pci_rcec_exit(struct pci_dev *dev) { } 447 + static inline void pcie_link_rcec(struct pci_dev *rcec) { } 448 448 static inline void pcie_walk_rcec(struct pci_dev *rcec, 449 449 int (*cb)(struct pci_dev *, void *), 450 - void *userdata) {} 450 + void *userdata) { } 451 451 #endif 452 452 453 453 #ifdef CONFIG_PCI_ATS ··· 490 490 { 491 491 return -ENODEV; 492 492 } 493 - static inline void pci_iov_release(struct pci_dev *dev) 494 - 495 - { 496 - } 497 - static inline void pci_iov_remove(struct pci_dev *dev) 498 - { 499 - } 500 - static inline void pci_restore_iov_state(struct pci_dev *dev) 501 - { 502 - } 493 + static inline void pci_iov_release(struct pci_dev *dev) { } 494 + static inline void pci_iov_remove(struct pci_dev *dev) { } 495 + static inline void pci_restore_iov_state(struct pci_dev *dev) { } 503 496 static inline int pci_iov_bus_range(struct pci_bus *bus) 504 497 { 505 498 return 0; ··· 717 724 { 718 725 return -ENOTTY; 719 726 } 720 - static inline void pci_set_acpi_fwnode(struct pci_dev *dev) {} 727 + static inline void pci_set_acpi_fwnode(struct pci_dev *dev) { } 721 728 static inline int pci_acpi_program_hp_params(struct pci_dev *dev) 722 729 { 723 730 return -ENODEV; ··· 738 745 { 739 746 return PCI_UNKNOWN; 740 747 } 741 - static inline void acpi_pci_refresh_power_state(struct pci_dev *dev) {} 748 + static inline void acpi_pci_refresh_power_state(struct pci_dev *dev) { } 742 749 static inline int acpi_pci_wakeup(struct pci_dev *dev, bool enable) 743 750 { 744 751 return -ENODEV;
+3 -4
drivers/pci/pcie/aer.c
··· 699 699 void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 700 700 { 701 701 int layer, agent; 702 - int id = ((dev->bus->number << 8) | dev->devfn); 702 + int id = pci_dev_id(dev); 703 703 const char *level; 704 704 705 705 if (!info->status) { ··· 834 834 if ((PCI_BUS_NUM(e_info->id) != 0) && 835 835 !(dev->bus->bus_flags & PCI_BUS_FLAGS_NO_AERSID)) { 836 836 /* Device ID match? */ 837 - if (e_info->id == ((dev->bus->number << 8) | dev->devfn)) 837 + if (e_info->id == pci_dev_id(dev)) 838 838 return true; 839 839 840 840 /* Continue id comparing if there is no multiple error */ ··· 968 968 969 969 #ifdef CONFIG_ACPI_APEI_PCIEAER 970 970 971 - #define AER_RECOVER_RING_ORDER 4 972 - #define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER) 971 + #define AER_RECOVER_RING_SIZE 16 973 972 974 973 struct aer_recover_entry { 975 974 u8 bus;
+1 -2
drivers/pci/probe.c
··· 8 8 #include <linux/init.h> 9 9 #include <linux/pci.h> 10 10 #include <linux/msi.h> 11 - #include <linux/of_device.h> 12 11 #include <linux/of_pci.h> 13 12 #include <linux/pci_hotplug.h> 14 13 #include <linux/slab.h> ··· 2136 2137 { 2137 2138 struct pci_dev *root; 2138 2139 2139 - /* PCI_EXP_DEVICE_RELAX_EN is RsvdP in VFs */ 2140 + /* PCI_EXP_DEVCTL_RELAX_EN is RsvdP in VFs */ 2140 2141 if (dev->is_virtfn) 2141 2142 return; 2142 2143
+4 -4
drivers/pci/quirks.c
··· 363 363 364 364 #ifdef CONFIG_HAS_IOPORT 365 365 /* 366 - * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear 366 + * Intel NM10 "Tiger Point" LPC PM1a_STS.BM_STS must be clear 367 367 * for some HT machines to use C4 w/o hanging. 368 368 */ 369 369 static void quirk_tigerpoint_bm_sts(struct pci_dev *dev) ··· 376 376 pm1a = inw(pmbase); 377 377 378 378 if (pm1a & 0x10) { 379 - pci_info(dev, FW_BUG "TigerPoint LPC.BM_STS cleared\n"); 379 + pci_info(dev, FW_BUG "Tiger Point LPC.BM_STS cleared\n"); 380 380 outw(0x10, pmbase); 381 381 } 382 382 } ··· 3075 3075 3076 3076 /* 3077 3077 * HT MSI mapping should be disabled on devices that are below 3078 - * a non-Hypertransport host bridge. Locate the host bridge... 3078 + * a non-HyperTransport host bridge. Locate the host bridge. 3079 3079 */ 3080 3080 host_bridge = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), 0, 3081 3081 PCI_DEVFN(0, 0)); ··· 5731 5731 /* 5732 5732 * Microsemi Switchtec NTB uses devfn proxy IDs to move TLPs between 5733 5733 * NT endpoints via the internal switch fabric. These IDs replace the 5734 - * originating requestor ID TLPs which access host memory on peer NTB 5734 + * originating Requester ID TLPs which access host memory on peer NTB 5735 5735 * ports. Therefore, all proxy IDs must be aliased to the NTB device 5736 5736 * to permit access when the IOMMU is turned on. 5737 5737 */
+1 -1
drivers/pci/setup-bus.c
··· 1799 1799 * Make sure prefetchable memory is reduced from 1800 1800 * the correct resource. Specifically we put 32-bit 1801 1801 * prefetchable memory in non-prefetchable window 1802 - * if there is an 64-bit pretchable window. 1802 + * if there is an 64-bit prefetchable window. 1803 1803 * 1804 1804 * See comments in __pci_bus_size_bridges() for 1805 1805 * more information.
+2 -2
drivers/pci/setup-res.c
··· 104 104 pci_read_config_dword(dev, reg, &check); 105 105 106 106 if ((new ^ check) & mask) { 107 - pci_err(dev, "BAR %d: error updating (%#08x != %#08x)\n", 107 + pci_err(dev, "BAR %d: error updating (%#010x != %#010x)\n", 108 108 resno, new, check); 109 109 } 110 110 ··· 113 113 pci_write_config_dword(dev, reg + 4, new); 114 114 pci_read_config_dword(dev, reg + 4, &check); 115 115 if (check != new) { 116 - pci_err(dev, "BAR %d: error updating (high %#08x != %#08x)\n", 116 + pci_err(dev, "BAR %d: error updating (high %#010x != %#010x)\n", 117 117 resno, new, check); 118 118 } 119 119 }
+6 -6
drivers/pci/syscall.c
··· 52 52 53 53 switch (len) { 54 54 case 1: 55 - err = put_user(byte, (unsigned char __user *)buf); 55 + err = put_user(byte, (u8 __user *)buf); 56 56 break; 57 57 case 2: 58 - err = put_user(word, (unsigned short __user *)buf); 58 + err = put_user(word, (u16 __user *)buf); 59 59 break; 60 60 case 4: 61 - err = put_user(dword, (unsigned int __user *)buf); 61 + err = put_user(dword, (u32 __user *)buf); 62 62 break; 63 63 } 64 64 pci_dev_put(dev); ··· 70 70 they get instead of a machine check on x86. */ 71 71 switch (len) { 72 72 case 1: 73 - put_user(-1, (unsigned char __user *)buf); 73 + put_user(-1, (u8 __user *)buf); 74 74 break; 75 75 case 2: 76 - put_user(-1, (unsigned short __user *)buf); 76 + put_user(-1, (u16 __user *)buf); 77 77 break; 78 78 case 4: 79 - put_user(-1, (unsigned int __user *)buf); 79 + put_user(-1, (u32 __user *)buf); 80 80 break; 81 81 } 82 82 pci_dev_put(dev);
+8 -4
include/linux/pci.h
··· 366 366 pci_power_t current_state; /* Current operating state. In ACPI, 367 367 this is D0-D3, D0 being fully 368 368 functional, and D3 being off. */ 369 - unsigned int imm_ready:1; /* Supports Immediate Readiness */ 370 369 u8 pm_cap; /* PM capability offset */ 370 + unsigned int imm_ready:1; /* Supports Immediate Readiness */ 371 371 unsigned int pme_support:5; /* Bitmask of states from which PME# 372 372 can be generated */ 373 373 unsigned int pme_poll:1; /* Poll device's PME status bit */ ··· 392 392 393 393 #ifdef CONFIG_PCIEASPM 394 394 struct pcie_link_state *link_state; /* ASPM link state */ 395 + u16 l1ss; /* L1SS Capability pointer */ 395 396 unsigned int ltr_path:1; /* Latency Tolerance Reporting 396 397 supported from root to here */ 397 - u16 l1ss; /* L1SS Capability pointer */ 398 398 #endif 399 399 unsigned int pasid_no_tlp:1; /* PASID works without TLP Prefix */ 400 400 unsigned int eetlp_prefix_path:1; /* End-to-End TLP Prefix */ ··· 464 464 unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */ 465 465 unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */ 466 466 unsigned int rom_bar_overlap:1; /* ROM BAR disable broken */ 467 + unsigned int rom_attr_enabled:1; /* Display of ROM attribute enabled? */ 467 468 pci_dev_flags_t dev_flags; 468 469 atomic_t enable_cnt; /* pci_enable_device has been called */ 469 470 470 471 spinlock_t pcie_cap_lock; /* Protects RMW ops in capability accessors */ 471 472 u32 saved_config_space[16]; /* Config space saved at suspend time */ 472 473 struct hlist_head saved_cap_space; 473 - int rom_attr_enabled; /* Display of ROM attribute enabled? */ 474 474 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 475 475 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ 476 476 ··· 1433 1433 void pci_assign_unassigned_bus_resources(struct pci_bus *bus); 1434 1434 void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus); 1435 1435 int pci_reassign_bridge_resources(struct pci_dev *bridge, unsigned long type); 1436 - void pdev_enable_device(struct pci_dev *); 1437 1436 int pci_enable_resources(struct pci_dev *, int mask); 1438 1437 void pci_assign_irq(struct pci_dev *dev); 1439 1438 struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res); ··· 2288 2289 int pcibios_alloc_irq(struct pci_dev *dev); 2289 2290 void pcibios_free_irq(struct pci_dev *dev); 2290 2291 resource_size_t pcibios_default_alignment(void); 2292 + 2293 + #if !defined(HAVE_PCI_MMAP) && !defined(ARCH_GENERIC_PCI_MMAP_RESOURCE) 2294 + extern int pci_create_resource_files(struct pci_dev *dev); 2295 + extern void pci_remove_resource_files(struct pci_dev *dev); 2296 + #endif 2291 2297 2292 2298 #if defined(CONFIG_PCI_MMCONFIG) || defined(CONFIG_ACPI_MCFG) 2293 2299 void __init pci_mmcfg_early_init(void);