1. 04 9月, 2018 2 次提交
  2. 31 8月, 2018 1 次提交
  3. 29 8月, 2018 1 次提交
    • J
      of: add helper to lookup compatible child node · 36156f92
      Johan Hovold 提交于
      Add of_get_compatible_child() helper that can be used to lookup
      compatible child nodes.
      
      Several drivers currently use of_find_compatible_node() to lookup child
      nodes while failing to notice that the of_find_ functions search the
      entire tree depth-first (from a given start node) and therefore can
      match unrelated nodes. The fact that these functions also drop a
      reference to the node they start searching from (e.g. the parent node)
      is typically also overlooked, something which can lead to use-after-free
      bugs.
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      36156f92
  4. 08 8月, 2018 1 次提交
    • M
      of/fdt: Remove PPC32 longtrail hack in memory scan · da653130
      Michael Ellerman 提交于
      When the OF code was originally made common by Grant in commit
      51975db0 ("of/flattree: merge early_init_dt_scan_memory() common
      code") (Feb 2010), the common code inherited a hack to handle
      PPC "longtrail" machines, which had a "memory@0" node with no
      device_type.
      
      That check was then made to only apply to PPC32 in b44aa25d ("of:
      Handle memory@0 node on PPC32 only") (May 2014).
      
      But according to Paul Mackerras the "longtrail" machines are long
      dead, if they were ever seen in the wild at all. If someone does still
      have one, we can handle this firmware wart in powerpc platform code.
      
      So remove the hack once and for all.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NRob Herring <robh@kernel.org>
      da653130
  5. 28 7月, 2018 3 次提交
  6. 16 7月, 2018 1 次提交
  7. 14 7月, 2018 1 次提交
    • L
      of: mdio: Support fixed links in of_phy_get_and_connect() · 6eb9c9da
      Linus Walleij 提交于
      By a simple extension of of_phy_get_and_connect() drivers
      that have a fixed link on e.g. RGMII can support also
      fixed links, so in addition to:
      
      ethernet-port {
      	phy-mode = "rgmii";
      	phy-handle = <&foo>;
      };
      
      This setup with a fixed-link node and no phy-handle will
      now also work just fine:
      
      ethernet-port {
      	phy-mode = "rgmii";
      	fixed-link {
      		speed = <1000>;
      		full-duplex;
      		pause;
      	};
      };
      
      This is very helpful for connecting random ethernet ports
      to e.g. DSA switches that typically reside on fixed links.
      
      The phy-mode is still there as the fixes link in this case
      is still an RGMII link.
      
      Tested on the Cortina Gemini driver with the Vitesse DSA
      router chip on a fixed 1Gbit link.
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6eb9c9da
  8. 10 7月, 2018 1 次提交
  9. 13 6月, 2018 1 次提交
    • K
      treewide: kzalloc() -> kcalloc() · 6396bb22
      Kees Cook 提交于
      The kzalloc() function has a 2-factor argument form, kcalloc(). This
      patch replaces cases of:
      
              kzalloc(a * b, gfp)
      
      with:
              kcalloc(a * b, gfp)
      
      as well as handling cases of:
      
              kzalloc(a * b * c, gfp)
      
      with:
      
              kzalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kzalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kzalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kzalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kzalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kzalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kzalloc
      + kcalloc
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kzalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(sizeof(THING) * C2, ...)
      |
        kzalloc(sizeof(TYPE) * C2, ...)
      |
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(C1 * C2, ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6396bb22
  10. 04 6月, 2018 1 次提交
    • S
      of: platform: stop accessing invalid dev in of_platform_device_destroy · 522811e9
      Srinivas Kandagatla 提交于
      Immediately after the platform_device_unregister() the device will be
      cleaned up. Accessing the freed pointer immediately after that will
      crash the system.
      
      Found this bug when kernel is built with CONFIG_PAGE_POISONING and testing
      loading/unloading audio drivers in a loop on Qcom platforms.
      
      Fix this by moving of_node_clear_flag() just before the unregister calls.
      
      Below is the crash trace:
      
      Unable to handle kernel paging request at virtual address 6b6b6b6b6b6c03
      Mem abort info:
        ESR = 0x96000021
        Exception class = DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
      Data abort info:
        ISV = 0, ISS = 0x00000021
        CM = 0, WnR = 0
      [006b6b6b6b6b6c03] address between user and kernel address ranges
      Internal error: Oops: 96000021 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 2 PID: 1784 Comm: sh Tainted: G        W         4.17.0-rc7-02230-ge3a63a7ef641-dirty #204
      Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
      pstate: 80000005 (Nzcv daif -PAN -UAO)
      pc : clear_bit+0x18/0x2c
      lr : of_platform_device_destroy+0x64/0xb8
      sp : ffff00000c9c3930
      x29: ffff00000c9c3930 x28: ffff80003d39b200
      x27: ffff000008bb1000 x26: 0000000000000040
      x25: 0000000000000124 x24: ffff80003a9a3080
      x23: 0000000000000060 x22: ffff00000939f518
      x21: ffff80003aa79e98 x20: ffff80003aa3dae0
      x19: ffff80003aa3c890 x18: ffff800009feb794
      x17: 0000000000000000 x16: 0000000000000000
      x15: ffff800009feb790 x14: 0000000000000000
      x13: ffff80003a058778 x12: ffff80003a058728
      x11: ffff80003a058750 x10: 0000000000000000
      x9 : 0000000000000006 x8 : ffff80003a825988
      x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000001
      x5 : 0000000000000000 x4 : 0000000000000001
      x3 : 0000000000000008 x2 : 0000000000000001
      x1 : 6b6b6b6b6b6b6c03 x0 : 0000000000000000
      Process sh (pid: 1784, stack limit = 0x        (ptrval))
      Call trace:
       clear_bit+0x18/0x2c
       q6afe_remove+0x20/0x38
       apr_device_remove+0x30/0x70
       device_release_driver_internal+0x170/0x208
       device_release_driver+0x14/0x20
       bus_remove_device+0xcc/0x150
       device_del+0x10c/0x310
       device_unregister+0x1c/0x70
       apr_remove_device+0xc/0x18
       device_for_each_child+0x50/0x80
       apr_remove+0x18/0x20
       rpmsg_dev_remove+0x38/0x68
       device_release_driver_internal+0x170/0x208
       device_release_driver+0x14/0x20
       bus_remove_device+0xcc/0x150
       device_del+0x10c/0x310
       device_unregister+0x1c/0x70
       qcom_smd_remove_device+0xc/0x18
       device_for_each_child+0x50/0x80
       qcom_smd_unregister_edge+0x3c/0x70
       smd_subdev_remove+0x18/0x28
       rproc_stop+0x48/0xd8
       rproc_shutdown+0x60/0xe8
       state_store+0xbc/0xf8
       dev_attr_store+0x18/0x28
       sysfs_kf_write+0x3c/0x50
       kernfs_fop_write+0x118/0x1e0
       __vfs_write+0x18/0x110
       vfs_write+0xa4/0x1a8
       ksys_write+0x48/0xb0
       sys_write+0xc/0x18
       el0_svc_naked+0x30/0x34
      Code: d2800022 8b400c21 f9800031 9ac32043 (c85f7c22)
      ---[ end trace 32020935775616a2 ]---
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      522811e9
  11. 26 5月, 2018 1 次提交
  12. 24 5月, 2018 1 次提交
  13. 23 5月, 2018 1 次提交
  14. 17 5月, 2018 1 次提交
  15. 03 5月, 2018 1 次提交
  16. 27 4月, 2018 1 次提交
  17. 24 4月, 2018 1 次提交
  18. 23 4月, 2018 1 次提交
    • D
      earlycon: Use a pointer table to fix __earlycon_table stride · dd709e72
      Daniel Kurtz 提交于
      Commit 99492c39 ("earlycon: Fix __earlycon_table stride") tried to fix
      __earlycon_table stride by forcing the earlycon_id struct alignment to 32
      and asking the linker to 32-byte align the __earlycon_table symbol.  This
      fix was based on commit 07fca0e5 ("tracing: Properly align linker
      defined symbols") which tried a similar fix for the tracing subsystem.
      
      However, this fix doesn't quite work because there is no guarantee that
      gcc will place structures packed into an array format.  In fact, gcc 4.9
      chooses to 64-byte align these structs by inserting additional padding
      between the entries because it has no clue that they are supposed to be in
      an array.  If we are unlucky, the linker will assign symbol
      "__earlycon_table" to a 32-byte aligned address which does not correspond
      to the 64-byte aligned contents of section "__earlycon_table".
      
      To address this same problem, the fix to the tracing system was
      subsequently re-implemented using a more robust table of pointers approach
      by commits:
       3d56e331 ("tracing: Replace syscall_meta_data struct array with pointer array")
       65498646 ("tracepoints: Fix section alignment using pointer array")
       e4a9ea5e ("tracing: Replace trace_event struct array with pointer array")
      
      Let's use this same "array of pointers to structs" approach for
      EARLYCON_TABLE.
      
      Fixes: 99492c39 ("earlycon: Fix __earlycon_table stride")
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Suggested-by: NAaron Durbin <adurbin@chromium.org>
      Reviewed-by: NRob Herring <robh@kernel.org>
      Tested-by: NGuenter Roeck <groeck@chromium.org>
      Reviewed-by: NGuenter Roeck <groeck@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd709e72
  19. 18 4月, 2018 1 次提交
    • R
      of/numa: drop export of of_node_to_nid · 9cf7c9cb
      Rob Herring 提交于
      The "generic" implementation of of_node_to_nid is only used by
      arm64 and only in built-in code, so remove its export. Any
      device with a struct device should be able to use dev_to_node()
      instead. Also, exporting of_node_to_nid doesn't actually work if
      we build a module on an arch that doesn't select OF_NUMA nor provide its
      own of_node_to_nid implementation.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      9cf7c9cb
  20. 12 4月, 2018 1 次提交
    • A
      proc: add seq_put_decimal_ull_width to speed up /proc/pid/smaps · d1be35cb
      Andrei Vagin 提交于
      seq_put_decimal_ull_w(m, str, val, width) prints a decimal number with a
      specified minimal field width.
      
      It is equivalent of seq_printf(m, "%s%*d", str, width, val), but it
      works much faster.
      
      == test_smaps.py
        num = 0
        with open("/proc/1/smaps") as f:
                for x in xrange(10000):
                        data = f.read()
                        f.seek(0, 0)
      ==
      
      == Before patch ==
        $ time python test_smaps.py
        real    0m4.593s
        user    0m0.398s
        sys     0m4.158s
      
      == After patch ==
        $ time python test_smaps.py
        real    0m3.828s
        user    0m0.413s
        sys     0m3.408s
      
      $ perf -g record python test_smaps.py
      == Before patch ==
      -   79.01%     3.36%  python   [kernel.kallsyms]    [k] show_smap.isra.33
         - 75.65% show_smap.isra.33
            + 48.85% seq_printf
            + 15.75% __walk_page_range
            + 9.70% show_map_vma.isra.23
              0.61% seq_puts
      
      == After patch ==
      -   75.51%     4.62%  python   [kernel.kallsyms]    [k] show_smap.isra.33
         - 70.88% show_smap.isra.33
            + 24.82% seq_put_decimal_ull_w
            + 19.78% __walk_page_range
            + 12.74% seq_printf
            + 11.08% show_map_vma.isra.23
            + 1.68% seq_puts
      
      [akpm@linux-foundation.org: fix drivers/of/unittest.c build]
      Link: http://lkml.kernel.org/r/20180212074931.7227-1-avagin@openvz.orgSigned-off-by: NAndrei Vagin <avagin@openvz.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d1be35cb
  21. 07 4月, 2018 2 次提交
    • M
      kbuild: mark $(targets) as .SECONDARY and remove .PRECIOUS markers · 54a702f7
      Masahiro Yamada 提交于
      GNU Make automatically deletes intermediate files that are updated
      in a chain of pattern rules.
      
      Example 1) %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
      Example 2) %.o <- %.c <- %.c_shipped
      
      A couple of makefiles mark such targets as .PRECIOUS to prevent Make
      from deleting them, but the correct way is to use .SECONDARY.
      
        .SECONDARY
          Prerequisites of this special target are treated as intermediate
          files but are never automatically deleted.
      
        .PRECIOUS
          When make is interrupted during execution, it may delete the target
          file it is updating if the file was modified since make started.
          If you mark the file as precious, make will never delete the file
          if interrupted.
      
      Both can avoid deletion of intermediate files, but the difference is
      the behavior when Make is interrupted; .SECONDARY deletes the target,
      but .PRECIOUS does not.
      
      The use of .PRECIOUS is relatively rare since we do not want to keep
      partially constructed (possibly corrupted) targets.
      
      Another difference is that .PRECIOUS works with pattern rules whereas
      .SECONDARY does not.
      
        .PRECIOUS: $(obj)/%.lex.c
      
      works, but
      
        .SECONDARY: $(obj)/%.lex.c
      
      has no effect.  However, for the reason above, I do not want to use
      .PRECIOUS which could cause obscure build breakage.
      
      The targets specified as .SECONDARY must be explicit.  $(targets)
      contains all targets that need to include .*.cmd files.  So, the
      intermediates you want to keep are mostly in there.  Therefore, mark
      $(targets) as .SECONDARY.  It means primary targets are also marked
      as .SECONDARY, but I do not see any drawback for this.
      
      I replaced some .SECONDARY / .PRECIOUS markers with 'targets'.  This
      will make Kbuild search for non-existing .*.cmd files, but this is
      not a noticeable performance issue.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NFrank Rowand <frowand.list@gmail.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      54a702f7
    • M
      kbuild: add %.dtb.S and %.dtb to 'targets' automatically · a7f92419
      Masahiro Yamada 提交于
      Another common pattern that consists of chained commands is to compile
      a DTB as binary data into the kernel image or a module.  It is used in
      several places in the source tree.  Support it in the core Makefile.
      
      $(call if_changed,dt_S_dtb) is more suitable than $(call cmd,dt_S_dtb)
      in case cmd_dt_S_dtb is changed in the future.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NFrank Rowand <frowand.list@gmail.com>
      a7f92419
  22. 04 4月, 2018 2 次提交
  23. 30 3月, 2018 1 次提交
  24. 20 3月, 2018 1 次提交
  25. 18 3月, 2018 3 次提交
  26. 12 3月, 2018 2 次提交
  27. 08 3月, 2018 2 次提交
    • D
      of: unittest: fix an error test in of_unittest_overlay_8() · bdb7013d
      Dan Carpenter 提交于
      We changed this from of_overlay_apply() to overlay_data_apply().  The
      overlay_data_apply() function returns 1 on success and 0 on error so
      the check for less than zero needs to be updated.
      
      Fixes: 39a751a4 ("of: change overlay apply input data from unflattened to FDT")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NFrank Rowand <frowand.list@gmail.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      bdb7013d
    • F
      of: cache phandle nodes to reduce cost of of_find_node_by_phandle() · 0b3ce78e
      Frank Rowand 提交于
      Create a cache of the nodes that contain a phandle property.  Use this
      cache to find the node for a given phandle value instead of scanning
      the devicetree to find the node.  If the phandle value is not found
      in the cache, of_find_node_by_phandle() will fall back to the tree
      scan algorithm.
      
      The cache is initialized in of_core_init().
      
      The cache is freed via a late_initcall_sync() if modules are not
      enabled.
      
      If the devicetree is created by the dtc compiler, with all phandle
      property values auto generated, then the size required by the cache
      could be 4 * (1 + number of phandles) bytes.  This results in an O(1)
      node lookup cost for a given phandle value.  Due to a concern that the
      phandle property values might not be consistent with what is generated
      by the dtc compiler, a mask has been added to the cache lookup algorithm.
      To maintain the O(1) node lookup cost, the size of the cache has been
      increased by rounding the number of entries up to the next power of
      two.
      
      The overhead of finding the devicetree node containing a given phandle
      value has been noted by several people in the recent past, in some cases
      with a patch to add a hashed index of devicetree nodes, based on the
      phandle value of the node.  One concern with this approach is the extra
      space added to each node.  This patch takes advantage of the phandle
      property values auto generated by the dtc compiler, which begin with
      one and monotonically increase by one, resulting in a range of 1..n
      for n phandle values.  This implementation should also provide a good
      reduction of overhead for any range of phandle values that are mostly
      in a monotonic range.
      
      Performance measurements by Chintan Pandya <cpandya@codeaurora.org>
      of several implementations of patches that are similar to this one
      suggest an expected reduction of boot time by ~400ms for his test
      system.  If the cache size was decreased to 64 entries, the boot
      time was reduced by ~340 ms.  The measurements were on a 4.9.73 kernel
      for arch/arm64/boot/dts/qcom/sda670-mtp.dts, contains 2371 nodes and
      814 phandle values.
      Reported-by: NChintan Pandya <cpandya@codeaurora.org>
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      0b3ce78e
  28. 06 3月, 2018 2 次提交
    • F
      of: overlay: do not include path in full_name of added nodes · b89dae18
      Frank Rowand 提交于
      Struct device_node full_name no longer includes the full path name
      when the devicetree is created from a flattened device tree (FDT).
      The overlay node creation code was not modified to reflect this
      change.  Fix the node full_name generated by overlay code to contain
      only the basename.
      
      Unittests call an overlay internal function to create new nodes.
      Fix up these calls to provide basename only instead of the full
      path.
      
      Fixes: a7e4cfb0 ("of/fdt: only store the device node basename
      in full_name")
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      b89dae18
    • F
      of: unittest: clean up changeset test · a4f91f0d
      Frank Rowand 提交于
      In preparation for fixing __of_node_dup(), clean up the unittest
      function that calls it.
      
      Devicetree nodes created from a flattened device tree have a name
      property.  Follow this convention for nodes added by a changeset.
      
      For node added by changeset, remove incorrect initialization of
      child node pointer.
      
      Add an additional node pointer 'changeset' to more naturally reflect
      where in the tree the changeset is added.
      
      Make changeset add property error messages unique.
      
      Add whitespace to break apart logic blocks.
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      a4f91f0d
  29. 04 3月, 2018 2 次提交
    • F
      of: improve reporting invalid overlay target path · e547c003
      Frank Rowand 提交于
      Errors while developing the patch to create of_overlay_fdt_apply()
      exposed inadequate error messages to debug problems when overlay
      devicetree fragment nodes contain an invalid target path.  Improve
      the messages in find_target_node() to remedy this.
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      e547c003
    • F
      of: convert unittest overlay devicetree source to sugar syntax · db2f3762
      Frank Rowand 提交于
      The unittest-data overlays have been pulled into proper overlay
      devicetree source files without changing their format.  The
      next step is to convert them to use sugar syntax instead of
      hand coding overlay fragments structure.
      
      A few of the overlays can not be converted because they test
      absolute target paths in the overlay fragment.  dtc does not
      generate this type of target:
        overlay_0.dts
        overlay_1.dts
        overlay_12.dts
        overlay_13.dts
      
      Two pre-existing unittest overlay devicetree source files are
      also converted:
        overlay_bad_phandle.dts
        overlay_bad_symbol.dts
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      db2f3762