17 May, 2016

1 commit


17 Mar, 2016

2 commits

  • Pull libnvdimm updates from Dan Williams:

    - Asynchronous address range scrub:

    Given the capacities of next generation persistent memory devices a
    scrub operation to find all poison may take 10s of seconds. We
    want this scrub work to be done asynchronously with the rest of
    system initialization, so we move it out of line from the NFIT
    probing, i.e. acpi_nfit_add().

    - Clear poison:

    ACPI 6.1 introduces the ability to send "clear error" commands to
    the ACPI0012:00 device representing the root of an "nvdimm bus".
    Similar to relocating a bad block on a disk, this support clears
    media errors in response to a write.

    - Persistent memory resource tracking:

    A persistent memory range may be designated as simply "reserved" by
    platform firmware in the efi/e820 memory map. Later when the NFIT
    driver loads it discovers that the range is "Persistent Memory".

    The NFIT bus driver inserts a resource to advertise that
    "persistent" attribute in the system resource tree for /proc/iomem
    and kernel-internal usages.

    - Miscellaneous cleanups and fixes:

    Workaround section misaligned pmem ranges when allocating a struct
    page memmap, fix handling of the read-only case in the ioctl path,
    and clean up block device major number allocation.

    * tag 'libnvdimm-for-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (26 commits)
    libnvdimm, pmem: clear poison on write
    libnvdimm, pmem: fix kmap_atomic() leak in error path
    nvdimm/btt: don't allocate unused major device number
    nvdimm/blk: don't allocate unused major device number
    pmem: don't allocate unused major device number
    ACPI: Change NFIT driver to insert new resource
    resource: Export insert_resource and remove_resource
    resource: Add remove_resource interface
    resource: Change __request_region to inherit from immediate parent
    libnvdimm, pmem: fix ia64 build, use PHYS_PFN
    nfit, libnvdimm: clear poison command support
    libnvdimm, pfn: 'resource'-address and 'size' attributes for pfn devices
    libnvdimm, pmem: adjust for section collisions with 'System RAM'
    libnvdimm, pmem: fix 'pfn' support for section-misaligned namespaces
    libnvdimm: Fix security issue with DSM IOCTL.
    libnvdimm: Clean-up access mode check.
    tools/testing/nvdimm: expand ars unit testing
    nfit: disable userspace initiated ars during scrub
    nfit: scrub and register regions in a workqueue
    nfit, libnvdimm: async region scrub workqueue
    ...

    Linus Torvalds
     
  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for v4.6:

    Enumeration:
    - Disable IO/MEM decoding for devices with non-compliant BARs (Bjorn Helgaas)
    - Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs (Bjorn Helgaas

    Resource management:
    - Mark shadow copy of VGA ROM as IORESOURCE_PCI_FIXED (Bjorn Helgaas)
    - Don't assign or reassign immutable resources (Bjorn Helgaas)
    - Don't enable/disable ROM BAR if we're using a RAM shadow copy (Bjorn Helgaas)
    - Set ROM shadow location in arch code, not in PCI core (Bjorn Helgaas)
    - Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs (Bjorn Helgaas)
    - ia64: Use ioremap() instead of open-coded equivalent (Bjorn Helgaas)
    - ia64: Keep CPU physical (not virtual) addresses in shadow ROM resource (Bjorn Helgaas)
    - MIPS: Keep CPU physical (not virtual) addresses in shadow ROM resource (Bjorn Helgaas)
    - Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY (Bjorn Helgaas)
    - Don't leak memory if sysfs_create_bin_file() fails (Bjorn Helgaas)
    - rcar: Remove PCI_PROBE_ONLY handling (Lorenzo Pieralisi)
    - designware: Remove PCI_PROBE_ONLY handling (Lorenzo Pieralisi)

    Virtualization:
    - Wait for up to 1000ms after FLR reset (Alex Williamson)
    - Support SR-IOV on any function type (Kelly Zytaruk)
    - Add ACS quirk for all Cavium devices (Manish Jaggi)

    AER:
    - Rename pci_ops_aer to aer_inj_pci_ops (Bjorn Helgaas)
    - Restore pci_ops pointer while calling original pci_ops (David Daney)
    - Fix aer_inject error codes (Jean Delvare)
    - Use dev_warn() in aer_inject (Jean Delvare)
    - Log actual error causes in aer_inject (Jean Delvare)
    - Log aer_inject error injections (Jean Delvare)

    VPD:
    - Prevent VPD access for buggy devices (Babu Moger)
    - Move pci_read_vpd() and pci_write_vpd() close to other VPD code (Bjorn Helgaas)
    - Move pci_vpd_release() from header file to pci/access.c (Bjorn Helgaas)
    - Remove struct pci_vpd_ops.release function pointer (Bjorn Helgaas)
    - Rename VPD symbols to remove unnecessary "pci22" (Bjorn Helgaas)
    - Fold struct pci_vpd_pci22 into struct pci_vpd (Bjorn Helgaas)
    - Sleep rather than busy-wait for VPD access completion (Bjorn Helgaas)
    - Update VPD definitions (Hannes Reinecke)
    - Allow access to VPD attributes with size 0 (Hannes Reinecke)
    - Determine actual VPD size on first access (Hannes Reinecke)

    Generic host bridge driver:
    - Move structure definitions to separate header file (David Daney)
    - Add pci_host_common_probe(), based on gen_pci_probe() (David Daney)
    - Expose pci_host_common_probe() for use by other drivers (David Daney)

    Altera host bridge driver:
    - Fix altera_pcie_link_is_up() (Ley Foon Tan)

    Cavium ThunderX host bridge driver:
    - Add PCIe host driver for ThunderX processors (David Daney)
    - Add driver for ThunderX-pass{1,2} on-chip devices (David Daney)

    Freescale i.MX6 host bridge driver:
    - Add DT bindings to configure PHY Tx driver settings (Justin Waters)
    - Move imx6_pcie_reset_phy() near other PHY handling functions (Lucas Stach)
    - Move PHY reset into imx6_pcie_establish_link() (Lucas Stach)
    - Remove broken Gen2 workaround (Lucas Stach)
    - Move link up check into imx6_pcie_wait_for_link() (Lucas Stach)

    Freescale Layerscape host bridge driver:
    - Add "fsl,ls2085a-pcie" compatible ID (Yang Shi)

    Intel VMD host bridge driver:
    - Attach VMD resources to parent domain's resource tree (Jon Derrick)
    - Set bus resource start to 0 (Keith Busch)

    Microsoft Hyper-V host bridge driver:
    - Add fwnode_handle to x86 pci_sysdata (Jake Oshins)
    - Look up IRQ domain by fwnode_handle (Jake Oshins)
    - Add paravirtual PCI front-end for Microsoft Hyper-V VMs (Jake Oshins)

    NVIDIA Tegra host bridge driver:
    - Add pci_ops.{add,remove}_bus() callbacks (Thierry Reding)
    - Implement ->{add,remove}_bus() callbacks (Thierry Reding)
    - Remove unused struct tegra_pcie.num_ports field (Thierry Reding)
    - Track bus -> CPU mapping (Thierry Reding)
    - Remove misleading PHYS_OFFSET (Thierry Reding)

    Renesas R-Car host bridge driver:
    - Depend on ARCH_RENESAS, not ARCH_SHMOBILE (Simon Horman)

    Synopsys DesignWare host bridge driver:
    - ARC: Add PCI support (Joao Pinto)
    - Add generic dw_pcie_wait_for_link() (Joao Pinto)
    - Add default link up check if sub-driver doesn't override (Joao Pinto)
    - Add driver for prototyping kits based on ARC SDP (Joao Pinto)

    TI Keystone host bridge driver:
    - Defer probing if devm_phy_get() returns -EPROBE_DEFER (Shawn Lin)

    Xilinx AXI host bridge driver:
    - Use of_pci_get_host_bridge_resources() to parse DT (Bharat Kumar Gogada)
    - Remove dependency on ARM-specific struct hw_pci (Bharat Kumar Gogada)
    - Don't call pci_fixup_irqs() on Microblaze (Bharat Kumar Gogada)
    - Update Zynq binding with Microblaze node (Bharat Kumar Gogada)
    - microblaze: Support generic Xilinx AXI PCIe Host Bridge IP driver (Bharat Kumar Gogada)

    Xilinx NWL host bridge driver:
    - Add support for Xilinx NWL PCIe Host Controller (Bharat Kumar Gogada)

    Miscellaneous:
    - Check device_attach() return value always (Bjorn Helgaas)
    - Move pci_set_flags() from asm-generic/pci-bridge.h to linux/pci.h (Bjorn Helgaas)
    - Remove includes of empty asm-generic/pci-bridge.h (Bjorn Helgaas)
    - ARM64: Remove generated include of asm-generic/pci-bridge.h (Bjorn Helgaas)
    - Remove empty asm-generic/pci-bridge.h (Bjorn Helgaas)
    - Remove includes of asm/pci-bridge.h (Bjorn Helgaas)
    - Consolidate PCI DMA constants and interfaces in linux/pci-dma-compat.h (Bjorn Helgaas)
    - unicore32: Remove unused HAVE_ARCH_PCI_SET_DMA_MASK definition (Bjorn Helgaas)
    - Cleanup pci/pcie/Kconfig whitespace (Andreas Ziegler)
    - Include pci/hotplug Kconfig directly from pci/Kconfig (Bjorn Helgaas)
    - Include pci/pcie/Kconfig directly from pci/Kconfig (Bogicevic Sasa)
    - frv: Remove stray pci_{alloc,free}_consistent() declaration (Christoph Hellwig)
    - Move pci_dma_* helpers to common code (Christoph Hellwig)
    - Add PCI_CLASS_SERIAL_USB_DEVICE definition (Heikki Krogerus)
    - Add QEMU top-level IDs for (sub)vendor & device (Robin H. Johnson)
    - Fix broken URL for Dell biosdevname (Naga Venkata Sai Indubhaskar Jupudi)"

    * tag 'pci-v4.6-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (94 commits)
    PCI: Add PCI_CLASS_SERIAL_USB_DEVICE definition
    PCI: designware: Add driver for prototyping kits based on ARC SDP
    PCI: designware: Add default link up check if sub-driver doesn't override
    PCI: designware: Add generic dw_pcie_wait_for_link()
    PCI: Cleanup pci/pcie/Kconfig whitespace
    PCI: Simplify pci_create_attr() control flow
    PCI: Don't leak memory if sysfs_create_bin_file() fails
    PCI: Simplify sysfs ROM cleanup
    PCI: Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY
    MIPS: Loongson 3: Keep CPU physical (not virtual) addresses in shadow ROM resource
    MIPS: Loongson 3: Use temporary struct resource * to avoid repetition
    ia64/PCI: Keep CPU physical (not virtual) addresses in shadow ROM resource
    ia64/PCI: Use ioremap() instead of open-coded equivalent
    ia64/PCI: Use temporary struct resource * to avoid repetition
    PCI: Clean up pci_map_rom() whitespace
    PCI: Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs
    PCI: thunder: Add driver for ThunderX-pass{1,2} on-chip devices
    PCI: thunder: Add PCIe host driver for ThunderX processors
    PCI: generic: Expose pci_host_common_probe() for use by other drivers
    PCI: generic: Add pci_host_common_probe(), based on gen_pci_probe()
    ...

    Linus Torvalds
     

12 Mar, 2016

1 commit


10 Mar, 2016

1 commit

  • insert_resource() and insert_resource_conflict() are called
    by resource producers to insert a new resource. When there
    is any conflict, they move conflicting resources down to the
    children of the new resource. There is no destructor of these
    interfaces, however.

    Add remove_resource(), which removes a resource previously
    inserted by insert_resource() or insert_resource_conflict(),
    and moves the children up to where they were before.

    __release_resource() is changed to have @release_child, so
    that this function can be used for remove_resource() as well.

    Also add comments to clarify that these functions are intended
    for producers of resources to avoid any confusion with
    request/release_resource() for consumers.

    Signed-off-by: Toshi Kani
    Cc: Ingo Molnar
    Cc: Borislav Petkov
    Cc: Andrew Morton
    Cc: Dan Williams
    Signed-off-by: Dan Williams

    Toshi Kani
     

09 Mar, 2016

1 commit

  • IORESOURCE_ROM_SHADOW means there is a copy of a device's option ROM in
    RAM. The existence of such a copy and its location are arch-specific.
    Previously the IORESOURCE_ROM_SHADOW flag was set in arch code, but the
    0xC0000-0xDFFFF location was hard-coded into the PCI core.

    If we're using a shadow copy in RAM, disable the ROM BAR and release the
    address space it was consuming. Move the location information from the PCI
    core to the arch code that sets IORESOURCE_ROM_SHADOW. Save the location
    of the RAM copy in the struct resource for PCI_ROM_RESOURCE.

    After this change, pci_map_rom() will call pci_assign_resource() and
    pci_enable_rom() for these IORESOURCE_ROM_SHADOW resources, which we did
    not do before. This is safe because:

    - pci_assign_resource() will do nothing because the resource is marked
    IORESOURCE_PCI_FIXED, which means we can't move it, and

    - pci_enable_rom() will not turn on the ROM BAR's enable bit because the
    resource is marked IORESOURCE_ROM_SHADOW, which means it is in RAM
    rather than in PCI memory space.

    Storing the location in the struct resource means "lspci" will show the
    shadow location, not the value from the ROM BAR.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

30 Jan, 2016

4 commits

  • walk_iomem_res_desc() replaced walk_iomem_res() and there is no
    caller to walk_iomem_res() any more. Kill it. Also remove @name
    from find_next_iomem_res() as it is no longer used.

    Signed-off-by: Toshi Kani
    Signed-off-by: Borislav Petkov
    Acked-by: Dave Young
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dan Williams
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Hanjun Guo
    Cc: Jakub Sitnicki
    Cc: Jiang Liu
    Cc: Linus Torvalds
    Cc: Luis R. Rodriguez
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Toshi Kani
    Cc: Vinod Koul
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mm
    Link: http://lkml.kernel.org/r/1453841853-11383-17-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Toshi Kani
     
  • Add a new interface, walk_iomem_res_desc(), which walks through
    the iomem table by identifying a target with @flags and @desc.
    This interface provides the same functionality as
    walk_iomem_res(), but does not use strcmp() to @name for better
    efficiency.

    walk_iomem_res() is deprecated and will be removed in a later
    patch.

    Requested-by: Borislav Petkov
    Signed-off-by: Toshi Kani
    [ Fixup comments. ]
    Signed-off-by: Borislav Petkov
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dan Williams
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Hanjun Guo
    Cc: Jakub Sitnicki
    Cc: Jiang Liu
    Cc: Linus Torvalds
    Cc: Luis R. Rodriguez
    Cc: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Cc: Thomas Gleixner
    Cc: Toshi Kani
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mm
    Link: http://lkml.kernel.org/r/1453841853-11383-14-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Toshi Kani
     
  • walk_iomem_res() and region_intersects() still need to use
    strcmp() for searching a resource entry by @name in the iomem
    table.

    This patch introduces I/O resource descriptor 'desc' in struct
    resource for the iomem search interfaces. Drivers can assign
    their unique descriptor to a range when they support the search
    interfaces.

    Otherwise, 'desc' is set to IORES_DESC_NONE (0). This avoids
    changing most of the drivers as they typically allocate resource
    entries statically, or by calling alloc_resource(), kzalloc(),
    or alloc_bootmem_low(), which set the field to zero by default.
    A later patch will address some drivers that use kmalloc()
    without zero'ing the field.

    Also change release_mem_region_adjustable() to set 'desc' when
    its resource entry gets separated. Other resource interfaces are
    also changed to initialize 'desc' explicitly although
    alloc_resource() sets it to 0.

    Signed-off-by: Toshi Kani
    Signed-off-by: Borislav Petkov
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dan Williams
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Jakub Sitnicki
    Cc: Jiang Liu
    Cc: Linus Torvalds
    Cc: Luis R. Rodriguez
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Toshi Kani
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mm
    Link: http://lkml.kernel.org/r/1453841853-11383-4-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Toshi Kani
     
  • The IORESOURCE_MEM I/O resource type is used for all types of
    memory-mapped ranges, ex. System RAM, System ROM, Video RAM,
    Persistent Memory, PCI Bus, PCI MMCONFIG, ACPI Tables, IOAPIC,
    reserved, and so on.

    This requires walk_system_ram_range(), walk_system_ram_res(),
    and region_intersects() to use strcmp() against string "System
    RAM" to search for System RAM ranges in the iomem table, which
    is inefficient. __ioremap_caller() and reserve_memtype() on x86,
    for instance, call walk_system_ram_range() for every request to
    check if a given range is in System RAM ranges.

    However, adding a new I/O resource type for System RAM is not a
    viable option, see [1]. There are approx. 3800 references to
    IORESOURCE_MEM in the kernel/drivers, which makes it very
    difficult to distinguish their usages between new type and
    IORESOURCE_MEM.

    The I/O resource types are also used by the PNP subsystem.
    Therefore, introduce an extended I/O resource type,
    IORESOURCE_SYSTEM_RAM, which consists of IORESOURCE_MEM and a
    new modifier flag IORESOURCE_SYSRAM, see [2].

    To keep the code 'if (resource_type(r) == IORESOURCE_MEM)' still
    working for System RAM, resource_ext_type() is added for
    extracting extended type bits.

    Link[1]: http://lkml.kernel.org/r/1449168859.9855.54.camel@hpe.com
    Link[2]: http://lkml.kernel.org/r/CA+55aFy4WQrWexC4u2LxX9Mw2NVoznw7p3Yh=iF4Xtf7zKWnRw@mail.gmail.com

    Signed-off-by: Toshi Kani
    Signed-off-by: Borislav Petkov
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dan Williams
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Hanjun Guo
    Cc: Jakub Sitnicki
    Cc: Jiang Liu
    Cc: Linus Torvalds
    Cc: Luis R. Rodriguez
    Cc: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Cc: Thomas Gleixner
    Cc: Toshi Kani
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mm
    Link: http://lkml.kernel.org/r/1453841853-11383-2-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Toshi Kani
     

17 Oct, 2015

1 commit


16 Apr, 2015

1 commit

  • All users of __check_region(), check_region(), and check_mem_region() are
    gone. We got rid of the last user in v4.0-rc1. Remove them.

    bloat-o-meter on x86_64 shows:

    add/remove: 0/3 grow/shrink: 0/0 up/down: 0/-102 (-102)
    function old new delta
    __kstrtab___check_region 15 - -15
    __ksymtab___check_region 16 - -16
    __check_region 71 - -71

    Signed-off-by: Jakub Sitnicki
    Cc: Bjorn Helgaas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jakub Sitnicki
     

05 Sep, 2014

1 commit

  • Provide device-managed implementations of the request_resource() and
    release_resource() functions. Upon failure to request a resource, the new
    devm_request_resource() function will output an error message for
    consistent error reporting.

    Signed-off-by: Thierry Reding
    Signed-off-by: Bjorn Helgaas
    Acked-by: Tejun Heo

    Thierry Reding
     

09 Aug, 2014

1 commit

  • I have added two more functions to walk through resources.

    Currently walk_system_ram_range() deals with pfn and /proc/iomem can
    contain partial pages. By dealing in pfn, callback function loses the
    info that last page of a memory range is a partial page and not the full
    page. So I implemented walk_system_ram_res() which returns u64 values to
    callback functions and now it properly return start and end address.

    walk_system_ram_range() uses find_next_system_ram() to find the next ram
    resource. This in turn only travels through siblings of top level child
    and does not travers through all the nodes of the resoruce tree. I also
    need another function where I can walk through all the resources, for
    example figure out where "GART" aperture is. Figure out where ACPI memory
    is.

    So I wrote another function walk_iomem_res() which walks through all
    /proc/iomem resources and returns matches as asked by caller. Caller can
    specify "name" of resource, start and end and flags.

    Got rid of find_next_system_ram_res() and instead implemented more generic
    find_next_iomem_res() which can be used to traverse top level children
    only based on an argument.

    Signed-off-by: Vivek Goyal
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Michael Kerrisk
    Cc: Eric Biederman
    Cc: H. Peter Anvin
    Cc: Matthew Garrett
    Cc: Greg Kroah-Hartman
    Cc: Dave Young
    Cc: WANG Chao
    Cc: Baoquan He
    Cc: Andy Lutomirski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     

27 Feb, 2014

2 commits

  • Sometimes we have a struct resource where we know the type (MEM/IO/etc.)
    and the size, but we haven't assigned address space for it. The
    IORESOURCE_UNSET flag is a way to indicate this situation. For these
    "unset" resources, the start address is meaningless, so print only the
    size, e.g.,

    - pci 0000:0c:00.0: reg 184: [mem 0x00000000-0x00001fff 64bit]
    + pci 0000:0c:00.0: reg 184: [mem size 0x2000 64bit]

    For %pr (printing with raw flags), we still print the address range,
    because %pr is mostly used for debugging anyway.

    Thanks to Fengguang Wu for suggesting
    resource_size().

    Signed-off-by: Bjorn Helgaas

    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: Bjorn Helgaas

    Bjorn Helgaas
     

30 Apr, 2013

1 commit

  • 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: Toshi Kani
    Reviewed-by : Yasuaki Ishimatsu
    Cc: David Rientjes
    Reviewed-by: Ram Pai
    Cc: T Makphaibulchoke
    Cc: Wen Congyang
    Cc: Tang Chen
    Cc: Jiang Liu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Toshi Kani
     

11 Sep, 2012

2 commits

  • Help clarify that this is specifically for PCI/ISA I/O ports and not for
    any other similar thing.

    Signed-off-by: Mark Brown
    Acked-by: Arnd Bergmann
    Acked-by: Haojian Zhuang
    Tested-by: Haojian Zhuang
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Currently a bunch of I2C/SPI MFD drivers are using IORESOURCE_IO for
    register address ranges. Since this causes some confusion due to the
    primary use of this resource type for PCI/ISA I/O ports create a new
    resource type IORESOURCE_REG.

    Unfortunately the current resource types are specified as bitmasks and
    there are no free bitmasks even though they really shouldn't be used as
    such so we define the new type as IORESOURCE_IO | IORESOURCE_MEM.
    Benjamin Herrenschmidt and Russell King have both verified that none of
    the users in this series will have a problem with this, and no new code
    should be affected.

    This patch was written by Russell King but he found himself unable to
    take the patch further.

    Signed-off-by: Mark Brown
    Acked-by: Arnd Bergmann
    Acked-by: Haojian Zhuang
    Tested-by: Haojian Zhuang
    Signed-off-by: Samuel Ortiz

    Mark Brown
     

08 May, 2012

1 commit


15 Feb, 2012

1 commit


01 Aug, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
    m68k/math-emu: Remove unnecessary code
    m68k/math-emu: Remove commented out old code
    m68k: Kill warning in setup_arch() when compiling for Sun3
    m68k/atari: Prefix GPIO_{IN,OUT} with CODEC_
    sparc: iounmap() and *_free_coherent() - Use lookup_resource()
    m68k/atari: Reserve some ST-RAM early on for device buffer use
    m68k/amiga: Chip RAM - Use lookup_resource()
    resources: Add lookup_resource()
    sparc: _sparc_find_resource() should check for exact matches
    m68k/amiga: Chip RAM - Offset resource end by CHIP_PHYSADDR
    m68k/amiga: Chip RAM - Use resource_size() to fix off-by-one error
    m68k/amiga: Chip RAM - Change chipavail to an atomic_t
    m68k/amiga: Chip RAM - Always allocate from the start of memory
    m68k/amiga: Chip RAM - Convert from printk() to pr_*()
    m68k/amiga: Chip RAM - Use tabs for indentation

    Linus Torvalds
     

31 Jul, 2011

1 commit


26 Jul, 2011

1 commit

  • Resource definitions that just define start, end and flags =
    IORESOURCE_MEM or IORESOURCE_IRQ (with start=end) are quite common. So
    introduce a shortcut for them. For completeness add macros for
    IORESOURCE_DMA and IORESOURCE_IO, too and also make available a set of
    macros to specify named resources of all types which are less common.

    Signed-off-by: Uwe Kleine-König
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     

18 Dec, 2010

2 commits


27 Oct, 2010

1 commit

  • 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: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     

12 May, 2010

1 commit

  • 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: Giel van Schijndel
    Signed-off-by: Alan Cox
    Signed-off-by: Jesse Barnes

    Alan Cox
     

24 Mar, 2010

1 commit

  • request_resource() and insert_resource() only return success or failure,
    which no information about what existing resource conflicted with the
    proposed new reservation. This patch adds request_resource_conflict()
    and insert_resource_conflict(), which return the conflicting resource.

    Callers may use this for better error messages or to adjust the new
    resource and retry the request.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Jesse Barnes

    Bjorn Helgaas
     

15 Mar, 2010

3 commits


23 Feb, 2010

3 commits


16 Dec, 2009

1 commit


23 Sep, 2009

1 commit

  • 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: KAMEZAWA Hiroyuki
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: WANG Cong
    Cc: Américo Wang
    Cc: David Rientjes
    Cc: Roland Dreier
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     

12 Jun, 2009

1 commit

  • We should not assign 64bit ranges to PCI devices that only take 32bit
    prefetchable addresses.

    Try to set IORESOURCE_MEM_64 in 64bit resource of pci_device/pci_bridge
    and make the bus resource only have that bit set when all devices under
    it support 64bit prefetchable memory. Use that flag to allocate
    resources from that range.

    Reported-by: Yannick
    Reviewed-by: Ivan Kokshaysky
    Signed-off-by: Yinghai Lu
    Signed-off-by: Jesse Barnes

    Yinghai Lu
     

16 Jan, 2009

1 commit


08 Jan, 2009

1 commit

  • 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: Matthew Wilcox
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Jesse Barnes

    Arjan van de Ven