07 Dec, 2013

4 commits


14 Nov, 2013

1 commit

  • Pull DMA mask updates from Russell King:
    "This series cleans up the handling of DMA masks in a lot of drivers,
    fixing some bugs as we go.

    Some of the more serious errors include:
    - drivers which only set their coherent DMA mask if the attempt to
    set the streaming mask fails.
    - drivers which test for a NULL dma mask pointer, and then set the
    dma mask pointer to a location in their module .data section -
    which will cause problems if the module is reloaded.

    To counter these, I have introduced two helper functions:
    - dma_set_mask_and_coherent() takes care of setting both the
    streaming and coherent masks at the same time, with the correct
    error handling as specified by the API.
    - dma_coerce_mask_and_coherent() which resolves the problem of
    drivers forcefully setting DMA masks. This is more a marker for
    future work to further clean these locations up - the code which
    creates the devices really should be initialising these, but to fix
    that in one go along with this change could potentially be very
    disruptive.

    The last thing this series does is prise away some of Linux's addition
    to "DMA addresses are physical addresses and RAM always starts at
    zero". We have ARM LPAE systems where all system memory is above 4GB
    physical, hence having DMA masks interpreted by (eg) the block layers
    as describing physical addresses in the range 0..DMAMASK fails on
    these platforms. Santosh Shilimkar addresses this in this series; the
    patches were copied to the appropriate people multiple times but were
    ignored.

    Fixing this also gets rid of some ARM weirdness in the setup of the
    max*pfn variables, and brings ARM into line with every other Linux
    architecture as far as those go"

    * 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits)
    ARM: 7805/1: mm: change max*pfn to include the physical offset of memory
    ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations
    ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations
    ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function
    ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit()
    ARM: DMA-API: better handing of DMA masks for coherent allocations
    ARM: 7857/1: dma: imx-sdma: setup dma mask
    DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks
    DMA-API: dcdbas: update DMA mask handing
    DMA-API: dma: edma.c: no need to explicitly initialize DMA masks
    DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks
    DMA-API: crypto: remove last references to 'static struct device *dev'
    DMA-API: crypto: fix ixp4xx crypto platform device support
    DMA-API: others: use dma_set_coherent_mask()
    DMA-API: staging: use dma_set_coherent_mask()
    DMA-API: usb: use new dma_coerce_mask_and_coherent()
    DMA-API: usb: use dma_set_coherent_mask()
    DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent()
    DMA-API: net: octeon: use dma_coerce_mask_and_coherent()
    DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent()
    ...

    Linus Torvalds
     

12 Nov, 2013

2 commits

  • Pull devicetree updates from Rob Herring:
    "DeviceTree updates for 3.13. This is a bit larger pull request than
    usual for this cycle with lots of clean-up.

    - Cross arch clean-up and consolidation of early DT scanning code.
    - Clean-up and removal of arch prom.h headers. Makes arch specific
    prom.h optional on all but Sparc.
    - Addition of interrupts-extended property for devices connected to
    multiple interrupt controllers.
    - Refactoring of DT interrupt parsing code in preparation for
    deferred probe of interrupts.
    - ARM cpu and cpu topology bindings documentation.
    - Various DT vendor binding documentation updates"

    * tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (82 commits)
    powerpc: add missing explicit OF includes for ppc
    dt/irq: add empty of_irq_count for !OF_IRQ
    dt: disable self-tests for !OF_IRQ
    of: irq: Fix interrupt-map entry matching
    MIPS: Netlogic: replace early_init_devtree() call
    of: Add Panasonic Corporation vendor prefix
    of: Add Chunghwa Picture Tubes Ltd. vendor prefix
    of: Add AU Optronics Corporation vendor prefix
    of/irq: Fix potential buffer overflow
    of/irq: Fix bug in interrupt parsing refactor.
    of: set dma_mask to point to coherent_dma_mask
    of: add vendor prefix for PHYTEC Messtechnik GmbH
    DT: sort vendor-prefixes.txt
    of: Add vendor prefix for Cadence
    of: Add empty for_each_available_child_of_node() macro definition
    arm/versatile: Fix versatile irq specifications.
    of/irq: create interrupts-extended property
    microblaze/pci: Drop PowerPC-ism from irq parsing
    of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code.
    of/irq: Use irq_of_parse_and_map()
    ...

    Linus Torvalds
     
  • Pull powerpc updates from Benjamin Herrenschmidt:
    "The bulk of this is LE updates. One should now be able to build an LE
    kernel and even run some things in it.

    I'm still sitting on a handful of patches to enable the new ABI that I
    *might* still send this merge window around, but due to the
    incertainty (they are pretty fresh) I want to keep them separate.

    Other notable changes are some infrastructure bits to better handle
    PCI pass-through under KVM, some bits and pieces added to the new
    PowerNV platform support such as access to the CPU SCOM bus via sysfs,
    and support for EEH error handling on PHB3 (Power8 PCIe).

    We also grew arch_get_random_long() for both pseries and powernv when
    running on P7+ and P8, exploiting the HW rng.

    And finally various embedded updates from freescale"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (154 commits)
    powerpc: Fix fatal SLB miss when restoring PPR
    powerpc/powernv: Reserve the correct PE number
    powerpc/powernv: Add PE to its own PELTV
    powerpc/powernv: Add support for indirect XSCOM via debugfs
    powerpc/scom: Improve debugfs interface
    powerpc/scom: Enable 64-bit addresses
    powerpc/boot: Properly handle the base "of" boot wrapper
    powerpc/bpf: Support MOD operation
    powerpc/bpf: Fix DIVWU instruction opcode
    of: Move definition of of_find_next_cache_node into common code.
    powerpc: Remove big endianness assumption in of_find_next_cache_node
    powerpc/tm: Remove interrupt disable in __switch_to()
    powerpc: word-at-a-time optimization for 64-bit Little Endian
    powerpc/bpf: BPF JIT compiler for 64-bit Little Endian
    powerpc: Only save/restore SDR1 if in hypervisor mode
    powerpc/pmu: Fix ADB_PMU_LED_IDE dependencies
    powerpc/nvram: Fix endian issue when using the partition length
    powerpc/nvram: Fix endian issue when reading the NVRAM size
    powerpc/nvram: Scan partitions only once
    powerpc/mpc512x: remove unnecessary #if
    ...

    Linus Torvalds
     

