aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-06 21:31:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-06 21:31:06 -0400
commit3c0d551e02b2590fa71a1354f2f1994551a33315 (patch)
treeda94dc3559fe0c63fcc13852b53ba3d3b08d5292 /arch/xtensa
parent19fd08b85bc7e0502b55cd726f466df82ee7e777 (diff)
parent5f764419098671cfffcfc44f8a5220afd3e37864 (diff)
Merge tag 'pci-v4.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas: - move pci_uevent_ers() out of pci.h (Michael Ellerman) - skip ASPM common clock warning if BIOS already configured it (Sinan Kaya) - fix ASPM Coverity warning about threshold_ns (Gustavo A. R. Silva) - remove last user of pci_get_bus_and_slot() and the function itself (Sinan Kaya) - add decoding for 16 GT/s link speed (Jay Fang) - add interfaces to get max link speed and width (Tal Gilboa) - add pcie_bandwidth_capable() to compute max supported link bandwidth (Tal Gilboa) - add pcie_bandwidth_available() to compute bandwidth available to device (Tal Gilboa) - add pcie_print_link_status() to log link speed and whether it's limited (Tal Gilboa) - use PCI core interfaces to report when device performance may be limited by its slot instead of doing it in each driver (Tal Gilboa) - fix possible cpqphp NULL pointer dereference (Shawn Lin) - rescan more of the hierarchy on ACPI hotplug to fix Thunderbolt/xHCI hotplug (Mika Westerberg) - add support for PCI I/O port space that's neither directly accessible via CPU in/out instructions nor directly mapped into CPU physical memory space. This is fairly intrusive and includes minor changes to interfaces used for I/O space on most platforms (Zhichang Yuan, John Garry) - add support for HiSilicon Hip06/Hip07 LPC I/O space (Zhichang Yuan, John Garry) - use PCI_EXP_DEVCTL2_COMP_TIMEOUT in rapidio/tsi721 (Bjorn Helgaas) - remove possible NULL pointer dereference in of_pci_bus_find_domain_nr() (Shawn Lin) - report quirk timings with dev_info (Bjorn Helgaas) - report quirks that take longer than 10ms (Bjorn Helgaas) - add and use Altera Vendor ID (Johannes Thumshirn) - tidy Makefiles and comments (Bjorn Helgaas) - don't set up INTx if MSI or MSI-X is enabled to align cris, frv, ia64, and mn10300 with x86 (Bjorn Helgaas) - move pcieport_if.h to drivers/pci/pcie/ to encapsulate it (Frederick Lawler) - merge pcieport_if.h into portdrv.h (Bjorn Helgaas) - move workaround for BIOS PME issue from portdrv to PCI core (Bjorn Helgaas) - completely disable portdrv with "pcie_ports=compat" (Bjorn Helgaas) - remove portdrv link order dependency (Bjorn Helgaas) - remove support for unused VC portdrv service (Bjorn Helgaas) - simplify portdrv feature permission checking (Bjorn Helgaas) - remove "pcie_hp=nomsi" parameter (use "pci=nomsi" instead) (Bjorn Helgaas) - remove unnecessary "pcie_ports=auto" parameter (Bjorn Helgaas) - use cached AER capability offset (Frederick Lawler) - don't enable DPC if BIOS hasn't granted AER control (Mika Westerberg) - rename pcie-dpc.c to dpc.c (Bjorn Helgaas) - use generic pci_mmap_resource_range() instead of powerpc and xtensa arch-specific versions (David Woodhouse) - support arbitrary PCI host bridge offsets on sparc (Yinghai Lu) - remove System and Video ROM reservations on sparc (Bjorn Helgaas) - probe for device reset support during enumeration instead of runtime (Bjorn Helgaas) - add ACS quirk for Ampere (née APM) root ports (Feng Kan) - add function 1 DMA alias quirk for Marvell 88SE9220 (Thomas Vincent-Cross) - protect device restore with device lock (Sinan Kaya) - handle failure of FLR gracefully (Sinan Kaya) - handle CRS (config retry status) after device resets (Sinan Kaya) - skip various config reads for SR-IOV VFs as an optimization (KarimAllah Ahmed) - consolidate VPD code in vpd.c (Bjorn Helgaas) - add Tegra dependency on PCI_MSI_IRQ_DOMAIN (Arnd Bergmann) - add DT support for R-Car r8a7743 (Biju Das) - fix a PCI_EJECT vs PCI_BUS_RELATIONS race condition in Hyper-V host bridge driver that causes a general protection fault (Dexuan Cui) - fix Hyper-V host bridge hang in MSI setup on 1-vCPU VMs with SR-IOV (Dexuan Cui) - fix Hyper-V host bridge hang when ejecting a VF before setting up MSI (Dexuan Cui) - make several structures static (Fengguang Wu) - increase number of MSI IRQs supported by Synopsys DesignWare bridges from 32 to 256 (Gustavo Pimentel) - implemented multiplexed IRQ domain API and remove obsolete MSI IRQ API from DesignWare drivers (Gustavo Pimentel) - add Tegra power management support (Manikanta Maddireddy) - add Tegra loadable module support (Manikanta Maddireddy) - handle 64-bit BARs correctly in endpoint support (Niklas Cassel) - support optional regulator for HiSilicon STB (Shawn Guo) - use regulator bulk API for Qualcomm apq8064 (Srinivas Kandagatla) - support power supplies for Qualcomm msm8996 (Srinivas Kandagatla) * tag 'pci-v4.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (123 commits) MAINTAINERS: Add John Garry as maintainer for HiSilicon LPC driver HISI LPC: Add ACPI support ACPI / scan: Do not enumerate Indirect IO host children ACPI / scan: Rename acpi_is_serial_bus_slave() for more general use HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings of: Add missing I/O range exception for indirect-IO devices PCI: Apply the new generic I/O management on PCI IO hosts PCI: Add fwnode handler as input param of pci_register_io_range() PCI: Remove __weak tag from pci_register_io_range() MAINTAINERS: Add missing /drivers/pci/cadence directory entry fm10k: Report PCIe link properties with pcie_print_link_status() net/mlx5e: Use pcie_bandwidth_available() to compute bandwidth net/mlx5: Report PCIe link properties with pcie_print_link_status() net/mlx4_core: Report PCIe link properties with pcie_print_link_status() PCI: Add pcie_print_link_status() to log link speed and whether it's limited PCI: Add pcie_bandwidth_available() to compute bandwidth available to device misc: pci_endpoint_test: Handle 64-bit BARs properly PCI: designware-ep: Make dw_pcie_ep_reset_bar() handle 64-bit BARs properly PCI: endpoint: Make sure that BAR_5 does not have 64-bit flag set when clearing PCI: endpoint: Make epc->ops->clear_bar()/pci_epc_clear_bar() take struct *epf_bar ...
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/include/asm/pci.h7
-rw-r--r--arch/xtensa/kernel/pci.c94
2 files changed, 12 insertions, 89 deletions
diff --git a/arch/xtensa/include/asm/pci.h b/arch/xtensa/include/asm/pci.h
index 5c83798e3b2e..d5a82153a7c5 100644
--- a/arch/xtensa/include/asm/pci.h
+++ b/arch/xtensa/include/asm/pci.h
@@ -44,9 +44,10 @@ extern struct pci_controller* pcibios_alloc_controller(void);
44 44
45#define PCI_DMA_BUS_IS_PHYS (1) 45#define PCI_DMA_BUS_IS_PHYS (1)
46 46
47/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ 47/* Tell PCI code what kind of PCI resource mappings we support */
48#define HAVE_PCI_MMAP 1 48#define HAVE_PCI_MMAP 1
49#define arch_can_pci_mmap_io() 1 49#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
50#define arch_can_pci_mmap_io() 1
50 51
51#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
52 53
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index d981f01c8d89..b7c7a60c7000 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -39,7 +39,6 @@
39 * pcibios_align_resource 39 * pcibios_align_resource
40 * pcibios_fixup_bus 40 * pcibios_fixup_bus
41 * pci_bus_add_device 41 * pci_bus_add_device
42 * pci_mmap_page_range
43 */ 42 */
44 43
45struct pci_controller* pci_ctrl_head; 44struct pci_controller* pci_ctrl_head;
@@ -258,98 +257,21 @@ pci_controller_num(struct pci_dev *dev)
258#endif /* CONFIG_PROC_FS */ 257#endif /* CONFIG_PROC_FS */
259 258
260/* 259/*
261 * Platform support for /proc/bus/pci/X/Y mmap()s, 260 * Platform support for /proc/bus/pci/X/Y mmap()s.
262 * modelled on the sparc64 implementation by Dave Miller.
263 * -- paulus. 261 * -- paulus.
264 */ 262 */
265 263
266/* 264int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
267 * Adjust vm_pgoff of VMA such that it is the physical page offset
268 * corresponding to the 32-bit pci bus offset for DEV requested by the user.
269 *
270 * Basically, the user finds the base address for his device which he wishes
271 * to mmap. They read the 32-bit value from the config space base register,
272 * add whatever PAGE_SIZE multiple offset they wish, and feed this into the
273 * offset parameter of mmap on /proc/bus/pci/XXX for that device.
274 *
275 * Returns negative error code on failure, zero on success.
276 */
277static __inline__ int
278__pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
279 enum pci_mmap_state mmap_state)
280{ 265{
281 struct pci_controller *pci_ctrl = (struct pci_controller*) dev->sysdata; 266 struct pci_controller *pci_ctrl = (struct pci_controller*) pdev->sysdata;
282 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 267 resource_size_t ioaddr = pci_resource_start(pdev, bar);
283 unsigned long io_offset = 0;
284 int i, res_bit;
285 268
286 if (pci_ctrl == 0) 269 if (pci_ctrl == 0)
287 return -EINVAL; /* should never happen */ 270 return -EINVAL; /* should never happen */
288 271
289 /* If memory, add on the PCI bridge address offset */ 272 /* Convert to an offset within this PCI controller */
290 if (mmap_state == pci_mmap_mem) { 273 ioaddr -= (unsigned long)pci_ctrl->io_space.base;
291 res_bit = IORESOURCE_MEM;
292 } else {
293 io_offset = (unsigned long)pci_ctrl->io_space.base;
294 offset += io_offset;
295 res_bit = IORESOURCE_IO;
296 }
297
298 /*
299 * Check that the offset requested corresponds to one of the
300 * resources of the device.
301 */
302 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
303 struct resource *rp = &dev->resource[i];
304 int flags = rp->flags;
305
306 /* treat ROM as memory (should be already) */
307 if (i == PCI_ROM_RESOURCE)
308 flags |= IORESOURCE_MEM;
309
310 /* Active and same type? */
311 if ((flags & res_bit) == 0)
312 continue;
313
314 /* In the range of this resource? */
315 if (offset < (rp->start & PAGE_MASK) || offset > rp->end)
316 continue;
317
318 /* found it! construct the final physical address */
319 if (mmap_state == pci_mmap_io)
320 offset += pci_ctrl->io_space.start - io_offset;
321 vma->vm_pgoff = offset >> PAGE_SHIFT;
322 return 0;
323 }
324
325 return -EINVAL;
326}
327 274
328/* 275 vma->vm_pgoff += (ioaddr + pci_ctrl->io_space.start) >> PAGE_SHIFT;
329 * Perform the actual remap of the pages for a PCI device mapping, as 276 return 0;
330 * appropriate for this architecture. The region in the process to map
331 * is described by vm_start and vm_end members of VMA, the base physical
332 * address is found in vm_pgoff.
333 * The pci device structure is provided so that architectures may make mapping
334 * decisions on a per-device or per-bus basis.
335 *
336 * Returns a negative error code on failure, zero on success.
337 */
338int pci_mmap_page_range(struct pci_dev *dev, int bar,
339 struct vm_area_struct *vma,
340 enum pci_mmap_state mmap_state,
341 int write_combine)
342{
343 int ret;
344
345 ret = __pci_mmap_make_offset(dev, vma, mmap_state);
346 if (ret < 0)
347 return ret;
348
349 vma->vm_page_prot = pgprot_device(vma->vm_page_prot);
350
351 ret = io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
352 vma->vm_end - vma->vm_start,vma->vm_page_prot);
353
354 return ret;
355} 277}