1. 18 5月, 2016 2 次提交
    • B
      Merge branches 'pci/arm64' and 'pci/host-hv' into next · e257ef55
      Bjorn Helgaas 提交于
      * pci/arm64:
        PCI, of: Move PCI I/O space management to PCI core code
        PCI: generic, thunder: Use generic ECAM API
        PCI: Provide common functions for ECAM mapping
      
      * pci/host-hv:
        PCI: hv: Add explicit barriers to config space access
      e257ef55
    • B
      Merge branches 'pci/hotplug' and 'pci/resource' into next · 45604e68
      Bjorn Helgaas 提交于
      * pci/hotplug:
        PCI: Use cached copy of PCI_EXP_SLTCAP_HPC bit
      
      * pci/resource:
        PCI: Disable all BAR sizing for devices with non-compliant BARs
        x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs
        PCI: Identify Enhanced Allocation (EA) BAR Equivalent resources in sysfs
      45604e68
  2. 17 5月, 2016 3 次提交
    • P
      PCI: Disable all BAR sizing for devices with non-compliant BARs · ad67b437
      Prarit Bhargava 提交于
      b84106b4 ("PCI: Disable IO/MEM decoding for devices with non-compliant
      BARs") disabled BAR sizing for BARs 0-5 of devices that don't comply with
      the PCI spec.  But it didn't do anything for expansion ROM BARs, so we
      still try to size them, resulting in warnings like this on Broadwell-EP:
      
        pci 0000:ff:12.0: BAR 6: failed to assign [mem size 0x00000001 pref]
      
      Move the non-compliant BAR check from __pci_read_base() up to
      pci_read_bases() so it applies to the expansion ROM BAR as well as
      to BARs 0-5.
      
      Note that direct callers of __pci_read_base(), like sriov_init(), will now
      bypass this check.  We haven't had reports of devices with broken SR-IOV
      BARs yet.
      
      [bhelgaas: changelog]
      Fixes: b84106b4 ("PCI: Disable IO/MEM decoding for devices with non-compliant BARs")
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Ingo Molnar <mingo@redhat.com>
      CC: "H. Peter Anvin" <hpa@zytor.com>
      CC: Andi Kleen <ak@linux.intel.com>
      ad67b437
    • P
      x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs · da77b671
      Prarit Bhargava 提交于
      Commit b8941571 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having
      non-compliant BARs") marked Home Agent 0 & PCU has having non-compliant
      BARs.  Home Agent 1 also has non-compliant BARs.
      
      Mark Home Agent 1 as having non-compliant BARs so the PCI core doesn't
      touch them.
      
      The problem with these devices is documented in the Xeon v4 specification
      update:
      
        BDF2          PCI BARs in the Home Agent Will Return Non-Zero Values
                      During Enumeration
      
        Problem:      During system initialization the Operating System may access
                      the standard PCI BARs (Base Address Registers).  Due to
                      this erratum, accesses to the Home Agent BAR registers (Bus
                      1; Device 18; Function 0,4; Offsets (0x14-0x24) will return
                      non-zero values.
      
        Implication:  The operating system may issue a warning.  Intel has not
                      observed any functional failures due to this erratum.
      
      Link: http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html
      Fixes: b8941571 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs")
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Ingo Molnar <mingo@redhat.com>
      CC: "H. Peter Anvin" <hpa@zytor.com>
      CC: Andi Kleen <ak@linux.intel.com>
      da77b671
    • A
      PCI: Identify Enhanced Allocation (EA) BAR Equivalent resources in sysfs · 92efb1bd
      Alex Williamson 提交于
      Resource flags are exposed to userspace via the sysfs "resource" file.
      lspci reads the sysfs file to determine resource properties.
      
      Add a "BAR Equivalent Indicator" flag so lspci can distinguish between
      [virtual] and [enhanced] resources.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NSean O. Stalley <sean.stalley@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      92efb1bd
  3. 12 5月, 2016 3 次提交
    • T
      PCI, of: Move PCI I/O space management to PCI core code · c5076cfe
      Tomasz Nowicki 提交于
      No functional changes in this patch.
      
      PCI I/O space mapping code does not depend on OF; therefore it can be moved
      to PCI core code.  This way we will be able to use it, e.g., in ACPI PCI
      code.
      Suggested-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NTomasz Nowicki <tn@semihalf.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Arnd Bergmann <arnd@arndb.de>
      CC: Liviu Dudau <Liviu.Dudau@arm.com>
      c5076cfe
    • J
      PCI: generic, thunder: Use generic ECAM API · 1958e717
      Jayachandran C 提交于
      Use functions provided by drivers/pci/ecam.h for mapping the config space
      in drivers/pci/host/pci-host-common.c, and update its users to use 'struct
      pci_config_window' and 'struct pci_ecam_ops'.
      
      The changes are mostly to use 'struct pci_config_window' in place of
      'struct gen_pci'.  Some of the fields of gen_pci were only used temporarily
      and can be eliminated by using local variables or function arguments, these
      are not carried over to struct pci_config_window.
      
      pci-thunder-ecam.c and pci-thunder-pem.c are the only users of the
      pci_host_common_probe function and the gen_pci structure; these have been
      updated to use the new API as well.
      
      The patch does not introduce any functional changes other than a very minor
      one: with the new code, on 64-bit platforms, we do just a single ioremap
      for the whole config space.
      Signed-off-by: NJayachandran C <jchandra@broadcom.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      1958e717
    • J
      PCI: Provide common functions for ECAM mapping · 35ff9477
      Jayachandran C 提交于
      Add config option PCI_ECAM and file drivers/pci/ecam.c to provide generic
      functions for accessing memory-mapped PCI config space.
      
      The API is defined in drivers/pci/ecam.h and is written to replace the API
      in drivers/pci/host/pci-host-common.h.  The file defines a new 'struct
      pci_config_window' to hold the information related to a PCI config area and
      its mapping.  This structure is expected to be used as sysdata for
      controllers that have ECAM based mapping.
      
      Helper functions are provided to setup the mapping, free the mapping and to
      implement the map_bus method in 'struct pci_ops'
      Signed-off-by: NJayachandran C <jchandra@broadcom.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      35ff9477
  4. 05 5月, 2016 2 次提交
    • V
      PCI: hv: Add explicit barriers to config space access · bdd74440
      Vitaly Kuznetsov 提交于
      I'm trying to pass-through Broadcom BCM5720 NIC (Dell device 1f5b) on a
      Dell R720 server.  Everything works fine when the target VM has only one
      CPU, but SMP guests reboot when the NIC driver accesses PCI config space
      with hv_pcifront_read_config()/hv_pcifront_write_config().  The reboot
      appears to be induced by the hypervisor and no crash is observed.  Windows
      event logs are not helpful at all ('Virtual machine ... has quit
      unexpectedly').  The particular access point is always different and
      putting debug between them (printk/mdelay/...) moves the issue further
      away.  The server model affects the issue as well: on Dell R420 I'm able to
      pass-through BCM5720 NIC to SMP guests without issues.
      
      While I'm obviously failing to reveal the essence of the issue I was able
      to come up with a (possible) solution: if explicit barriers are added to
      hv_pcifront_read_config()/hv_pcifront_write_config() the issue goes away.
      The essential minimum is rmb() at the end on _hv_pcifront_read_config() and
      wmb() at the end of _hv_pcifront_write_config() but I'm not confident it
      will be sufficient for all hardware.  I suggest the following barriers:
      
      1) wmb()/mb() between choosing the function and writing to its space.
      2) mb() before releasing the spinlock in both _hv_pcifront_read_config()/
         _hv_pcifront_write_config() to ensure that consecutive reads/writes to
        the space won't get re-ordered as drivers may count on that.
      
      Config space access is not supposed to be performance-critical so these
      explicit barriers should not cause any slowdown.
      
      [bhelgaas: use Linux "barriers" terminology]
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NJake Oshins <jakeo@microsoft.com>
      bdd74440
    • L
      PCI: Use cached copy of PCI_EXP_SLTCAP_HPC bit · f8415222
      Lukas Wunner 提交于
      We cache the PCI_EXP_SLTCAP_HPC bit in pci_dev->is_hotplug_bridge on device
      probe, so there's no need to read it again on allocation of port service
      devices.
      
      No functional change intended.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f8415222
  5. 04 5月, 2016 2 次提交
    • B
      Merge branches 'pci/dpc', 'pci/resource' and 'pci/thunderbolt' into next · d9322d22
      Bjorn Helgaas 提交于
      * pci/dpc:
        PCI: Add Downstream Port Containment driver
        PCI: Add Downstream Port Containment portdrv service type
        PCI: Widen portdrv service type from 4 bits to 8 bits
      
      * pci/resource:
        alpha/PCI: Call iomem_is_exclusive() for IORESOURCE_MEM, but not IORESOURCE_IO
        PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive()
      
      * pci/thunderbolt:
        thunderbolt: Fix double free of drom buffer
      d9322d22
    • B
      Merge branches 'pci/host-armada', 'pci/host-designware', 'pci/host-hv',... · 58f8b094
      Bjorn Helgaas 提交于
      Merge branches 'pci/host-armada', 'pci/host-designware', 'pci/host-hv', 'pci/host-imx6', 'pci/host-keystone', 'pci/host-mvebu', 'pci/host-rcar', 'pci/host-thunder' and 'pci/host-vmd' into next
      
      * pci/host-armada:
        PCI: armada: Add driver for Marvell Armada 7K/8K PCIe controller
        dt-bindings: pci: add DT binding for Marvell Armada 7K/8K PCIe controller
      
      * pci/host-designware:
        PCI: designware: Remove incorrect RC memory base/limit configuration
        PCI: designware: Move Root Complex setup code to dw_pcie_setup_rc()
      
      * pci/host-hv:
        PCI: hv: Report resources release after stopping the bus
      
      * pci/host-imx6:
        ARM: dts: imx6qp: Specify imx6qp version of PCIe core
        PCI: imx6: Implement reset sequence for i.MX6+
        PCI: imx6: Use enum instead of bool for variant indicator
        PCI: imx6: Add DT property for link gen, default to Gen1
        PCI: imx6: Add reset-gpio-active-high boolean property to DT
        ARM: dts: imx6: Fix PCIe reset GPIO polarity on Toradex Apalis Ixora
        PCI: imx6: Add initial imx6sx support
        PCI: imx6: Factor out ref clock enable
        Revert "PCI: imx6: Add support for active-low reset GPIO"
      
      * pci/host-keystone:
        PCI: keystone: Remove unnecessary goto statement
        PCI: keystone: Add error IRQ handler
      
      * pci/host-mvebu:
        PCI: mvebu: Use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS for mvebu_pcie_pm_ops
        PCI: mvebu: Constify mvebu_pcie_pm_ops structure
      
      * pci/host-rcar:
        PCI: rcar: Select PCI_MSI_IRQ_DOMAIN
      
      * pci/host-thunder:
        PCI: thunder: Don't clobber read-only bits in bridge config registers
      
      * pci/host-vmd:
        PCI: Remove return values from pcie_port_platform_notify() and relatives
        PCI/ACPI: Allow all PCIe services on non-ACPI host bridges
      58f8b094
  6. 03 5月, 2016 11 次提交
  7. 27 4月, 2016 2 次提交
  8. 26 4月, 2016 4 次提交
    • B
      alpha/PCI: Call iomem_is_exclusive() for IORESOURCE_MEM, but not IORESOURCE_IO · c20e1280
      Bjorn Helgaas 提交于
      The alpha pci_mmap_resource() is used for both IORESOURCE_MEM and
      IORESOURCE_IO resources, but iomem_is_exclusive() is only applicable for
      IORESOURCE_MEM.
      
      Call iomem_is_exclusive() only for IORESOURCE_MEM resources, and do it
      earlier to match the generic version of pci_mmap_resource().
      
      Fixes: 10a0ef39 ("PCI/alpha: pci sysfs resources")
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      c20e1280
    • B
      PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive() · ca620723
      Bjorn Helgaas 提交于
      iomem_is_exclusive() requires a CPU physical address, but on some arches we
      supplied a PCI bus address instead.
      
      On most arches, pci_resource_to_user(res) returns "res->start", which is a
      CPU physical address.  But on microblaze, mips, powerpc, and sparc, it
      returns the PCI bus address corresponding to "res->start".
      
      The result is that pci_mmap_resource() may fail when it shouldn't (if the
      bus address happens to match an existing resource), or it may succeed when
      it should fail (if the resource is exclusive but the bus address doesn't
      match it).
      
      Call iomem_is_exclusive() with "res->start", which is always a CPU physical
      address, not the result of pci_resource_to_user().
      
      Fixes: e8de1481 ("resource: allow MMIO exclusivity for device drivers")
      Suggested-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Arjan van de Ven <arjan@linux.intel.com>
      ca620723
    • B
      Merge branches 'pci/enumeration', 'pci/hotplug', 'pci/misc', 'pci/ntb',... · 7f768544
      Bjorn Helgaas 提交于
      Merge branches 'pci/enumeration', 'pci/hotplug', 'pci/misc', 'pci/ntb', 'pci/thunderbolt' and 'pci/virtualization' into next
      
      * pci/enumeration:
        x86/PCI: Refine PCI support check in pcibios_init()
      
      * pci/hotplug:
        PCI: acpiphp_ibm: Avoid uninitialized variable reference
      
      * pci/misc:
        PCI: Fix spelling errors
      
      * pci/ntb:
        PCI: Add DMA alias quirk for mic_x200_dma
        PCI: Add support for multiple DMA aliases
        PCI: Move informational printk to pci_add_dma_alias()
        PCI: Add pci_add_dma_alias() to abstract implementation
      
      * pci/thunderbolt:
        thunderbolt: Support 1st gen Light Ridge controller
        thunderbolt: Fix typos and magic number
        PCI: Add Intel Thunderbolt device IDs
      
      * pci/virtualization:
        PCI: Work around Intel Sunrise Point PCH incorrect ACS capability
        PCI: Reverse standard ACS vs device-specific ACS enabling
        PCI: Mark Intel i40e NIC INTx masking as broken
      7f768544
    • M
      PCI: keystone: Remove unnecessary goto statement · 1e9f8dcf
      Murali Karicheri 提交于
      Fix the misuse of goto statement in ks_pcie_get_irq_controller_info() as
      simple return is more appropriate for this function.  While at it add an
      error log for absence of interrupt controller node.
      
      [bhelgaas: drop "ret" altogether since we always know the return value]
      Signed-off-by: NMurali Karicheri <m-karicheri2@ti.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Rob Herring <robh+dt@kernel.org>
      CC: Pawel Moll <pawel.moll@arm.com>
      CC: Mark Rutland <mark.rutland@arm.com>
      CC: Ian Campbell <ijc+devicetree@hellion.org.uk>
      CC: Kumar Gala <galak@codeaurora.org>
      1e9f8dcf
  9. 20 4月, 2016 8 次提交
    • T
      PCI: imx6: Add DT property for link gen, default to Gen1 · a5fcec48
      Tim Harvey 提交于
      Freescale has stated [1] that the LVDS clock source of the IMX6 does not
      pass the PCI Gen2 clock jitter test, therefore unless an external Gen2
      compliant external clock source is present and supplied back to the IMX6
      PCIe core via LVDS CLK1/CLK2 you can not claim Gen2 compliance.
      
      Add a DT property to specify Gen1 vs Gen2 and check this before allowing a
      Gen2 link.
      
      We default to Gen1 if the property is not present because at this time
      there are no IMX6 boards in mainline that 'input' a clock on LVDS
      CLK1/CLK2.
      
      In order to be Gen2 compliant on IMX6 you need to:
      
       - Have a Gen2 compliant external clock generator and route that clock back
         to either LVDS CLK1 or LVDS CLK2 as an input (see IMX6SX-SabreSD
         reference design).
      
       - Specify this clock in the PCIe node in the DT (i.e.,
         IMX6QDL_CLK_LVDS1_IN or IMX6QDL_CLK_LVDS2_IN instead of
         IMX6QDL_CLK_LVDS1_GATE which configures it as a CLK output).
      
      [1] https://community.freescale.com/message/453209Signed-off-by: NTim Harvey <tharvey@gateworks.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      CC: Fabio Estevam <fabio.estevam@freescale.com>
      CC: Zhu Richard <Richard.Zhu@freescale.com>
      CC: Akshay Bhat <akshay.bhat@timesys.com>
      CC: Rob Herring <robh+dt@kernel.org>
      CC: Shawn Guo <shawnguo@kernel.org>
      a5fcec48
    • P
      PCI: imx6: Add reset-gpio-active-high boolean property to DT · 3ea8529a
      Petr Štetiar 提交于
      Currently the reset-gpio DT property which controls the PCI bus device
      reset signal defaults to active-low reset sequence (L=reset state,
      H=operation state) plus the code in reset function isn't GPIO polarity
      aware - it doesn't matter if the defined reset-gpio is active-low or
      active-high, it will always result into active-low reset sequence.
      
      I've tried to fix it properly and change the reset-gpio reset sequence to
      be polarity-aware, but this patch has been accepted and then reverted as it
      has introduced few backward incompatible issues:
      
      1. Some DTBs, for example, imx6qdl-sabresd, don't define reset-gpio
      polarity correctly:
      
        reset-gpio = <&gpio7 12 0>;
      
      which means that it's defined as active-high, but in reality it's
      active-low; thus it wouldn't work without a DTS fix.
      
      2. The logic in the reset function is inverted:
      
      	gpio_set_value_cansleep(imx6_pcie->reset_gpio, 0)
      	msleep(100);
      	gpio_set_value_cansleep(imx6_pcie->reset_gpio, 1);
      
      so even if some of the i.MX6 boards had reset-gpio polarity defined
      correctly in their DTSes, they would stop working.
      
      As we can't break old DTBs, we can't fix them, so we need to introduce this
      new DT reset-gpio-active-high boolean property so we can support boards
      with active-high reset sequence.
      
      This active-high reset sequence is for example needed on Apalis SoMs, where
      GPIO1_IO28, used to PCIe reset is not connected directly to PERST# PCIe
      signal, but it's ORed with RESETBMCU coming off the PMIC, and thus is
      inverted, active-high.
      
      Tested-by: Tim Harvey <tharvey@gateworks.com>	# Gateworks Ventana boards (which have active-low PERST#)
      Signed-off-by: NPetr Štetiar <ynezz@true.cz>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      Acked-by: NRob Herring <robh@kernel.org>
      3ea8529a
    • P
      ARM: dts: imx6: Fix PCIe reset GPIO polarity on Toradex Apalis Ixora · 4f6926e9
      Petr Štetiar 提交于
      Adding reset-gpio-active-high boolean DT binding property, which we need to
      make PCIe working on Apalis SoMs and not break old DTBs. While at it, I've
      fixed comment and GPIO polarity.
      
      On Apalis SoMs the GPIO1_IO28 used to PCIe reset is not connected directly
      to PERST# PCIe signal, but it's ORed with RESETBMCU coming off the PMIC,
      and thus is inverted, active-high.
      Signed-off-by: NPetr Štetiar <ynezz@true.cz>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      4f6926e9
    • C
      PCI: imx6: Add initial imx6sx support · e3c06cd0
      Christoph Fritz 提交于
      Add initial PCIe support for the imx6 SoC derivate imx6sx.  PCI MSI support
      is untested as the necessary suspend/resume quirk is not included in this
      patch.
      
      This patch is heavily based on patches by Richard Zhu.
      
      [bhelgaas: factor out refclk enable, fix adjacent typos in imx6q-pcie.txt]
      Signed-off-by: NChristoph Fritz <chf.fritz@googlemail.com>
      Acked-by: NRichard Zhu <Richard.Zhu@freescale.com>
      Acked-by: NLucas Stach <l.stach@pengutronix.de>
      e3c06cd0
    • B
      PCI: imx6: Factor out ref clock enable · 4d1821e7
      Bjorn Helgaas 提交于
      Factor out ref clock enable to make it cleaner to add imx6sx support.  No
      functional change intended.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Tested-by: NChristoph Fritz <chf.fritz@googlemail.com>
      4d1821e7
    • A
      PCI: Work around Intel Sunrise Point PCH incorrect ACS capability · 1bf2bf22
      Alex Williamson 提交于
      Intel Sunrise Point root ports implement ACS but use dwords for the
      capability and control registers, putting the control register at the wrong
      offset.
      
      Use quirks to enable and test ACS for these devices, which match the
      standard functions modulo the broken control register offset.
      
      Note that lspci assumes devices implement ACS per spec, so it shows invalid
      ACS data for these devices.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      1bf2bf22
    • A
      PCI: Reverse standard ACS vs device-specific ACS enabling · c1d61c9b
      Alex Williamson 提交于
      The original thought was that if a device implemented ACS, then surely
      we want to use that... well, it turns out that devices can make an ACS
      capability so broken that we still need to fall back to quirks.
      
      Reverse the order of ACS enabling to give quirks first shot at it.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      c1d61c9b
    • A
      PCI: Mark Intel i40e NIC INTx masking as broken · 8bcf4525
      Alex Williamson 提交于
      All of the i40e (XL710/X710) 10/20/40GbE NICs lack support for indicating
      INTx is asserted via the interrupt bit in the PCI status register.  The
      DisINTx bit in the command register is functional, causing these devices to
      be incorrectly detected as supporting INTx masking.  Quirk them to properly
      indicate no INTx masking support.
      
      Device IDs copied from i40e_devids.h.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: John Ronciak <john.ronciak@intel.com>
      CC: Jesse Brandeburg <jesse.brandeburg@intel.com>
      8bcf4525
  10. 15 4月, 2016 2 次提交
  11. 12 4月, 2016 1 次提交