02 Apr, 2009

1 commit

  • * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (88 commits)
    PCI: fix HT MSI mapping fix
    PCI: don't enable too much HT MSI mapping
    x86/PCI: make pci=lastbus=255 work when acpi is on
    PCI: save and restore PCIe 2.0 registers
    PCI: update fakephp for bus_id removal
    PCI: fix kernel oops on bridge removal
    PCI: fix conflict between SR-IOV and config space sizing
    powerpc/PCI: include pci.h in powerpc MSI implementation
    PCI Hotplug: schedule fakephp for feature removal
    PCI Hotplug: rename legacy_fakephp to fakephp
    PCI Hotplug: restore fakephp interface with complete reimplementation
    PCI: Introduce /sys/bus/pci/devices/.../rescan
    PCI: Introduce /sys/bus/pci/devices/.../remove
    PCI: Introduce /sys/bus/pci/rescan
    PCI: Introduce pci_rescan_bus()
    PCI: do not enable bridges more than once
    PCI: do not initialize bridges more than once
    PCI: always scan child buses
    PCI: pci_scan_slot() returns newly found devices
    PCI: don't scan existing devices
    ...

    Fix trivial append-only conflict in Documentation/feature-removal-schedule.txt

    Linus Torvalds
     

31 Mar, 2009

1 commit


21 Mar, 2009

8 commits

  • This interface allows the user to force a rescan of all PCI buses
    in system, and rediscover devices that have been removed earlier.

    pci_bus_attrs implementation from Trent Piepho.

    Thanks to Vegard Nossum for discovering locking issues with the
    sysfs interface.

    Cc: Trent Piepho
    Signed-off-by: Alex Chiang
    Signed-off-by: Jesse Barnes

    Alex Chiang
     
  • Add or remove a Virtual Function after receiving a Migrate In or Out
    Request.

    Reviewed-by: Matthew Wilcox
    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Add or remove the Virtual Function when the SR-IOV is enabled or
    disabled by the device driver. This can happen anytime rather than
    only at the device probe stage.

    Reviewed-by: Matthew Wilcox
    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Move the device setup stuff into pci_setup_device() which will be used
    to setup the Virtual Function later.

    Reviewed-by: Matthew Wilcox
    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Reserve the bus number range used by the Virtual Function when
    pcibios_assign_all_busses() returns true.

    Reviewed-by: Matthew Wilcox
    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Restore the volatile registers in the SR-IOV capability after the
    D3->D0 transition.

    Reviewed-by: Matthew Wilcox
    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • If a device has the SR-IOV capability, initialize it (set the ARI
    Capable Hierarchy in the lowest numbered PF if necessary; calculate
    the System Page Size for the VF MMIO, probe the VF Offset, Stride
    and BARs). A lock for the VF bus allocation is also initialized if
    a PF is the lowest numbered PF.

    Reviewed-by: Matthew Wilcox
    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • This patch allows memory resources to be assigned with a specified
    alignment at boot-time or run-time. The patch is useful when we use PCI
    pass-through, because page-aligned memory resources are required to
    securely share PCI resources with guest drivers.

    If you want to assign the resource at boot time, please set
    "pci=resource_alignment=" boot parameter.

    This is format of "pci=resource_alignment=" boot parameter:

    [@][:]:.[; ...]
    Specifies alignment and device to reassign
    aligned memory resources.
    If is not specified, PAGE_SIZE is
    used as alignment.
    PCI-PCI bridge can be specified, if resource
    windows need to be expanded.

    This is example:

    pci=resource_alignment=20@07:00.0;18@0f:00.0;00:1d.7

    If you want to assign the resource at run-time, please set
    "/sys/bus/pci/resource_alignment" file, and hot-remove the device and
    hot-add the device. For this purpose, fakephp or PCI hotplug interfaces
    can be used.

    The format of "/sys/bus/pci/resource_alignment" file is the same with
    boot parameter. You can use "," instead of ";".

    For example:

    # cd /sys/bus/pci
    # echo -n 20@12:00.0 > resource_alignment
    # echo 1 > devices/0000:12:00.0/remove
    # echo 1 > rescan

    Reviewed-by: Alex Chiang
    Reviewed-by: Yu Zhao
    Signed-off-by: Yuji Shimada
    Signed-off-by: Jesse Barnes

    Yuji Shimada
     

14 Feb, 2009

1 commit


17 Jan, 2009

