1. 01 10月, 2014 1 次提交
    • C
      PCI: Add generic domain handling · 670ba0c8
      Catalin Marinas 提交于
      The handling of PCI domains (or PCI segments in ACPI speak) is usually a
      straightforward affair but its implementation is currently left to the
      architectural code, with pci_domain_nr(b) querying the value of the domain
      associated with bus b.
      
      This patch introduces CONFIG_PCI_DOMAINS_GENERIC as an option that can be
      selected if an architecture wants a simple implementation where the value
      of the domain associated with a bus is stored in struct pci_bus.
      
      The architectures that select CONFIG_PCI_DOMAINS_GENERIC will then have to
      implement pci_bus_assign_domain_nr() as a way of setting the domain number
      associated with a root bus.  All child buses except the root bus will
      inherit the domain_nr value from their parent.
      Signed-off-by: NCatalin Marinas <Catalin.Marinas@arm.com>
      [Renamed pci_set_domain_nr() to pci_bus_assign_domain_nr()]
      Signed-off-by: NLiviu Dudau <Liviu.Dudau@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Arnd Bergmann <arnd@arndb.de>
      670ba0c8
  2. 20 9月, 2014 2 次提交
    • B
      Revert "PCI: Make sure bus number resources stay within their parents bounds" · 12d87069
      Bjorn Helgaas 提交于
      This reverts commit 1820ffdc ("PCI: Make sure bus number resources stay
      within their parents bounds") because it breaks some systems with LSI Logic
      FC949ES Fibre Channel Adapters, apparently by exposing a defect in those
      adapters.
      
      Dirk tested a Tyan VX50 (B4985) with this device that worked like this
      prior to 1820ffdc:
      
          bus: [bus 00-7f] on node 0 link 1
          ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-07])
          pci 0000:00:0e.0: PCI bridge to [bus 0a]
          pci_bus 0000:0a: busn_res: can not insert [bus 0a] under [bus 00-07] (conflicts with (null) [bus 00-07])
          pci 0000:0a:00.0: [1000:0646] type 00 class 0x0c0400 (FC adapter)
      
      Note that the root bridge [bus 00-07] aperture is wrong; this is a BIOS
      defect in the PCI0 _CRS method.  But prior to 1820ffdc, we didn't
      enforce that aperture, and the FC adapter worked fine at 0a:00.0.
      
      After 1820ffdc, we notice that 00:0e.0's aperture is not contained in
      the root bridge's aperture, so we reconfigure it so it *is* contained:
      
          pci 0000:00:0e.0: bridge configuration invalid ([bus 0a-0a]), reconfiguring
          pci 0000:00:0e.0: PCI bridge to [bus 06-07]
      
      This effectively moves the FC device from 0a:00.0 to 07:00.0, which should
      be legal.  But when we enumerate bus 06, the FC device doesn't respond, so
      we don't find anything.  This is probably a defect in the FC device.
      
      Possible fixes (due to Yinghai):
      
          1) Add a quirk to fix the _CRS information based on what amd_bus.c read
             from the hardware
      
          2) Reset the FC device after we change its bus number
      
          3) Revert 1820ffdc
      
      Fix 1 would be relatively easy, but it does sweep the LSI FC issue under
      the rug.  We might want to reconfigure bus numbers in the future for some
      other reason, e.g., hotplug, and then we could trip over this again.
      
      For that reason, I like fix 2, but we don't know whether it actually works,
      and we don't have a patch for it yet.
      
      This revert is fix 3, which also sweeps the LSI FC issue under the rug.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=84281Reported-by: NDirk Gouders <dirk@gouders.net>
      Tested-by: NDirk Gouders <dirk@gouders.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.15+
      CC: Yinghai Lu <yinghai@kernel.org>
      12d87069
    • B
      Revert "PCI: Don't scan random busses in pci_scan_bridge()" · 7a0b33d4
      Bjorn Helgaas 提交于
      This reverts commit fc1b2531 ("PCI: Don't scan random busses in
      pci_scan_bridge()") because it breaks CardBus on some machines.
      
      David tested a Dell Latitude D505 that worked like this prior to
      fc1b2531:
      
          pci 0000:00:1e.0: PCI bridge to [bus 01]
          pci 0000:01:01.0: CardBus bridge to [bus 02-05]
      
      Note that the 01:01.0 CardBus bridge has a bus number aperture of
      [bus 02-05], but those buses are all outside the 00:1e.0 PCI bridge bus
      number aperture, so accesses to buses 02-05 never reach CardBus.  This is
      later patched up by yenta_fixup_parent_bridge(), which changes the
      subordinate bus number of the 00:1e.0 PCI bridge:
      
          pci_bus 0000:01: Raising subordinate bus# of parent bus (#1) from #1 to #5
      
      With fc1b2531, pci_scan_bridge() fails immediately when it notices that
      we can't allocate a valid secondary bus number for the CardBus bridge, and
      CardBus doesn't work at all:
      
          pci 0000:01:01.0: can't allocate child bus 01 from [bus 01]
      
      I'd prefer to fix this by integrating the yenta_fixup_parent_bridge() logic
      into pci_scan_bridge() so we fix the bus number apertures up front.  But
      I don't think we can do that before v3.17, so I'm going to revert this to
      avoid the problem while we're working on the long-term fix.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=83441
      Link: http://lkml.kernel.org/r/1409303414-5196-1-git-send-email-david.henningsson@canonical.comReported-by: NDavid Henningsson <david.henningsson@canonical.com>
      Tested-by: NDavid Henningsson <david.henningsson@canonical.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v3.15+
      7a0b33d4
  3. 13 9月, 2014 8 次提交
    • B
      PCI: Configure *all* devices, not just hot-added ones · 1302fcf0
      Bjorn Helgaas 提交于
      There's not really a good way to determine whether firmware has already
      configured a device with _HPP/_HPX settings.  On legacy systems, the BIOS
      has probably configured everything, but on UEFI systems it is not required
      to do so.
      
      Per the PCI Firmware Specification, rev 3.1, sec 3.5, if PCI_COMMAND_IO or
      PCI_COMMAND_MEMORY is set, we can assume firmware has set the corresponding
      BARs and maybe we can assume it has configured the rest of the device.  And
      if a bridge has PCI_COMMAND_PARITY or PCI_COMMAND_SERR set, we can assume
      firmware has configured the bridge.  But we can't tell much about devices
      without BARs.
      
      I think it should be safe to apply _HPP and _HPX settings anyway, even if
      firmware has already configured the device, so configure everything we
      find.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      1302fcf0
    • B
      PCI: Preserve MPS and MRRS when applying _HPX settings · 302328c0
      Bjorn Helgaas 提交于
      Linux manages MPS and MRRS settings to keep them consistent across the PCIe
      fabric.  BIOS doesn't participate in this Linux management, so ignore that
      part of any _HPX settings it supplies.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      302328c0
    • B
      PCI: Apply _HPP settings to all hot-added PCI devices · ca0647e0
      Bjorn Helgaas 提交于
      We currently apply _HPP settings only to:
      
          - non-bridge devices, and
          - PCI-to-PCI bridges
      
      i.e., we do not apply them to PCI-to-ISA bridges and the like.  It has been
      that way since _HPP support was added by 40abb96c ("pciehp: Fix
      programming hotplug parameters"), but I don't think there's any reason to
      exclude these other bridges.
      
      Apply _HPP settings to hot-added PCI devices of any type.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      ca0647e0
    • B
      PCI: Preserve BIOS PCI_COMMAND_SERR and PCI_COMMAND_PARITY settings · eab3a0ee
      Bjorn Helgaas 提交于
      Do not clear PCI_COMMAND_SERR or PCI_COMMAND_PARITY based on _HPP.  The
      spec (ACPI rev 5.0, sec 6.2.7) says that when "Enable SERR" is set to 1,
      we should enable SERR in the command register.  It says nothing about
      *disabling* SERR or PERR; in fact, the example in 6.2.7.1 says we should
      leave PERR alone unless "Enable PERR" is 1.
      
      For hot-added devices, this probably doesn't matter because they power up
      with these bits cleared.  But in addition to hot-plugged devices, the spec
      allows the platform to use _HPP for "configuration of PCI devices not
      configured by the BIOS at system boot," and it may make a difference for
      devices present at boot.
      
      This change means that if BIOS enables SERR or PERR on a device, and it
      supplies _HPP or _HPX with the SERR or PERR bits *cleared*, we will now
      leave SERR or PERR reporting enabled on that device instead of disabling it
      as we previously did.
      
      See also 40abb96c ("pciehp: Fix programming hotplug parameters"), where
      this code was first added.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      eab3a0ee
    • B
      PCI: Apply _HPP settings to PCIe devices as well as PCI and PCI-X · c6285fc5
      Bjorn Helgaas 提交于
      The ACPI _HPP method was defined before PCIe existed, so its documentation
      only mentions PCI.  The _HPX Type 0 setting record is essentially identical
      to _HPP, but the spec (ACPI rev 5.0, sec 6.2.8.1) says it should be applied
      to PCI, PCI-X, and PCIe devices, with settings being ignored if they are
      not applicable.
      
      Some platforms with both conventional PCI and PCIe devices provide only
      _HPP (not _HPX), so treat _HPP the same way as an _HPX Type 0 record and
      apply it to PCIe devices as well as PCI and PCI-X.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      c6285fc5
    • B
      PCI: Remove unused pci_configure_slot() · fbfa398b
      Bjorn Helgaas 提交于
      All pci_configure_slot() uses have been removed, so remove the definition
      as well.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      fbfa398b
    • B
      PCI: Add pci_configure_device() during enumeration · 6cd33649
      Bjorn Helgaas 提交于
      Some platforms can tell the OS how to configure PCI devices, e.g., how to
      set cache line size, error reporting enables, etc.  ACPI defines _HPP and
      _HPX methods for this purpose.
      
      This configuration was previously done by some of the hotplug drivers using
      pci_configure_slot().  But not all hotplug drivers did this, and per the
      spec (ACPI rev 5.0, sec 6.2.7), we can also do it for "devices not
      configured by the BIOS at system boot."
      
      Move this configuration into the PCI core by adding pci_configure_device()
      and calling it from pci_device_add(), so we do this for all devices as we
      enumerate them.
      
      This is based on pci_configure_slot(), which is used by hotplug drivers.
      I omitted:
      
        - pcie_bus_configure_settings() because it configures MPS and MRRS, which
          requires global knowledge of the fabric and must be done later, and
      
        - configuration of subordinate devices; that will happen when we call
          pci_device_add() for those devices.
      
      Because pci_configure_slot() was only done by hotplug drivers, this initial
      version of pci_configure_device() only configures hot-added devices,
      ignoring anything added during boot.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      6cd33649
    • B
      PCI: Move pci_configure_slot() to drivers/pci/probe.c · 589fcc23
      Bjorn Helgaas 提交于
      Move pci_configure_slot() and related functions from
      drivers/pci/hotplug/pcihp_slot to drivers/pci/probe.c.
      
      This is to prepare for doing device configuration during the normal
      enumeration process instead of just after hot-add.
      
      No functional change.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      589fcc23
  4. 09 9月, 2014 2 次提交
    • R
      PCI: Enable CRS Software Visibility for root port if it is supported · f3dbd802
      Rajat Jain 提交于
      Per PCIe r3.0, sec 2.3.2, an endpoint may respond to a Configuration
      Request with a Completion with Configuration Request Retry Status (CRS).
      This terminates the Configuration Request.
      
      When the CRS Software Visibility feature is disabled (as it is by default),
      a Root Complex must handle a CRS Completion by re-issuing the Configuration
      Request.  This is invisible to software.  From the CPU's point of view, an
      endpoint that always responds with CRS causes a hang because the Root
      Complex never supplies data to complete the CPU read.
      
      When CRS Software Visibility is enabled, a Root Complex that receives a CRS
      Completion for a read of the Vendor ID must return data of 0x0001.  The
      Vendor ID of 0x0001 indicates to software that the endpoint is not ready.
      
      We now have more devices that require CRS Software Visibility.  For
      example, a PLX 8713 NT bridge may respond with CRS until it has been
      configured via I2C, and the I2C configuration is completely independent of
      PCI enumeration.
      
      Enable CRS Software Visibility if it is supported.  This allows a system
      with such a device to work (though the PCI core times out waiting for it to
      become ready, and we have to rescan the bus after it is ready).
      
      This essentially reverts ad7edfe0 ("[PCI] Do not enable CRS Software
      Visibility by default").  The failures that led to ad7edfe0 should be
      addressed by 89665a6a ("PCI: Check only the Vendor ID to identify
      Configuration Request Retry").
      
      [bhelgaas: changelog]
      Link: http://lkml.kernel.org/r/20071029061532.5d10dfc6@snowcone
      Link: http://lkml.kernel.org/r/alpine.LFD.0.9999.0712271023090.21557@woody.linux-foundation.orgSigned-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f3dbd802
    • R
      PCI: Check only the Vendor ID to identify Configuration Request Retry · 89665a6a
      Rajat Jain 提交于
      Per PCIe r3.0, sec 2.3.2, if a Root Complex
      
        - has Configuration Request Retry Status Software Visibility enabled,
        - issues a Configuration Read of both bytes of the Vendor ID, and
        - receives a Completion with Configuration Request Retry Status (CRS),
      
      it must complete the request to the host by fabricating data of 0x0001 for
      the Vendor ID and 0xff for any additional bytes in the request.
      
      Linux issues a single config read for the four bytes containing the Vendor
      ID and the Device ID.  Previously we checked all four bytes for 0xffff0001
      to identify CRS.
      
      However, it is only the Vendor ID that really indicates CRS, because it's
      sufficient to read only those two bytes.  Checking the Device ID verifies
      spec compliance but doesn't add any information.
      
      Some Root Complexes appear to indicate CRS by returning 0x0001 for the
      Vendor ID along with the actual the Device ID.  Previously we interpreted
      that as a valid Vendor/Device ID pair, although 0x0001 is reserved and
      cannot be a valid Vendor ID.
      
      [bhelgaas: changelog]
      Link: http://lkml.kernel.org/r/4729FC36.3040000@gmail.comSigned-off-by: NRajat Jain <rajatxjain@gmail.com>
      Signed-off-by: NRajat Jain <rajatjain@juniper.net>
      Signed-off-by: NGuenter Roeck <groeck@juniper.net>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      89665a6a
  5. 11 6月, 2014 3 次提交
  6. 29 5月, 2014 1 次提交
    • A
      PCI: Introduce new device binding path using pci_dev.driver_override · 782a985d
      Alex Williamson 提交于
      The driver_override field allows us to specify the driver for a device
      rather than relying on the driver to provide a positive match of the
      device.  This shortcuts the existing process of looking up the vendor and
      device ID, adding them to the driver new_id, binding the device, then
      removing the ID, but it also provides a couple advantages.
      
      First, the above existing process allows the driver to bind to any device
      matching the new_id for the window where it's enabled.  This is often not
      desired, such as the case of trying to bind a single device to a meta
      driver like pci-stub or vfio-pci.  Using driver_override we can do this
      deterministically using:
      
        echo pci-stub > /sys/bus/pci/devices/0000:03:00.0/driver_override
        echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
        echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
      
      Previously we could not invoke drivers_probe after adding a device to
      new_id for a driver as we get non-deterministic behavior whether the driver
      we intend or the standard driver will claim the device.  Now it becomes a
      deterministic process, only the driver matching driver_override will probe
      the device.
      
      To return the device to the standard driver, we simply clear the
      driver_override and reprobe the device:
      
        echo > /sys/bus/pci/devices/0000:03:00.0/driver_override
        echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
        echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
      
      Another advantage to this approach is that we can specify a driver override
      to force a specific binding or prevent any binding.  For instance when an
      IOMMU group is exposed to userspace through VFIO we require that all
      devices within that group are owned by VFIO.  However, devices can be
      hot-added into an IOMMU group, in which case we want to prevent the device
      from binding to any driver (override driver = "none") or perhaps have it
      automatically bind to vfio-pci.  With driver_override it's a simple matter
      for this field to be set internally when the device is first discovered to
      prevent driver matches.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      782a985d
  7. 28 5月, 2014 2 次提交
    • A
      PCI: Test for std config alias when testing extended config space · 78916b00
      Alex Williamson 提交于
      When a PCI-to-PCIe bridge is stacked on a PCIe-to-PCI bridge, we can have
      PCIe endpoints masked by a conventional PCI bus.  This makes the extended
      config space of the PCIe endpoint inaccessible.  The PCIe-to-PCI bridge is
      supposed to handle any type 1 configuration transactions where the extended
      config offset bits are non-zero as an Unsupported Request rather than
      forward it to the secondary interface.  As noted here, there are a couple
      known offenders to this rule.  These bridges drop the extended offset bits,
      resulting in the conventional config space being aliased many times across
      the extended config space.  For Intel NICs, this alias often seems to
      expose a bogus SR-IOV cap.
      
      Stacking bridges may seem like an uncommon scenario, but note that any
      conventional PCI slot in a modern PC is already the secondary interface of
      an onboard PCIe-to-PCI bridge.  The user need only add a PCI-to-PCIe
      adapter and PCIe device to encounter this problem.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      78916b00
    • Y
      PCI: Use pci_is_bridge() to simplify code · 6788a51f
      Yijing Wang 提交于
      Use pci_is_bridge() to simplify code.  No functional change.
      
      Requires: 326c1cda PCI: Rename pci_is_bridge() to pci_has_subordinate()
      Requires: 1c86438c PCI: Add new pci_is_bridge() interface
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6788a51f
  8. 24 5月, 2014 6 次提交
    • B
      PCI: Don't add disabled subtractive decode bus resources · d739a099
      Bjorn Helgaas 提交于
      For a subtractive decode bridge, we previously added and printed all
      resources of the primary bus, even if they were not valid.  In the example
      below, the bridge 00:1c.3 has no windows enabled, so there are no valid
      resources on bus 02.  But since 02:00.0 is subtractive decode bridge, we
      add and print all those invalid resources, which don't really make sense:
      
        pci 0000:00:1c.3: PCI bridge to [bus 02-03]
        pci 0000:02:00.0: PCI bridge to [bus 03] (subtractive decode)
        pci 0000:02:00.0:   bridge window [??? 0x00000000 flags 0x0] (subtractive decode)
      
      Add and print the subtractively-decoded resources only if they are valid.
      
      There's an example in the dmesg log attached to the bugzilla below (but
      this patch doesn't fix the bug reported there).
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=73141Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      d739a099
    • B
      PCI: Don't print anything while decoding is disabled · 26370fc6
      Bjorn Helgaas 提交于
      If the console is a PCI device, and we try to print to it while its
      decoding is disabled, the system will hang.  This particular printk hasn't
      caused a problem yet, but it could, so this fixes it.
      
      See also 0ff9514b ("PCI: Don't print anything while decoding is
      disabled").
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      26370fc6
    • B
      PCI: Don't set BAR to zero if dma_addr_t is too small · 31e9dd25
      Bjorn Helgaas 提交于
      If a BAR is above 4GB and our dma_addr_t is too small, don't clear the BAR
      to zero: that doesn't disable the BAR, and it makes it more likely that the
      BAR will conflict with things if we turn on the memory enable bit (as we
      will at "out:" if the device was already enabled at the handoff).
      
      We should also print the BAR info and its original size so we can follow
      the process when we try to assign space to it.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      31e9dd25
    • B
      PCI: Don't convert BAR address to resource if dma_addr_t is too small · 72dc5601
      Bjorn Helgaas 提交于
      If dma_addr_t is too small to represent the BAR value,
      pcibios_bus_to_resource() will fail, so just remember the BAR size directly
      in the resource.  The resource is already marked UNSET, so we know the
      address isn't valid anyway.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      72dc5601
    • B
      PCI: Reject BAR above 4GB if dma_addr_t is too small · d1a313e4
      Bjorn Helgaas 提交于
      We can only handle BARs above 4GB if dma_addr_t (not resource_size_t) is 64
      bits wide.  If we have a 64-bit resource_size_t and a 32-bit dma_addr_t,
      we can't deal with BARs above 4GB.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      d1a313e4
    • B
      PCI: Fail safely if we can't handle BARs larger than 4GB · 23b13bc7
      Bjorn Helgaas 提交于
      We can only handle BARs larger than 4GB if both dma_addr_t and
      resource_size_t are 64 bits wide.  If dma_addr_t is 32 bits, we can't
      represent all the bus addresses, and if resource_size_t is 32 bits, we
      can't represent all the CPU addresses.
      
      Previously we cleared res->flags (at "fail:") for resources that were too
      large.  That means we think the BAR doesn't exist at all, which in turn
      means that we could enable the device even though we can't keep track of
      where the BAR is and we can't make sure it doesn't overlap something else.
      
      This preserves the type flags (MEM/IO) so we can keep from enabling the
      device.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      23b13bc7
  9. 30 4月, 2014 2 次提交
    • B
      PCI: Fix use of uninitialized MPS value · 1e358f94
      Bjorn Helgaas 提交于
      If "pcie_bus_config == PCIE_BUS_PERFORMANCE", we don't initialize "smpss",
      so we pass a pointer to garbage into pcie_bus_configure_set(), where we
      compute "mps" based on the garbage.  We then pass the garbage "mps" to
      pcie_write_mps(), which ignores it in the PCIE_BUS_PERFORMANCE case.
      
      Coverity isn't smart enough to deduce that we ignore the garbage (it's a
      lot to expect from a human, too), so initialize "smpss" to a safe value in
      all cases.
      
      Found by Coverity (CID 146454).
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      1e358f94
    • B
      PCI: Remove unnecessary __ref annotations · 10874f5a
      Bjorn Helgaas 提交于
      Some PCI functions used to be marked __devinit.  When CONFIG_HOTPLUG was
      not set, these functions were discarded after boot.  A few callers of these
      __devinit functions were marked __ref to indicate that they could safely
      call the __devinit functions even though the callers were not __devinit.
      
      But CONFIG_HOTPLUG and __devinit are now gone, and the need for the __ref
      annotations is also gone, so remove them.  Relevant historical commits:
      
        54b956b9 Remove __dev* markings from init.h
        a8e4b9c1 PCI: add generic pci_hp_add_bridge()
        0ab2b57f PCI: fix section mismatch warning in pci_scan_child_bus
        451124a7 PCI: fix 4x section mismatch warnings
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      10874f5a
  10. 20 3月, 2014 1 次提交
  11. 28 2月, 2014 1 次提交
    • B
      PCI: Mark 64-bit resource as IORESOURCE_UNSET if we only support 32-bit · c83bd900
      Bjorn Helgaas 提交于
      If we don't support 64-bit addresses, i.e., CONFIG_PHYS_ADDR_T_64BIT is not
      set, we can't deal with BARs above 4GB.  In this case we already pretend
      the BAR contained zero; this patch also sets IORESOURCE_UNSET so we can try
      to reallocate it later.
      
      I don't think this is exactly correct: what we care about here are *bus*
      addresses, not CPU addresses, so the tests of sizeof(resource_size_t)
      probably should be on sizeof(dma_addr_t) instead.  But this is what's been
      in -next, so we'll fix that later.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      c83bd900
  12. 12 2月, 2014 3 次提交
  13. 11 2月, 2014 5 次提交
  14. 02 2月, 2014 1 次提交
    • R
      Revert "PCI: Remove from bus_list and release resources in pci_release_dev()" · 04480094
      Rafael J. Wysocki 提交于
      Revert commit ef83b078 "PCI: Remove from bus_list and release
      resources in pci_release_dev()" that made some nasty race conditions
      become possible.  For example, if a Thunderbolt link is unplugged
      and then replugged immediately, the pci_release_dev() resulting from
      the hot-remove code path may be racing with the hot-add code path
      which after that commit causes various kinds of breakage to happen
      (up to and including a hard crash of the whole system).
      
      Moreover, the problem that commit ef83b078 attempted to address
      cannot happen any more after commit 8a4c5c32 "PCI: Check parent
      kobject in pci_destroy_dev()", because pci_destroy_dev() will now
      return immediately if it has already been executed for the given
      device.
      
      Note, however, that the invocation of msi_remove_pci_irq_vectors()
      removed by commit ef83b078 from pci_free_resources() along with
      the other changes made by it is not added back because of subsequent
      code changes depending on that modification.
      
      Fixes: ef83b078 (PCI: Remove from bus_list and release resources in pci_release_dev())
      Reported-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      04480094
  15. 14 1月, 2014 2 次提交
    • R
      PCI: Add global pci_lock_rescan_remove() · 9d16947b
      Rafael J. Wysocki 提交于
      There are multiple PCI device addition and removal code paths that may be
      run concurrently with the generic PCI bus rescan and device removal that
      can be triggered via sysfs.  If that happens, it may lead to multiple
      different, potentially dangerous race conditions.
      
      The most straightforward way to address those problems is to run
      the code in question under the same lock that is used by the
      generic rescan/remove code in pci-sysfs.c.  To prepare for those
      changes, move the definition of the global PCI remove/rescan lock
      to probe.c and provide global wrappers, pci_lock_rescan_remove()
      and pci_unlock_rescan_remove(), allowing drivers to manipulate
      that lock.  Also provide pci_stop_and_remove_bus_device_locked()
      for the callers of pci_stop_and_remove_bus_device() who only need
      to hold the rescan/remove lock around it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      9d16947b
    • S
      PCI: Make local functions static · 0b950f0f
      Stephen Hemminger 提交于
      Using 'make namespacecheck' identify code which should be declared static.
      Checked for users in other driver/archs as well.  Compile tested only.
      
      This stops exporting the following interfaces to modules:
      
          pci_target_state()
          pci_load_saved_state()
      
      [bhelgaas: retained pci_find_next_ext_capability() and pci_cfg_space_size()]
      Signed-off-by: NStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      0b950f0f