13 Oct, 2018

1 commit

  • commit 8894891446c9380709451b99ab45c5c53adfd2fc upstream.

    On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the
    devicetree interrupt parsing code is different, causing unit tests of
    devicetree interrupt nodes to fail. Due to a bug in unittest code, which
    tries to dereference an uninitialized pointer, this results in a crash.

    OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property
    Unable to handle kernel paging request for data at address 0x00bc616e
    Faulting instruction address: 0xc08e9468
    Oops: Kernel access of bad area, sig: 11 [#1]
    BE PREEMPT PowerMac
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1
    task: cf8e0000 task.stack: cf8da000
    NIP: c08e9468 LR: c08ea5bc CTR: c08ea5ac
    REGS: cf8dbb50 TRAP: 0300 Not tainted (4.14.72-rc1-yocto-standard+)
    MSR: 00001032 CR: 82004044 XER: 00000000
    DAR: 00bc616e DSISR: 40000000
    GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002
    GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000
    GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8
    GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517

    NIP [c08e9468] device_node_gen_full_name+0x30/0x15c
    LR [c08ea5bc] device_node_string+0x190/0x3c8
    Call Trace:
    [cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable)
    [cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8
    [cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0
    [cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec
    [cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48
    [cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c
    [cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130
    [cf8dbdd0] [c008ff54] printk+0x5c/0x6c
    [cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8
    [cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184
    [cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8
    [cf8dbf30] [c0004814] kernel_init+0x24/0x118
    [cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64

    The problem was observed when running a qemu test for the g3beige machine
    with devicetree unittests enabled.

    Disable interrupt node tests on affected systems to avoid both false
    unittest failures and the crash.

    With this patch in place, unittest on the affected system passes with
    the following message.

    dt-test ### end of unittest - 144 passed, 0 failed

    Fixes: 53a42093d96ef ("of: Add device tree selftests")
    Signed-off-by: Guenter Roeck
    Reviewed-by: Frank Rowand
    Signed-off-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

03 Jul, 2018

1 commit

  • commit 3b9cf7905fe3ab35ab437b5072c883e609d3498d upstream.

    For strings, account for trailing \0 in property length field:

    This is consistent with how dtc builds string properties.

    Function __of_prop_dup() would misbehave on such properties as it duplicates
    properties based on the property length field creating new string values
    without trailing \0s.

    Signed-off-by: Stefan M Schaeckeler
    Reviewed-by: Frank Rowand
    Tested-by: Frank Rowand
    Cc:
    Signed-off-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Stefan M Schaeckeler
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

20 Jul, 2017

1 commit

  • Add nodes and properties to overlay_base and overlay dts files to
    test for
    - incorrect existing node name detection when overlay node name
    has a unit-address
    - adding overlay __symbols__ properties to live tree when an
    overlay is added to the live tree

    The following console messages will appear near the end of unittest
    until the code errors are corrected:

    OF: Duplicate name in fairway-1, renamed to "ride@100#1"

    ### dt-test ### FAIL of_unittest_overlay_high_level():2296 Adding overlay 'overlay_bad_symbol' failed

    ### dt-test ### end of unittest - 190 passed, 1 failed

    Signed-off-by: Frank Rowand
    Signed-off-by: Rob Herring

    Frank Rowand
     

19 Jul, 2017

1 commit


28 Jun, 2017

1 commit

  • 90% of the usage of device node's full_name is printing it out in a
    kernel message. However, storing the full path for every node is
    wasteful and redundant. With a custom format specifier, we can generate
    the full path at run-time and eventually remove the full path from every
    node.

    For instance typical use is:
    pr_info("Frobbing node %s\n", node->full_name);

    Which can be written now as:
    pr_info("Frobbing node %pOF\n", node);

    '%pO' is the base specifier to represent kobjects with '%pOF'
    representing struct device_node. Currently, struct device_node is the
    only supported type of kobject.

    More fine-grained control of formatting includes printing the name,
    flags, path-spec name and others, explained in the documentation entry.

    Originally written by Pantelis, but pretty much rewrote the core
    function using existing string/number functions. The 2 passes were
    unnecessary and have been removed. Also, updated the checkpatch.pl
    check. The unittest code was written by Grant Likely.

    Signed-off-by: Pantelis Antoniou
    Acked-by: Joe Perches
    Signed-off-by: Rob Herring

    Pantelis Antoniou
     

05 May, 2017

1 commit


03 May, 2017

1 commit

  • gcc warns that an empty device tree would cause undefined behavior:

    drivers/of/unittest.c: In function 'of_unittest':
    drivers/of/unittest.c:2199:25: warning: 'last_sibling' may be used uninitialized in this function [-Wmaybe-uninitialized]

    This adds an initialization of the variable to zero, which we handle
    correctly.

    Fixes: 81d0848fc8d2 ("of: Add unit tests for applying overlays")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Rob Herring

    Arnd Bergmann
     

28 Apr, 2017

1 commit


24 Jan, 2017

1 commit

  • Function signature

    of_unittest_apply_overlay(int unittest_nr, int overlay_nr, ...

    and call sites, like in of_unittest_apply_overlay_check():

    ret = of_unittest_apply_overlay(overlay_nr, unittest_nr, ...

    do not match. Fix this in one place (function signature).
    The only affected test case is 15, which supplies non-existing
    overlay number 16, but two bugs matched here. Fix the test case.

    Signed-off-by: Alexander Sverdlin
    Cc: Rob Herring
    Cc: Frank Rowand
    Cc: devicetree@vger.kernel.org
    Signed-off-by: Rob Herring

    Alexander Sverdlin
     

05 Jan, 2017

1 commit


24 Jun, 2016

1 commit


21 May, 2016

1 commit

  • Pull devicetree updates from Rob Herring:

    - Rewrite of the unflattening code to avoid recursion and lessen the
    stack usage.

    - Rewrite of the phandle args parsing code to get rid of the fixed args
    size. This is needed for IOMMU code.

    - Sync to latest dtc which adds more dts style checking. These
    warnings are enabled with "W=1" compiles.

    - Tegra documentation updates related to the above warnings.

    - A bunch of spelling and other doc fixes.

    - Various vendor prefix additions.

    * tag 'devicetree-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (52 commits)
    devicetree: Add Creative Technology vendor id
    gpio: dt-bindings: add ibm,ppc4xx-gpio binding
    of/unittest: Remove unnecessary module.h header inclusion
    drivers/of: Fix build warning in populate_node()
    drivers/of: Fix depth when unflattening devicetree
    of: dynamic: changeset prop-update revert fix
    drivers/of: Export of_detach_node()
    drivers/of: Return allocated memory from of_fdt_unflatten_tree()
    drivers/of: Specify parent node in of_fdt_unflatten_tree()
    drivers/of: Rename unflatten_dt_node()
    drivers/of: Avoid recursively calling unflatten_dt_node()
    drivers/of: Split unflatten_dt_node()
    of: include errno.h in of_graph.h
    of: document refcount incrementation of of_get_cpu_node()
    Documentation: dt: soc: fix spelling mistakes
    Documentation: dt: power: fix spelling mistake
    Documentation: dt: pinctrl: fix spelling mistake
    Documentation: dt: opp: fix spelling mistake
    Documentation: dt: net: fix spelling mistakes
    Documentation: dt: mtd: fix spelling mistake
    ...

    Linus Torvalds
     

19 May, 2016

1 commit


16 May, 2016

1 commit

  • This adds one more argument to of_fdt_unflatten_tree() to specify
    the parent node of the FDT blob that is going to be unflattened.
    In the result, the function can be used to unflatten FDT blob that
    represents device sub-tree in PowerNV PCI hotplug driver.

    Cc: Jyri Sarha
    Signed-off-by: Gavin Shan
    Acked-by: Rob Herring
    Acked-by: Jyri Sarha
    Signed-off-by: Rob Herring

    Gavin Shan
     

22 Apr, 2016

1 commit


04 Mar, 2016

1 commit

  • of_overlay_destroy() can return `-ENODEV' error code once it
    failed to find the requested overlay in `ov_idr'. However,
    of_unittest_destroy_tracked_overlays() does not handle this
    error code correctly and continues to call of_overlay_destroy()
    on the 'missing' overlay over and over again. This results in
    a printk flood

    [..]
    [ 33.497583] of_overlay_destroy: Could not find overlay #6
    [ 33.497583] of_overlay_destroy: Could not find overlay #6
    [ 33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
    [ 33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
    [ 33.497586] of_overlay_destroy: Could not find overlay #6
    [ 33.497586] of_overlay_destroy: Could not find overlay #6
    [ 33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
    [ 33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
    [..]

    which is not really good due to printk design, and can lead to soft
    lockups, hard lockups, etc. (depending on the context console_unlock()
    is being called from). The problem has bee observed in real life
    and reported by Ying Huang.

    This patch does not address the root cause of missing overlay in
    `ov_idr', it fixes the endless loop only.

    Signed-off-by: Sergey Senozhatsky
    Reported-by: kernel test robot
    Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com
    Signed-off-by: Rob Herring

    Sergey Senozhatsky
     

14 Jan, 2016

1 commit

  • The PowerNV PCI hotplug driver is going to use the OF changeset
    to manage the changed device sub-tree. This exports those OF
    changeset functions for that.

    Signed-off-by: Gavin Shan
    Acked-by: Wolfram Sang
    Tested-by: Wolfram Sang
    Signed-off-by: Rob Herring

    Gavin Shan
     

05 Jan, 2016

1 commit

  • Add a single resource to the test bus device to exercise the platform
    bus code a little more. This isn't strictly a devicetree test, but it is
    a corner case that the devicetree runs into. Until we've got platform
    device unittests, it can live here. It doesn't need to be an explicit
    text because the kernel will oops when it is wrong.

    Cc: Pantelis Antoniou
    Cc: Rob Herring
    Cc: Greg Kroah-Hartman
    Cc: Ricardo Ribalda Delgado
    Signed-off-by: Grant Likely
    [wsa: added the comment provided by Grant, rebased, and tested]
    Signed-off-by: Wolfram Sang
    Signed-off-by: Rob Herring

    Grant Likely
     

22 Oct, 2015

1 commit

  • for_each_child_of_node performs an of_node_get on each iteration, so
    a break out of the loop requires an of_node_put.

    A simplified version of the semantic patch that fixes this problem is as
    follows (http://coccinelle.lip6.fr):

    //
    @@
    expression root,e;
    local idexpression child;
    @@

    for_each_child_of_node(root, child) {
    ... when != of_node_put(child)
    when != e = child
    (
    return child;
    |
    + of_node_put(child);
    ? return ...;
    )
    ...
    }
    //

    Combine the puts into code at the end of the function, for conciseness.

    Signed-off-by: Julia Lawall
    Signed-off-by: Rob Herring

    Julia Lawall
     

27 Jul, 2015

1 commit


24 Apr, 2015

1 commit

  • Pull second batch of devicetree updates from Rob Herring:
    "As Grant mentioned in the first devicetree pull request, here is the
    2nd batch of DT changes for 4.1. The main remaining item here is the
    endianness bindings and related 8250 driver support.

    - DT endianness specification bindings

    - big-endian 8250 serial support

    - DT overlay unittest updates

    - various DT doc updates

    - compile fixes for OF_IRQ=n"

    * tag 'devicetree-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
    frv: add io{read,write}{16,32}be functions
    mn10300: add io{read,write}{16,32}be functions
    Documentation: DT bindings: add doc for Altera's SoCFPGA platform
    of: base: improve of_get_next_child() kernel-doc
    Doc: dt: arch_timer: discourage clock-frequency use
    of: unittest: overlay: Keep track of created overlays
    of/fdt: fix allocation size for device node path
    serial: of_serial: Support big-endian register accesses
    serial: 8250: Add support for big-endian MMIO accesses
    of: Document {little,big,native}-endian bindings
    of/fdt: Add endianness helper function for early init code
    of: Add helper function to check MMIO register endianness
    of/fdt: Remove "reg" data prints from early_init_dt_scan_memory
    of: add vendor prefix for Artesyn
    of: Add dummy of_irq_to_resource_table() for IRQ_OF=n
    of: OF_IRQ should depend on IRQ_DOMAIN

    Linus Torvalds
     

15 Apr, 2015

1 commit


29 Mar, 2015

7 commits


25 Mar, 2015

1 commit


19 Mar, 2015

1 commit

  • There were regressions seen with commit 106937e8ccdc ("of: fix handling
    of '/' in options for of_find_node_by_path()"), where we couldn't handle
    extra '/' before the ':'. Let's test for this now.

    Confirmed that this test fails without the previous patch and passes
    when patched. All other tests pass.

    Signed-off-by: Brian Norris
    Acked-by: Leif Lindholm
    Signed-off-by: Rob Herring

    Brian Norris
     

10 Mar, 2015

4 commits


12 Feb, 2015

1 commit


05 Feb, 2015

2 commits


23 Jan, 2015

1 commit