09 Nov, 2013

1 commit

  • Fix OF selftest compile on sparc which does not enable OF_IRQ.

    drivers/of/selftest.c:177: undefined reference to `of_irq_parse_one'
    drivers/of/selftest.c:197: undefined reference to `of_irq_parse_one'
    drivers/of/selftest.c:248: undefined reference to `of_irq_parse_one'

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely

    Rob Herring
     

08 Nov, 2013

2 commits


04 Nov, 2013

3 commits

  • Commit 2361613206e6, "of/irq: Refactor interrupt-map parsing" introduced
    a potential buffer overflow bug because it doesn't do sufficient range
    checking on the input data. This patch adds the appropriate checking and
    buffer size adjustments. If the bounds are out of range then warn
    loudly. MAX_PHANDLE_ARGS should be sufficient. If it is not then the
    value can be increased.

    Signed-off-by: Grant Likely
    Cc: Rob Herring

    Grant Likely
     
  • Commit 2361613206e6, "of/irq: Refactor interrupt-map parsing" introduced
    a bug. The irq parsing will fail for some nodes that don't have a reg
    property. It is fixed by deferring the check for reg until it is
    actually needed. Also adjust the testcase data to catch the bug.

    Signed-off-by: Grant Likely
    Tested-by: Stephen Warren
    Tested-by: Ming Lei
    Tested-by: Stephen Warren
    Cc: Rob Herring

    Grant Likely
     
  • Platform devices created by DT code don't initialize dma_mask pointer to
    anything. Set it to coherent_dma_mask by default if the architecture
    code has not set it.

    Signed-off-by: Rob Herring

    Rob Herring
     

31 Oct, 2013

2 commits


29 Oct, 2013

1 commit

  • The standard interrupts property in device tree can only handle
    interrupts coming from a single interrupt parent. If a device is wired
    to multiple interrupt controllers, then it needs to be attached to a
    node with an interrupt-map property to demux the interrupt specifiers
    which is confusing. It would be a lot easier if there was a form of the
    interrupts property that allows for a separate interrupt phandle for
    each interrupt specifier.

    This patch does exactly that by creating a new interrupts-extended
    property which reuses the phandle+arguments pattern used by GPIOs and
    other core bindings.

    Signed-off-by: Grant Likely
    Acked-by: Tony Lindgren
    Acked-by: Kumar Gala
    [grant.likely: removed versatile platform hunks into separate patch]
    Cc: Rob Herring

    Grant Likely
     

24 Oct, 2013

8 commits

  • Several architectures open code effectively the same code block for
    finding and mapping PCI irqs. This patch consolidates it down to a
    single function.

    Signed-off-by: Grant Likely
    Acked-by: Michal Simek
    Cc: Russell King
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt

    Grant Likely
     
  • The of_irq_to_resource() helper that is used to implement of_irq_count()
    tries to resolve interrupts and in fact creates a mapping for resolved
    interrupts. That's pretty heavy lifting for something that claims to
    just return the number of interrupts requested by a given device node.

    Instead, use the more lightweight of_irq_map_one(), which, despite the
    name, doesn't create an actual mapping. Perhaps a better name would be
    of_irq_translate_one().

    Signed-off-by: Thierry Reding
    Acked-by: Rob Herring
    [grant.likely: fixup s/of_irq_map_one/of_irq_parse_one/]
    Signed-off-by: Grant Likely

    Thierry Reding
     
  • This patch extends the DT selftest code with some test cases for the
    interrupt parsing functions.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • It is sometimes useful for debug to get the contents of an
    of_phandle_args structure out into the kernel log.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • All the users of of_irq_parse_raw pass in a raw interrupt specifier from
    the device tree and expect it to be returned (possibly modified) in an
    of_phandle_args structure. However, the primary function of
    of_irq_parse_raw() is to check for translations due to the presence of
    one or more interrupt-map properties. The actual placing of the data
    into an of_phandle_args structure is trivial. If it is refactored to
    accept an of_phandle_args structure directly, then it becomes possible
    to consume of_phandle_args from other sources. This is important for an
    upcoming patch that allows a device to be connected to more than one
    interrupt parent. It also simplifies the code a bit.

    The biggest complication with this patch is that the old version works
    on the interrupt specifiers in __be32 form, but the of_phandle_args
    structure is intended to carry it in the cpu-native version. A bit of
    churn was required to make this work. In the end it results in tighter
    code, so the churn is worth it.

    Signed-off-by: Grant Likely
    Acked-by: Tony Lindgren
    Cc: Benjamin Herrenschmidt

    Grant Likely
     
  • All the callers of irq_create_of_mapping() pass the contents of a struct
    of_phandle_args structure to the function. Since all the callers already
    have an of_phandle_args pointer, why not pass it directly to
    irq_create_of_mapping()?

    Signed-off-by: Grant Likely
    Acked-by: Michal Simek
    Acked-by: Tony Lindgren
    Cc: Thomas Gleixner
    Cc: Russell King
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt

    Grant Likely
     
  • struct of_irq and struct of_phandle_args are exactly the same structure.
    This patch makes the kernel use of_phandle_args everywhere. This in
    itself isn't a big deal, but it makes some follow-on patches simpler.

    Signed-off-by: Grant Likely
    Acked-by: Michal Simek
    Acked-by: Tony Lindgren
    Cc: Russell King
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt

    Grant Likely
     
  • The OF irq handling code has been overloading the term 'map' to refer to
    both parsing the data in the device tree and mapping it to the internal
    linux irq system. This is probably because the device tree does have the
    concept of an 'interrupt-map' function for translating interrupt
    references from one node to another, but 'map' is still confusing when
    the primary purpose of some of the functions are to parse the DT data.

    This patch renames all the of_irq_map_* functions to of_irq_parse_*
    which makes it clear that there is a difference between the parsing
    phase and the mapping phase. Kernel code can make use of just the
    parsing or just the mapping support as needed by the subsystem.

    The patch was generated mechanically with a handful of sed commands.

    Signed-off-by: Grant Likely
    Acked-by: Michal Simek
    Acked-by: Tony Lindgren
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt

    Grant Likely
     

16 Oct, 2013

4 commits

  • Some drivers might rely on availability of trigger flags in IRQ
    resource, for example to configure the hardware for particular interrupt
    type. However current code creating IRQ resources from data in device
    tree does not configure trigger flags in resulting resources.

    This patch tries to solve the problem, based on the fact that
    irq_of_parse_and_map() configures the trigger based on DT interrupt
    specifier and IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
    and we can get correct trigger flags by calling irqd_get_trigger_type()
    after mapping the interrupt.

    Signed-off-by: Tomasz Figa
    [grant.likely: Merged the two assignments to r->flags]
    Signed-off-by: Grant Likely

    Tomasz Figa
     
  • Several locations in the of_address and of_irq code dereference the
    full_name parameter from a device_node pointer without checking if the
    pointer is valid. This patch switches to use of_node_full_name() which
    always checks the pointer.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • The size of each hwid in a cpu nodes 'reg' property is defined by the
    parents #address-cells property in the normal way. The cpu parsing code
    has a bug where it will overrun the end of the property if
    address-cells is greater than one. This commit fixes the problem by
    adjusting the array size by the number of address cells. It also makes
    sure address-cells isn't zero for that would cause an infinite loop.

    v2: bail if #address-cells is zero instead of forcing to
    OF_ROOT_NODE_ADDR_CELLS_DEFAULT. Forcing it will cause the reg
    property to be parsed incorrectly.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt

    Grant Likely
     
  • Use for_each_node_by_type() to iterate all cpu nodes in the
    system.

    Provide and overridable function arch_find_n_match_cpu_physical_id,
    which sees if the given device node matches 'cpu' and if so sets
    '*thread' when non-NULL to the cpu thread number within the core.

    The default implementation behaves the same as the existing code.

    Add a sparc64 implementation.

    Signed-off-by: David S. Miller
    Tested-by: Sudeep KarkadaNagesha
    Signed-off-by: Grant Likely

    David Miller
     

15 Oct, 2013

1 commit


14 Oct, 2013

2 commits

  • This reverts commit 109b6236294b53d8eaa50be7d9e9ad37079f5f7e.

    Tim Bird expressed concern that this will have a bad effect on boot
    time, and while simple tests have shown it to be okay with simple tree,
    a device tree blob can potentially be quite large and
    add_device_randomness() is not a fast function. Rather than do this for
    all platforms unconditionally, I'm reverting this patch and would like
    to see it revisited. Instead of feeding the entire tree into the random
    pool, it would probably be appropriate to hash the tree and feed the
    hash result into the pool. There really isn't a lot of randomness in a
    device tree anyway. In the majority of cases only a handful of
    properties are going to be different between machines with the same
    baseboard.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • Not all DT platforms have all the cpus collected under a /cpus node.
    That just happens to be a details of FDT, ePAPR and PowerPC platforms.
    Sparc does something different, but unfortunately the current code
    complains with a warning if /cpus isn't there. This became a problem
    with commit f86e4718, "driver/core cpu: initialize of_node in cpu's
    device structure", which caused the function to get called for all
    architectures.

    This commit is a temporary fix to fail silently if the cpus node isn't
    present. A proper fix will come later to allow arch code to provide a
    custom mechanism for decoding the CPU hwid if the 'reg' property isn't
    appropriate.

    Signed-off-by: Grant Likely
    Cc: David Miller
    Cc: Sudeep KarkadaNagesha
    Cc: Rob Herring

    Grant Likely
     

10 Oct, 2013

8 commits

  • Implement of_node_to_nid as weak function to remove the dependency on
    asm/prom.h. This is in preparation to make prom.h optional.

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely

    Rob Herring
     
  • Implement pci_address_to_pio as weak function to remove the dependency on
    asm/prom.h. This is in preparation to make prom.h optional.

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely
    Cc: Michal Simek
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: x86@kernel.org
    Cc: Grant Likely

    Rob Herring
     
  • Remove unnecessary prom.h includes in preparation to make prom.h optional.

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely

    Rob Herring
     
  • Introduce common of_flat_dt_match_machine and
    of_flat_dt_get_machine_name functions to unify architectures' handling
    of machine level model and compatible properties.

    Several architectures match the root compatible string with an arch
    specific list of machine descriptors duplicating the same search
    algorithm. Create a common implementation with a simple architecture
    specific hook to iterate over each machine's match table.

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely

    Rob Herring
     
  • All arches do essentially the same thing now for
    early_init_dt_setup_initrd_arch, so it can now be removed.

    Signed-off-by: Rob Herring
    Acked-by: Vineet Gupta
    Cc: Russell King
    Cc: Mark Salter
    Cc: Aurelien Jacquiot
    Cc: James Hogan
    Cc: Michal Simek
    Cc: Ralf Baechle
    Cc: Jonas Bonn
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: x86@kernel.org
    Cc: Chris Zankel
    Cc: Max Filippov
    Acked-by: Grant Likely

    Rob Herring
     
  • Create a weak version of early_init_dt_add_memory_arch which uses
    memblock. This will unify all architectures except ones with custom
    memory bank structs.

    Signed-off-by: Rob Herring
    Acked-by: Catalin Marinas
    Cc: Will Deacon
    Cc: Michal Simek
    Cc: Jonas Bonn
    Acked-by: Grant Likely
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: microblaze-uclinux@itee.uq.edu.au
    Cc: linux@lists.openrisc.net
    Cc: devicetree@vger.kernel.org

    Rob Herring
     
  • Most architectures scan the all the same items early in the FDT and none
    are really architecture specific. Create a common early_init_dt_scan to
    unify the early scan of root, memory, and chosen nodes in the flattened
    DT.

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely

    Rob Herring
     
  • Several architectures using DT support built-in dtb's in the init
    section. These platforms need to copy the dtb from init since the
    strings are referenced after unflattening. Every arch has their own
    copying routine which do the same thing. Create a common function,
    unflatten_and_copy_device_tree, to copy the dtb when unflattening the
    dtb.

    Signed-off-by: Rob Herring
    Acked-by: Grant Likely

    Rob Herring
     

12 Sep, 2013

1 commit

  • Pull DMA-mapping fix from Marek Szyprowski:
    "A build bugfix for the device tree support for reserved memory
    regions. Due to superfluous include the common code failed to build
    on ARM64 and MIPS architectures.

    The patch that caused the build break has lived at linux-next for
    about two weeks and noone noticed the issue, what convinced me that
    everything was ok"

    * 'for-v3.12-fix' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping:
    drivers: of: fix build break if asm/dma-contiguous.h is missing

    Linus Torvalds