1 commit

  • There is a problem in our handling of suspend-resume of PCI devices that
    many of them have their standard config registers restored with
    interrupts enabled and they are put into the full power state with
    interrupts enabled as well. This may lead to the following scenario:
    * an interrupt vector is shared between two or more devices
    * one device is resumed earlier and generates an interrupt
    * the interrupt handler of another device tries to handle it and
    attempts to access the device the config space of which hasn't been
    restored yet and/or which still is in a low power state
    * the system crashes as a result

    To prevent this from happening we should restore the standard
    configuration registers of all devices with interrupts disabled and we
    should put them into the D0 power state right after that.
    Unfortunately, this cannot be done using the existing
    pci_set_power_state(), because it can sleep. Also, to do it we have to
    make sure that the config spaces of all devices were actually saved
    during suspend.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Linus Torvalds
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

08 Jan, 2009

11 commits

  • It generally is better to avoid accessing devices behind bridges that
    may not be in the D0 power state, because in that case the bridges'
    secondary buses may not be accessible. For this reason, during the
    early phase of resume (ie. with interrupts disabled), before
    restoring the standard config registers of a device, check the power
    state of the bridge the device is behind and postpone the restoration
    of the device's config space, as well as any other operations that
    would involve accessing the device, if that state is not D0.

    In such cases the restoration of the device's config space will be
    retried during the "normal" phase of resume (ie. with interrupts
    enabled), so that the bridge can be put into D0 before that happens.

    Also, save standard configuration registers of PCI devices during the
    "normal" phase of suspend (ie. with interrupts enabled), so that the
    bridges the devices are behind can be put into low power states (we
    don't put bridges into low power states at the moment, but we may
    want to do it in the future and it seems reasonable to design for
    that).

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • PCI devices without drivers are not disabled during suspend and
    hibernation, but they are enabled during resume, with the help of
    pci_reenable_device(), so there is an unbalanced execution of
    pcibios_enable_device() in the resume code path.

    To correct this introduce function pci_disable_enabled_device()
    that will disable the argument device, if it is enabled when the
    function is being run, without updating the device's pci_dev
    structure and use it in the suspend code path to balance the
    pci_reenable_device() executed during resume.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • Change PCI VPD API which was only used by sysfs to something usable
    in drivers.
    * move iteration over multiple words to the low level
    * use conventional types for arguments
    * add exportable wrapper

    Signed-off-by: Stephen Hemminger
    Signed-off-by: Jesse Barnes

    Stephen Hemminger
     
  • When PCI devices are initialized, we check whether they support PCI PM
    caps and set the device can_wakeup flag if so. However, some devices
    may have platform provided wakeup events rather than PCI PME signals, so
    we need to set can_wakeup in that case too. Doing so should allow
    wakeups from many more devices, especially on cost constrained systems.

    Reported-by: Alan Stern
    Tested-by: Joseph Chan
    Acked-by: "Rafael J. Wysocki"
    Signed-off-by: Jesse Barnes

    Jesse Barnes
     
  • This patch splits a new function, pci_bus_add_child(), from
    pci_bus_add_devices(). The new function can be used to register PCI
    buses to the device core.

    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Add a function to map a given resource number to a corresponding
    register so drivers can get the offset and type of device specific BARs.

    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Export __pci_read_base() so it can be used by whole PCI subsystem.

    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Change parameter of pci_ari_enabled() from 'pci_dev' to 'pci_bus'.

    ARI forwarding on the bridge mostly concerns the subordinate devices
    rather than the bridge itself. So this change will make the function
    easier to use.

    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • Since interrupts will soon be disabled at PCI resume time, we need to
    pre-allocate memory to save/restore PCI config space (or use GFP_ATOMIC,
    but this is safer).

    Reported-by: Linus Torvalds
    Signed-off-by: "Rafael J. Wysocki"
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • The _OSC capability OSC_MSI_SUPPORT is set when the root bridge is added
    with pci_acpi_osc_support(), so we no longer need to do it in the PCI
    MSI driver. Also adds the function pci_msi_enabled, which returns true
    if pci=nomsi is not on the kernel command-line.

    Signed-off-by: Andrew Patterson
    Signed-off-by: Jesse Barnes

    Andrew Patterson
     
  • /proc/bus/pci allows you to mmap resource ranges too, so we should probably be
    checking to make sure the mapping is somewhat valid. Uses the same code as the recent sysfs mmap range checking patch from Linus.

    Acked-by: David Miller
    Signed-off-by: Jesse Barnes

    Jesse Barnes
     

23 Oct, 2008

1 commit


21 Oct, 2008

