1. 21 10月, 2008 3 次提交
  2. 03 10月, 2008 1 次提交
    • L
      Check mapped ranges on sysfs resource files · b5ff7df3
      Linus Torvalds 提交于
      This is loosely based on a patch by Jesse Barnes to check the user-space
      PCI mappings though the sysfs interfaces.  Quoting Jesse's original
      explanation:
      
        It's fairly common for applications to map PCI resources through sysfs.
        However, with the current implementation, it's possible for an application
        to map far more than the range corresponding to the resourceN file it
        opened.  This patch plugs that hole by checking the range at mmap time,
        similar to what is done on platforms like sparc64 in their lower level
        PCI remapping routines.
      
        It was initially put together to help debug the e1000e NVRAM corruption
        problem, since we initially thought an X driver might be walking past the
        end of one of its mappings and clobbering the NVRAM.  It now looks like
        that's not the case, but doing the check is still important for obvious
        reasons.
      
      and this version of the patch differs in that it uses a helper function
      to clarify the code, and does all the checks in pages (instead of bytes)
      in order to avoid overflows when doing "<< PAGE_SHIFT" etc.
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b5ff7df3
  3. 03 7月, 2008 1 次提交
    • B
      PCI: Limit VPD read/write lengths for Broadcom 5706, 5708, 5709 rev. · 99cb233d
      Benjamin Li 提交于
      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/<id>/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: NBenjamin Li <benli@broadcom.com>
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      99cb233d
  4. 02 7月, 2008 1 次提交
  5. 13 6月, 2008 1 次提交
  6. 12 6月, 2008 1 次提交
  7. 13 5月, 2008 1 次提交
  8. 21 4月, 2008 2 次提交
    • B
      PCI: Expose PCI VPD through sysfs · 94e61088
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      94e61088
    • S
      PCI: add PCI Express ASPM support · 7d715a6c
      Shaohua Li 提交于
      PCI Express ASPM defines a protocol for PCI Express components in the D0
      state to reduce Link power by placing their Links into a low power state
      and instructing the other end of the Link to do likewise. This
      capability allows hardware-autonomous, dynamic Link power reduction
      beyond what is achievable by software-only controlled power management.
      However, The device should be configured by software appropriately.
      Enabling ASPM will save power, but will introduce device latency.
      
      This patch adds ASPM support in Linux. It introduces a global policy for
      ASPM, a sysfs file /sys/module/pcie_aspm/parameters/policy can control
      it. The interface can be used as a boot option too. Currently we have
      below setting:
              -default, BIOS default setting
              -powersave, highest power saving mode, enable all available ASPM
      state and clock power management
              -performance, highest performance, disable ASPM and clock power
      management
      By default, the 'default' policy is used currently.
      
      In my test, power difference between powersave mode and performance mode
      is about 1.3w in a system with 3 PCIE links.
      
      Note: some devices might not work well with aspm, either because chipset
      issue or device issue. The patch provide API (pci_disable_link_state),
      driver can disable ASPM for specific device.
      Signed-off-by: NShaohua Li <shaohua.li@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7d715a6c
  9. 20 4月, 2008 1 次提交
  10. 03 2月, 2008 1 次提交
  11. 02 2月, 2008 2 次提交
    • G
      PCI: make pci_bus a struct device · fd7d1ced
      Greg Kroah-Hartman 提交于
      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: NGreg Kroah-Hartman <gregkh@suse.de>
      fd7d1ced
    • S
      PCI: PCIE ASPM support · 6c723d5b
      Shaohua Li 提交于
      PCI Express ASPM defines a protocol for PCI Express components in the D0
      state to reduce Link power by placing their Links into a low power state
      and instructing the other end of the Link to do likewise. This
      capability allows hardware-autonomous, dynamic Link power reduction
      beyond what is achievable by software-only controlled power management.
      However, The device should be configured by software appropriately.
      Enabling ASPM will save power, but will introduce device latency.
      
      This patch adds ASPM support in Linux. It introduces a global policy for
      ASPM, a sysfs file /sys/module/pcie_aspm/parameters/policy can control
      it. The interface can be used as a boot option too. Currently we have
      below setting:
              -default, BIOS default setting
              -powersave, highest power saving mode, enable all available ASPM
      state
      and clock power management
              -performance, highest performance, disable ASPM and clock power
      management
      By default, the 'default' policy is used currently.
      
      In my test, power difference between powersave mode and performance mode
      is about 1.3w in a system with 3 PCIE links.
      Signed-off-by: NShaohua Li <shaohua.li@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6c723d5b
  12. 29 11月, 2007 1 次提交
  13. 17 7月, 2007 1 次提交
    • A
      Remove capability.h from mm.h · aa0ac365
      Alexey Dobriyan 提交于
      I forgot to remove capability.h from mm.h while removing sched.h!  This
      patch remedies that, because the only inline function which was using
      CAP_something was made out of line.
      
      Cross-compile tested without regressions on:
      
      	all powerpc defconfigs
      	all mips defconfigs
      	all m68k defconfigs
      	all arm defconfigs
      	all ia64 defconfigs
      
      	alpha alpha-allnoconfig alpha-defconfig alpha-up
      	arm
      	i386 i386-allnoconfig i386-defconfig i386-up
      	ia64 ia64-allnoconfig ia64-defconfig ia64-up
      	m68k
      	mips
      	parisc parisc-allnoconfig parisc-defconfig parisc-up
      	powerpc powerpc-up
      	s390 s390-allnoconfig s390-defconfig s390-up
      	sparc sparc-allnoconfig sparc-defconfig sparc-up
      	sparc64 sparc64-allnoconfig sparc64-defconfig sparc64-up
      	um-x86_64
      	x86_64 x86_64-allnoconfig x86_64-defconfig x86_64-up
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aa0ac365
  14. 12 7月, 2007 4 次提交
    • Z
      sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes · 91a69029
      Zhang Rui 提交于
      Well, first of all, I don't want to change so many files either.
      
      What I do:
      Adding a new parameter "struct bin_attribute *" in the
      .read/.write methods for the sysfs binary attributes.
      
      In fact, only the four lines change in fs/sysfs/bin.c and
      include/linux/sysfs.h do the real work.
      But I have to update all the files that use binary attributes
      to make them compatible with the new .read and .write methods.
      I'm not sure if I missed any. :(
      
      Why I do this:
      For a sysfs attribute, we can get a pointer pointing to the
      struct attribute in the .show/.store method,
      while we can't do this for the binary attributes.
      I don't know why this is different, but this does make it not
      so handy to use the binary attributes as the regular ones.
      So I think this patch is reasonable. :)
      
      Who benefits from it:
      The patch that exposes ACPI tables in sysfs
      requires such an improvement.
      All the table binary attributes share the same .read method.
      Parameter "struct bin_attribute *" is used to get
      the table signature and instance number which are used to
      distinguish different ACPI table binary attributes.
      
      Without this parameter, we need to offer different .read methods
      for different ACPI table binary attributes.
      This is impossible as there are various ACPI tables on different
      platforms, and we don't know what they are until they are loaded.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      91a69029
    • T
      sysfs: kill unnecessary attribute->owner · 7b595756
      Tejun Heo 提交于
      sysfs is now completely out of driver/module lifetime game.  After
      deletion, a sysfs node doesn't access anything outside sysfs proper,
      so there's no reason to hold onto the attribute owners.  Note that
      often the wrong modules were accounted for as owners leading to
      accessing removed modules.
      
      This patch kills now unnecessary attribute->owner.  Note that with
      this change, userland holding a sysfs node does not prevent the
      backing module from being unloaded.
      
      For more info regarding lifetime rule cleanup, please read the
      following message.
      
        http://article.gmane.org/gmane.linux.kernel/510293
      
      (tweaked by Greg to not delete the field just yet, to make it easier to
      merge things properly.)
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7b595756
    • M
      PCI: Make pcibios_add_platform_entries() return errors · a2cd52ca
      Michael Ellerman 提交于
      Currently pcibios_add_platform_entries() returns void, but could fail,
      so instead have it return an int and propagate errors up to
      pci_create_sysfs_dev_files().
      
      Fixes:
      arch/powerpc/kernel/pci_64.c: In function 'pcibios_add_platform_entries':
      arch/powerpc/kernel/pci_64.c:878: warning: ignoring return value of
      	'device_create_file', declared with attribute warn_unused_result
      arch/powerpc/kernel/pci_32.c: In function 'pcibios_add_platform_entries':
        arch/powerpc/kernel/pci_32.c:1043: warning: ignoring return value of
      	'device_create_file', declared with attribute warn_unused_result
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      a2cd52ca
    • M
      PCI: Use a weak symbol for the empty version of pcibios_add_platform_entries() · 575e3348
      Michael Ellerman 提交于
      I'm not sure if this is going to fly, weak symbols work on the compilers I'm
      using, but whether they work for all of the affected architectures I can't say.
      I've cc'ed as many arch maintainers/lists as I could find.
      
      But assuming they do, we can use a weak empty definition of
      pcibios_add_platform_entries() to avoid having an empty definition on every
      arch.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      575e3348
  15. 03 5月, 2007 2 次提交
  16. 17 2月, 2007 1 次提交
  17. 02 12月, 2006 1 次提交
    • I
      PCI: switch pci_{enable,disable}_device() to be nestable · bae94d02
      Inaky Perez-Gonzalez 提交于
      Changes the pci_{enable,disable}_device() functions to work in a
      nested basis, so that eg, three calls to enable_device() require three
      calls to disable_device().
      
      The reason for this is to simplify PCI drivers for
      multi-interface/capability devices. These are devices that cram more
      than one interface in a single function. A relevant example of that is
      the Wireless [USB] Host Controller Interface (similar to EHCI) [see
      http://www.intel.com/technology/comms/wusb/whci.htm]. 
      
      In these kind of devices, multiple interfaces are accessed through a
      single bar and IRQ line. For that, the drivers map only the smallest
      area of the bar to access their register banks and use shared IRQ
      handlers. 
      
      However, because the order at which those drivers load cannot be known
      ahead of time, the sequence in which the calls to pci_enable_device()
      and pci_disable_device() cannot be predicted. Thus:
      
      1. driverA     starts     pci_enable_device()
      2. driverB     starts     pci_enable_device()
      3. driverA     shutdown   pci_disable_device()
      4. driverB     shutdown   pci_disable_device()
      
      between steps 3 and 4, driver B would loose access to it's device,
      even if it didn't intend to.
      
      By using this modification, the device won't be disabled until all the
      callers to enable() have called disable().
      
      This is implemented by replacing 'struct pci_dev->is_enabled' from a
      bitfield to an atomic use count. Each caller to enable increments it,
      each caller to disable decrements it. When the count increments from 0
      to 1, __pci_enable_device() is called to actually enable the
      device. When it drops to zero, pci_disable_device() actually does the
      disabling.
      
      We keep the backend __pci_enable_device() for pci_default_resume() to
      use and also change the sysfs method implementation, so that userspace
      enabling/disabling the device doesn't disable it one time too much.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bae94d02
  18. 13 11月, 2006 1 次提交
    • D
      [PATCH] pci: don't try to remove sysfs files before they are setup. · d67afe5e
      David Miller 提交于
      The PCI sysfs attributes are created after the initial PCI bus scan.  With
      the addition of more return value checking and assertions in the device and
      sysfs layers we now can get dumps like this on sparc64:
      
      [   20.135032] Call Trace:
      [   20.135042]  [0000000000537f88] pci_remove_bus_device+0x30/0xc0
      [   20.135076]  [000000000078f890] pci_fill_in_pbm_cookies+0x98/0x440
      [   20.135109]  [000000000042e828] sabre_scan_bus+0x230/0x400
      [   20.135139]  [000000000078c710] pcibios_init+0x58/0xa0
      [   20.135159]  [0000000000416f14] init+0x9c/0x2e0
      [   20.135190]  [0000000000417a50] kernel_thread+0x38/0x60
      [   20.135211]  [0000000000417170] rest_init+0x18/0x40
      [   20.135514] PCI0(PBMB): Bus running at 33MHz
      
      It's triggering because removal of the "config" PCI sysfs file for the
      device fails.
      
      On sparc64, after probing the device, we'll delete the PCI device via
      pci_remove_bus_device() if we cannot find the firmware device tree node
      corresponding to it.
      
      This is fine, but at this point the sysfs files for the PCI device won't be
      setup yet.
      
      So we should not try to do anything in pci_remove_sysfs_dev_files() if
      pci_sysfs_init() has not run yet.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d67afe5e
  19. 27 9月, 2006 2 次提交
  20. 01 7月, 2006 1 次提交
  21. 28 6月, 2006 1 次提交
  22. 22 6月, 2006 2 次提交
    • D
      [PATCH] PCI: Bus Parity Status sysfs interface · bdee9d98
      Doug Thompson 提交于
      From: Doug Thompson <norsk5@yahoo.com>
      
      This patch adds the 'broken_parity_status' sysfs attribute file to a PCI device.
      Reading this attribute a userland program can determine if PCI device provides false
      positives (value of 1) in its generation of PCI Parity status, or not (value of 0).
      As PCI devices are found to be 'bad' in this regard, userland programs can also set
      the appropriate value (root access only) of a faulty device. This per device
      information will be used in the EDAC PCI Parity scanner code in a future patch once
      this interface becomes available.
      Signed-off-by: NDoug Thompson <norsk5@yahoo.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bdee9d98
    • A
      [PATCH] PCI: Add a "enable" sysfs attribute to the pci devices to allow... · 9f125d30
      Arjan van de Ven 提交于
      [PATCH] PCI: Add a "enable" sysfs attribute to the pci devices to allow userspace (Xorg) to enable devices without doing foul direct access
      
      This patch adds an "enable" sysfs attribute to each PCI device. When read it
      shows the "enabled-ness" of the device, but you can write a "0" into it to
      disable a device, and a "1" to enable it.
      
      This later is needed for X and other cases where userspace wants to enable
      the BARs on a device (typical example: to run the video bios on a secundary
      head). Right now X does all this "by hand" via bitbanging, that's just evil.
      This allows X to no longer do that but to just let the kernel do this.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      CC: Peter Jones <pjones@redhat.com>
      Acked-by: NDave Airlie <airlied@linux.ie>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9f125d30
  23. 24 3月, 2006 1 次提交
  24. 29 10月, 2005 1 次提交
    • B
      [PATCH] PCI: Block config access during BIST · e04b0ea2
      Brian King 提交于
      Some PCI adapters (eg.  ipr scsi adapters) have an exposure today in that they
      issue BIST to the adapter to reset the card.  If, during the time it takes to
      complete BIST, userspace attempts to access PCI config space, the host bus
      bridge will master abort the access since the ipr adapter does not respond on
      the PCI bus for a brief period of time when running BIST.  On PPC64 hardware,
      this master abort results in the host PCI bridge isolating that PCI device
      from the rest of the system, making the device unusable until Linux is
      rebooted.  This patch is an attempt to close that exposure by introducing some
      blocking code in the PCI code.  When blocked, writes will be humored and reads
      will return the cached value.  Ben Herrenschmidt has also mentioned that he
      plans to use this in PPC power management.
      Signed-off-by: NBrian King <brking@us.ibm.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
       drivers/pci/access.c    |   89 ++++++++++++++++++++++++++++++++++++++++++++++++
       drivers/pci/pci-sysfs.c |   20 +++++-----
       drivers/pci/pci.h       |    7 +++
       drivers/pci/proc.c      |   28 +++++++--------
       drivers/pci/syscall.c   |   14 +++----
       include/linux/pci.h     |    7 +++
       6 files changed, 134 insertions(+), 31 deletions(-)
      e04b0ea2
  25. 22 9月, 2005 1 次提交
  26. 11 9月, 2005 1 次提交
  27. 28 6月, 2005 1 次提交
    • M
      [PATCH] PCI: fix-pci-mmap-on-ppc-and-ppc64.patch · 2311b1f2
      Michael Ellerman 提交于
      This is an updated version of Ben's fix-pci-mmap-on-ppc-and-ppc64.patch
      which is in 2.6.12-rc4-mm1.
      
      It fixes the patch to work on PPC iSeries, removes some debug printks
      at Ben's request, and incorporates your
      fix-pci-mmap-on-ppc-and-ppc64-fix.patch also.
      
      Originally from Benjamin Herrenschmidt <benh@kernel.crashing.org>
      
      This patch was discussed at length on linux-pci and so far, the last
      iteration of it didn't raise any comment.  It's effect is a nop on
      architecture that don't define the new pci_resource_to_user() callback
      anyway.  It allows architecture like ppc who put weird things inside of
      PCI resource structures to convert to some different value for user
      visible ones.  It also fixes mmap'ing of IO space on those archs.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2311b1f2
  28. 21 6月, 2005 3 次提交