1. 27 2月, 2014 1 次提交
    • B
      resource: Add resource_contains() · 5edb93b8
      Bjorn Helgaas 提交于
      We have two identical copies of resource_contains() already, and more
      places that could use it.  This moves it to ioport.h where it can be
      shared.
      
      resource_contains(struct resource *r1, struct resource *r2) returns true
      iff r1 and r2 are the same type (most callers already checked this
      separately) and the r1 address range completely contains r2.
      
      In addition, the new resource_contains() checks that both r1 and r2 have
      addresses assigned to them.  If a resource is IORESOURCE_UNSET, it doesn't
      have a valid address and can't contain or be contained by another resource.
      Some callers already check this or for res->start.
      
      No functional change.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      5edb93b8
  2. 30 4月, 2013 1 次提交
    • T
      resource: add release_mem_region_adjustable() · 825f787b
      Toshi Kani 提交于
      Add release_mem_region_adjustable(), which releases a requested region
      from a currently busy memory resource.  This interface adjusts the
      matched memory resource accordingly even if the requested region does
      not match exactly but still fits into.
      
      This new interface is intended for memory hot-delete.  During bootup,
      memory resources are inserted from the boot descriptor table, such as
      EFI Memory Table and e820.  Each memory resource entry usually covers
      the whole contigous memory range.  Memory hot-delete request, on the
      other hand, may target to a particular range of memory resource, and its
      size can be much smaller than the whole contiguous memory.  Since the
      existing release interfaces like __release_region() require a requested
      region to be exactly matched to a resource entry, they do not allow a
      partial resource to be released.
      
      This new interface is restrictive (i.e.  release under certain
      conditions), which is consistent with other release interfaces,
      __release_region() and __release_resource().  Additional release
      conditions, such as an overlapping region to a resource entry, can be
      supported after they are confirmed as valid cases.
      
      There is no change to the existing interfaces since their restriction is
      valid for I/O resources.
      
      [akpm@linux-foundation.org: use GFP_ATOMIC under write_lock()]
      [akpm@linux-foundation.org: switch back to GFP_KERNEL, less buggily]
      [akpm@linux-foundation.org: remove unneeded and wrong kfree(), per Toshi]
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Reviewed-by : Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Reviewed-by: NRam Pai <linuxram@us.ibm.com>
      Cc: T Makphaibulchoke <tmac@hp.com>
      Cc: Wen Congyang <wency@cn.fujitsu.com>
      Cc: Tang Chen <tangchen@cn.fujitsu.com>
      Cc: Jiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      825f787b
  3. 11 9月, 2012 2 次提交
  4. 08 5月, 2012 1 次提交
  5. 15 2月, 2012 1 次提交
  6. 31 7月, 2011 1 次提交
  7. 26 7月, 2011 1 次提交
  8. 18 12月, 2010 2 次提交
  9. 27 10月, 2010 1 次提交
    • B
      resources: support allocating space within a region from the top down · e7f8567d
      Bjorn Helgaas 提交于
      Allocate space from the top of a region first, then work downward,
      if an architecture desires this.
      
      When we allocate space from a resource, we look for gaps between children
      of the resource.  Previously, we always looked at gaps from the bottom up.
      For example, given this:
      
          [mem 0xbff00000-0xf7ffffff] PCI Bus 0000:00
            [mem 0xbff00000-0xbfffffff] gap -- available
            [mem 0xc0000000-0xdfffffff] PCI Bus 0000:02
            [mem 0xe0000000-0xf7ffffff] gap -- available
      
      we attempted to allocate from the [mem 0xbff00000-0xbfffffff] gap first,
      then the [mem 0xe0000000-0xf7ffffff] gap.
      
      With this patch an architecture can choose to allocate from the top gap
      [mem 0xe0000000-0xf7ffffff] first.
      
      We can't do this across the board because iomem_resource.end is initialized
      to 0xffffffff_ffffffff on 64-bit architectures, and most machines can't
      address the entire 64-bit physical address space.  Therefore, we only
      allocate top-down if the arch requests it by clearing
      "resource_alloc_from_bottom".
      Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      e7f8567d
  10. 12 5月, 2010 1 次提交
    • A
      resource: shared I/O region support · 8b6d043b
      Alan Cox 提交于
      SuperIO devices share regions and use lock/unlock operations to chip
      select.  We therefore need to be able to request a resource and wait for
      it to be freed by whichever other SuperIO device currently hogs it.
      Right now you have to poll which is horrible.
      
      Add a MUXED field to IO port resources. If the MUXED field is set on the
      resource and on the request (via request_muxed_region) then we block
      until the previous owner of the muxed resource releases their region.
      
      This allows us to implement proper resource sharing and locking for
      superio chips using code of the form
      
      enable_my_superio_dev() {
      	request_muxed_region(0x44, 0x02, "superio:watchdog");
      	outb() ..sequence to enable chip
      }
      
      disable_my_superio_dev() {
      	outb() .. sequence of disable chip
      	release_region(0x44, 0x02);
      }
      Signed-off-by: NGiel van Schijndel <me@mortis.eu>
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      8b6d043b
  11. 24 3月, 2010 1 次提交
  12. 15 3月, 2010 3 次提交
  13. 23 2月, 2010 3 次提交
  14. 02 2月, 2010 2 次提交
  15. 16 12月, 2009 1 次提交
  16. 23 9月, 2009 1 次提交
    • K
      walk system ram range · 908eedc6
      KAMEZAWA Hiroyuki 提交于
      Originally, walk_memory_resource() was introduced to traverse all memory
      of "System RAM" for detecting memory hotplug/unplug range.  For doing so,
      flags of IORESOUCE_MEM|IORESOURCE_BUSY was used and this was enough for
      memory hotplug.
      
      But for using other purpose, /proc/kcore, this may includes some firmware
      area marked as IORESOURCE_BUSY | IORESOUCE_MEM.  This patch makes the
      check strict to find out busy "System RAM".
      
      Note: PPC64 keeps their own walk_memory_resouce(), which walk through
      ppc64's lmb informaton.  Because old kclist_add() is called per lmb, this
      patch makes no difference in behavior, finally.
      
      And this patch removes CONFIG_MEMORY_HOTPLUG check from this function.
      Because pfn_valid() just show "there is memmap or not* and cannot be used
      for "there is physical memory or not", this function is useful in generic
      to scan physical memory range.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: WANG Cong <xiyou.wangcong@gmail.com>
      Cc: Américo Wang <xiyou.wangcong@gmail.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      908eedc6
  17. 12 6月, 2009 1 次提交
  18. 16 1月, 2009 1 次提交
  19. 08 1月, 2009 1 次提交
    • A
      resource: allow MMIO exclusivity for device drivers · e8de1481
      Arjan van de Ven 提交于
      Device drivers that use pci_request_regions() (and similar APIs) have a
      reasonable expectation that they are the only ones accessing their device.
      As part of the e1000e hunt, we were afraid that some userland (X or some
      bootsplash stuff) was mapping the MMIO region that the driver thought it
      had exclusively via /dev/mem or via various sysfs resource mappings.
      
      This patch adds the option for device drivers to cause their reserved
      regions to the "banned from /dev/mem use" list, so now both kernel memory
      and device-exclusive MMIO regions are banned.
      NOTE: This is only active when CONFIG_STRICT_DEVMEM is set.
      
      In addition to the config option, a kernel parameter iomem=relaxed is
      provided for the cases where developers want to diagnose, in the field,
      drivers issues from userspace.
      Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      e8de1481
  20. 17 10月, 2008 1 次提交
  21. 26 9月, 2008 1 次提交
  22. 14 9月, 2008 1 次提交
  23. 05 9月, 2008 1 次提交
    • Y
      IO resources: add reserve_region_with_split() · 268364a0
      Yinghai Lu 提交于
      add reserve_region_with_split() to not lose e820 reserved entries if
      they overlap with existing IO regions:
      
      with test case by extend 0xe0000000 - 0xeffffff to 0xdd800000 -
      we get:
      	e0000000-efffffff : PCI MMCONFIG 0
      		 e0000000-efffffff : reserved
      
      and in /proc/iomem we get:
      	found conflict for reserved [dd800000, efffffff], try to reserve with split
      	    __reserve_region_with_split: (PCI Bus #80) [dd000000, ddffffff], res: (reserved) [dd800000, efffffff]
      	    __reserve_region_with_split: (PCI Bus #00) [de000000, dfffffff], res: (reserved) [de000000, efffffff]
      	initcall pci_subsys_init+0x0/0x121 returned 0 after 381 msecs
      in dmesg
      
      various fixes and improvements suggested by Linus.
      Signed-off-by: NYinghai Lu <yhlu.kernel@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      268364a0
  24. 30 8月, 2008 1 次提交
  25. 31 7月, 2008 1 次提交
  26. 17 7月, 2008 2 次提交
  27. 12 6月, 2008 1 次提交
  28. 21 4月, 2008 1 次提交
    • I
      PCI: clean up resource alignment management · 88452565
      Ivan Kokshaysky 提交于
      Done per Linus' request and suggestions. Linus has explained that
      better than I'll be able to explain:
      
      On Thu, Mar 27, 2008 at 10:12:10AM -0700, Linus Torvalds wrote:
      > Actually, before we go any further, there might be a less intrusive
      > alternative: add just a couple of flags to the resource flags field (we
      > still have something like 8 unused bits on 32-bit), and use those to
      > implement a generic "resource_alignment()" routine.
      >
      > Two flags would do it:
      >
      >  - IORESOURCE_SIZEALIGN: size indicates alignment (regular PCI device
      >    resources)
      >
      >  - IORESOURCE_STARTALIGN: start field is alignment (PCI bus resources
      >    during probing)
      >
      > and then the case of both flags zero (or both bits set) would actually be
      > "invalid", and we would also clear the IORESOURCE_STARTALIGN flag when we
      > actually allocate the resource (so that we don't use the "start" field as
      > alignment incorrectly when it no longer indicates alignment).
      >
      > That wouldn't be totally generic, but it would have the nice property of
      > automatically at least add sanity checking for that whole "res->start has
      > the odd meaning of 'alignment' during probing" and remove the need for a
      > new field, and it would allow us to have a generic "resource_alignment()"
      > routine that just gets a resource pointer.
      
      Besides, I removed IORESOURCE_BUS_HAS_VGA flag which was unused for ages.
      Signed-off-by: NIvan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Gary Hade <garyhade@us.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      88452565
  29. 30 1月, 2008 1 次提交
  30. 17 10月, 2007 1 次提交
  31. 29 4月, 2007 1 次提交
    • J
      libata/IDE: remove combined mode quirk · 8cdfb29c
      Jeff Garzik 提交于
      Both old-IDE and libata should be able handle all controllers and
      devices found using normal resource reservation methods.
      
      This eliminates the awful, low-performing split-driver configuration
      where old-IDE drove the PATA portion of a PCI device, in PIO-only mode,
      and libata drove the SATA portion of the /same/ PCI device, in DMA mode.
      Typically vendors would ship SATA hard drive / PATA optical
      configuration, which would lend itself to slow (PIO-only) CD-ROM
      performance.
      
      For Intel users running in combined mode, it is now wholly dependent on
      your driver choice (potentially link order, if you compile both drivers
      in) whether old-IDE or libata will drive your hardware.
      
      In either case, you will get full performance from both SATA and PATA
      ports now, without having to pass a kernel command line parameter.
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      8cdfb29c
  32. 10 2月, 2007 1 次提交
    • T
      devres: device resource management · 9ac7849e
      Tejun Heo 提交于
      Implement device resource management, in short, devres.  A device
      driver can allocate arbirary size of devres data which is associated
      with a release function.  On driver detach, release function is
      invoked on the devres data, then, devres data is freed.
      
      devreses are typed by associated release functions.  Some devreses are
      better represented by single instance of the type while others need
      multiple instances sharing the same release function.  Both usages are
      supported.
      
      devreses can be grouped using devres group such that a device driver
      can easily release acquired resources halfway through initialization
      or selectively release resources (e.g. resources for port 1 out of 4
      ports).
      
      This patch adds devres core including documentation and the following
      managed interfaces.
      
      * alloc/free	: devm_kzalloc(), devm_kzfree()
      * IO region	: devm_request_region(), devm_release_region()
      * IRQ		: devm_request_irq(), devm_free_irq()
      * DMA		: dmam_alloc_coherent(), dmam_free_coherent(),
      		  dmam_declare_coherent_memory(), dmam_pool_create(),
      		  dmam_pool_destroy()
      * PCI		: pcim_enable_device(), pcim_pin_device(), pci_is_managed()
      * iomap		: devm_ioport_map(), devm_ioport_unmap(), devm_ioremap(),
      		  devm_ioremap_nocache(), devm_iounmap(), pcim_iomap_table(),
      		  pcim_iomap(), pcim_iounmap()
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9ac7849e