4 commits

  • This adds the ability to mmap legacy IO space to the legacy_io files
    in sysfs on platforms that support it. This will allow to clean up
    X to use this instead of /dev/mem for legacy IO accesses such as
    those performed by Int10.

    While at it I moved pci_create/remove_legacy_files() to pci-sysfs.c
    where I think they belong, thus making more things statis in there
    and cleaned up some spurrious prototypes in the ia64 pci.h file

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Jesse Barnes

    Benjamin Herrenschmidt
     
  • This patch adds support for PCI Express Alternative Routing-ID
    Interpretation (ARI) capability.

    The ARI capability extends the Function Number field of the PCI Express
    Endpoint by reusing the Device Number which is otherwise hardwired to 0.
    With ARI, an Endpoint can have up to 256 functions.

    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Yu Zhao
     
  • This is a cleanup that changes all PCI configuration space size
    representations to the macros (PCI_CFG_SPACE_SIZE and
    PCI_CFG_SPACE_EXP_SIZE). And the macros are also moved from
    drivers/pci/probe.c to drivers/pci/pci.h.

    Signed-off-by: Yu Zhao
    Signed-off-by: Jesse Barnes

    Zhao, Yu
     
  • Stephen Hemminger wrote:
    > Looks like Mike created cpulistaffinty in sysfs but never completed
    > the job.

    This patch hooks things up correctly, taking care to remove the new file
    when the bus is destroyed.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: Mike Travis
    Signed-off-by: Jesse Barnes

    Mike Travis
     

17 Jul, 2008

2 commits

  • * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (72 commits)
    Revert "x86/PCI: ACPI based PCI gap calculation"
    PCI: remove unnecessary volatile in PCIe hotplug struct controller
    x86/PCI: ACPI based PCI gap calculation
    PCI: include linux/pm_wakeup.h for device_set_wakeup_capable
    PCI PM: Fix pci_prepare_to_sleep
    x86/PCI: Fix PCI config space for domains > 0
    Fix acpi_pm_device_sleep_wake() by providing a stub for CONFIG_PM_SLEEP=n
    PCI: Simplify PCI device PM code
    PCI PM: Introduce pci_prepare_to_sleep and pci_back_from_sleep
    PCI ACPI: Rework PCI handling of wake-up
    ACPI: Introduce new device wakeup flag 'prepared'
    ACPI: Introduce acpi_device_sleep_wake function
    PCI: rework pci_set_power_state function to call platform first
    PCI: Introduce platform_pci_power_manageable function
    ACPI: Introduce acpi_bus_power_manageable function
    PCI: make pci_name use dev_name
    PCI: handle pci_name() being const
    PCI: add stub for pci_set_consistent_dma_mask()
    PCI: remove unused arch pcibios_update_resource() functions
    PCI: fix pci_setup_device()'s sprinting into a const buffer
    ...

    Fixed up conflicts in various files (arch/x86/kernel/setup_64.c,
    arch/x86/pci/irq.c, arch/x86/pci/pci.h, drivers/acpi/sleep/main.c,
    drivers/pci/pci.c, drivers/pci/pci.h, include/acpi/acpi_bus.h) from x86
    and ACPI updates manually.

    Linus Torvalds
     
  • Since the second argument of acpi_pci_choose_state() and
    platform_pci_choose_state() is never used, remove it.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Andi Kleen
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

08 Jul, 2008

2 commits

  • * Introduce function acpi_pm_device_sleep_wake() for enabling and
    disabling the system wake-up capability of devices that are power
    manageable by ACPI.

    * Introduce function acpi_bus_can_wakeup() allowing other (dependent)
    subsystems to check if ACPI is able to enable the system wake-up
    capability of given device.

    * Introduce callback .sleep_wake() in struct pci_platform_pm_ops and
    for the ACPI PCI 'driver' make it use acpi_pm_device_sleep_wake().

    * Introduce callback .can_wakeup() in struct pci_platform_pm_ops and
    for the ACPI 'driver' make it use acpi_bus_can_wakeup().

    * Move the PME# handlig code out of pci_enable_wake() and split it
    into two functions, pci_pme_capable() and pci_pme_active(),
    allowing the caller to check if given device is capable of
    generating PME# from given power state and to enable/disable the
    device's PME# functionality, respectively.

    * Modify pci_enable_wake() to use the new ACPI callbacks and the new
    PME#-related functions.

    * Drop the generic .platform_enable_wakeup() callback that is not
    used any more.

    * Introduce device_set_wakeup_capable() that will set the
    power.can_wakeup flag of given device.

    * Rework PCI device PM initialization so that, if given device is
    capable of generating wake-up events, either natively through the
    PME# mechanism, or with the help of the platform, its
    power.can_wakeup flag is set and its power.should_wakeup flag is
    unset as appropriate.

    * Make ACPI set the power.can_wakeup flag for devices found to be
    wake-up capable by it.

    * Make the ACPI wake-up code enable/disable GPEs for devices that
    have the wakeup.flags.prepared flag set (which means that their
    wake-up power has been enabled).

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • Introduce function pointer platform_pci_power_manageable to be used
    by the platform-related code to point to a function allowing us to
    check if given device is power manageable by the platform.

    Introduce acpi_pci_power_manageable() playing that role for ACPI.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

03 Jul, 2008

1 commit

  • For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
    VPD end tag will hang the device. This problem was initially
    observed when a vpd entry was created in sysfs
    ('/sys/bus/pci/devices//vpd'). A read to this sysfs entry
    will dump 32k of data. Reading a full 32k will cause an access
    beyond the VPD end tag causing the device to hang. Once the device
    is hung, the bnx2 driver will not be able to reset the device.
    We believe that it is legal to read beyond the end tag and
    therefore the solution is to limit the read/write length.

    A majority of this patch is from Matthew Wilcox who gave code for
    reworking the PCI vpd size information. A PCI quirk added for the
    Broadcom NIC's to limit the read/write's.

    Signed-off-by: Benjamin Li
    Signed-off-by: Matthew Wilcox
    Signed-off-by: Jesse Barnes

    Benjamin Li
     

13 Jun, 2008

1 commit


12 Jun, 2008

1 commit


11 Jun, 2008

1 commit

  • Currently, /sys/bus/pci/slots/ only exposes hotplug attributes when a
    hotplug driver is loaded, but PCI slots have attributes such as address,
    speed, width, etc. that are not related to hotplug at all.

    Introduce pci_slot as the primary data structure and kobject model.
    Hotplug attributes described in hotplug_slot become a secondary
    structure associated with the pci_slot.

    This patch only creates the infrastructure that allows the separation of
    PCI slot attributes and hotplug attributes. In this patch, the PCI
    hotplug core remains the only user of this infrastructure, and thus,
    /sys/bus/pci/slots/ will still only become populated when a hotplug
    driver is loaded.

    A later patch in this series will add a second user of this new
    infrastructure and demonstrate splitting the task of exposing pci_slot
    attributes from hotplug_slot attributes.

    - Make pci_slot the primary sysfs entity. hotplug_slot becomes a
    subsidiary structure.
    o pci_create_slot() creates and registers a slot with the PCI core
    o pci_slot_add_hotplug() gives it hotplug capability

    - Change the prototype of pci_hp_register() to take the bus and
    slot number (on parent bus) as parameters.

    - Remove all the ->get_address methods since this functionality is
    now handled by pci_slot directly.

    [achiang@hp.com: rpaphp-correctly-pci_hp_register-for-empty-pci-slots]
    Tested-by: Badari Pulavarty
    Acked-by: Benjamin Herrenschmidt
    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: make headers_check happy]
    [akpm@linux-foundation.org: nuther build fix]
    [akpm@linux-foundation.org: fix typo in #include]
    Signed-off-by: Alex Chiang
    Signed-off-by: Matthew Wilcox
    Cc: Greg KH
    Cc: Kristen Carlson Accardi
    Cc: Len Brown
    Acked-by: Kenji Kaneshige
    Signed-off-by: Andrew Morton
    Signed-off-by: Jesse Barnes

    Alex Chiang
     

21 Apr, 2008

1 commit

  • Vital Product Data (VPD) may be exposed by PCI devices in several
    ways. It is generally unsafe to read this information through the
    existing interfaces to user-land because of stateful interfaces.

    This adds:
    - abstract operations for VPD access (struct pci_vpd_ops)
    - VPD state information in struct pci_dev (struct pci_vpd)
    - an implementation of the VPD access method specified in PCI 2.2
    (in access.c)
    - a 'vpd' binary file in sysfs directories for PCI devices with VPD
    operations defined

    It adds a probe for PCI 2.2 VPD in pci_scan_device() and release of
    VPD state in pci_release_dev().

    Signed-off-by: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Ben Hutchings
     

02 Feb, 2008

3 commits

  • This moves the pci_bus class device to be a real struct device and at
    the same time, place it in the device tree in the correct location.

    Note, the old "bridge" symlink is now gone, but this was a non-standard
    link and no userspace program used it. If you need to determine the
    device that the bus is on, follow the standard device symlink, or walk
    up the device tree.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Fixes a few coding style issues in the internal pci.h file

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • PCI error recovery usually involves the PCI adapter being reset.
    If the device is using MSI, the reset will cause the MSI state
    to be lost; the device driver needs to restore the MSI state.

    The pci_restore_msi_state() routine is currently protected
    by CONFIG_PM; remove this, and also export the symbol, so
    that it can be used in a modle.

    Signed-off-by: Linas Vepstas
    Signed-off-by: Greg Kroah-Hartman

    Linas Vepstas