1. 18 3月, 2018 3 次提交
  2. 12 3月, 2018 2 次提交
  3. 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
  4. 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
  5. 04 3月, 2018 3 次提交
    • 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
    • F
      of: change overlay apply input data from unflattened to FDT · 39a751a4
      Frank Rowand 提交于
      Move duplicating and unflattening of an overlay flattened devicetree
      (FDT) into the overlay application code.  To accomplish this,
      of_overlay_apply() is replaced by of_overlay_fdt_apply().
      
      The copy of the FDT (aka "duplicate FDT") now belongs to devicetree
      code, which is thus responsible for freeing the duplicate FDT.  The
      caller of of_overlay_fdt_apply() remains responsible for freeing the
      original FDT.
      
      The unflattened devicetree now belongs to devicetree code, which is
      thus responsible for freeing the unflattened devicetree.
      
      These ownership changes prevent early freeing of the duplicated FDT
      or the unflattened devicetree, which could result in use after free
      errors.
      
      of_overlay_fdt_apply() is a private function for the anticipated
      overlay loader.
      
      Update unittest.c to use of_overlay_fdt_apply() instead of
      of_overlay_apply().
      
      Move overlay fragments from artificial locations in
      drivers/of/unittest-data/tests-overlay.dtsi into one devicetree
      source file per overlay.  This led to changes in
      drivers/of/unitest-data/Makefile and drivers/of/unitest.c.
      
        - Add overlay directives to the overlay devicetree source files so
          that dtc will compile them as true overlays into one FDT data
          chunk per overlay.
      
        - Set CFLAGS for drivers/of/unittest-data/testcases.dts so that
          symbols will be generated for overlay resolution of overlays
          that are no longer artificially contained in testcases.dts
      
        - Unflatten and apply each unittest overlay FDT using
          of_overlay_fdt_apply().
      
        - Enable the of_resolve_phandles() check for whether the unflattened
          overlay is detached.  This check was previously disabled because the
          overlays from tests-overlay.dtsi were not unflattened into detached
          trees.
      
        - Other changes to unittest.c infrastructure to manage multiple test
          FDTs built into the kernel image (access by name instead of
          arbitrary number).
      
        - of_unittest_overlay_high_level(): previously unused code to add
          properties from the overlay_base devicetree to the live tree
          was triggered by the restructuring of tests-overlay.dtsi and thus
          testcases.dts.  This exposed two bugs: (1) the need to dup a
          property before adding it, and (2) property 'name' is
          auto-generated in the unflatten code and thus will be a duplicate
          in the __symbols__ node - do not treat this duplicate as an error.
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      39a751a4
  6. 12 2月, 2018 3 次提交
    • S
      of: unittest: Add phandle remapping test · 357aa4b6
      Stephen Boyd 提交于
      Test the functionality of of_parse_phandle_with_args_map().
      
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: NStephen Boyd <stephen.boyd@linaro.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      357aa4b6
    • S
      of: Support parsing phandle argument lists through a nexus node · bd6f2fd5
      Stephen Boyd 提交于
      Platforms like 96boards have a standardized connector/expansion
      slot that exposes signals like GPIOs to expansion boards in an
      SoC agnostic way. We'd like the DT overlays for the expansion
      boards to be written once without knowledge of the SoC on the
      other side of the connector. This avoids the unscalable
      combinatorial explosion of a different DT overlay for each
      expansion board and SoC pair.
      
      We need a way to describe the GPIOs routed through the connector
      in an SoC agnostic way. Let's introduce nexus property parsing
      into the OF core to do this. This is largely based on the
      interrupt nexus support we already have. This allows us to remap
      a phandle list in a consumer node (e.g. reset-gpios) through a
      connector in a generic way (e.g. via gpio-map). Do this in a
      generic routine so that we can remap any sort of variable length
      phandle list.
      
      Taking GPIOs as an example, the connector would be a GPIO nexus,
      supporting the remapping of a GPIO specifier space to multiple
      GPIO providers on the SoC. DT would look as shown below, where
      'soc_gpio1' and 'soc_gpio2' are inside the SoC, 'connector' is an
      expansion port where boards can be plugged in, and
      'expansion_device' is a device on the expansion board.
      
      	soc {
      		soc_gpio1: gpio-controller1 {
      			#gpio-cells = <2>;
      		};
      
      		soc_gpio2: gpio-controller2 {
      			#gpio-cells = <2>;
      		};
      	};
      
      	connector: connector {
      		#gpio-cells = <2>;
      		gpio-map = <0 0 &soc_gpio1 1 0>,
      			   <1 0 &soc_gpio2 4 0>,
      			   <2 0 &soc_gpio1 3 0>,
      			   <3 0 &soc_gpio2 2 0>;
      		gpio-map-mask = <0xf 0x0>;
      		gpio-map-pass-thru = <0x0 0x1>
      	};
      
      	expansion_device {
      		reset-gpios = <&connector 2 GPIO_ACTIVE_LOW>;
      	};
      
      The GPIO core would use of_parse_phandle_with_args_map() instead
      of of_parse_phandle_with_args() and arrive at the same type of
      result, a phandle and argument list. The difference is that the
      phandle and arguments will be remapped through the nexus node to
      the underlying SoC GPIO controller node. In the example above,
      we would remap 'reset-gpios' from <&connector 2 GPIO_ACTIVE_LOW>
      to <&soc_gpio1 3 GPIO_ACTIVE_LOW>.
      
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: NStephen Boyd <stephen.boyd@linaro.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      bd6f2fd5
    • A
      device property: Constify device_get_match_data() · 67dcc26d
      Andy Shevchenko 提交于
      Constify device_get_match_data() as OF and ACPI variants return
      constant value.
      Acked-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      67dcc26d
  7. 23 1月, 2018 1 次提交
  8. 18 1月, 2018 1 次提交
  9. 16 1月, 2018 1 次提交
  10. 11 1月, 2018 1 次提交
  11. 09 1月, 2018 1 次提交
  12. 08 1月, 2018 2 次提交
    • R
      of/fdt: use memblock_virt_alloc for early alloc · 0fa1c579
      Rob Herring 提交于
      memblock_virt_alloc() works for both memblock and bootmem, so use it and
      make early_init_dt_alloc_memory_arch a static function. The arches using
      bootmem define early_init_dt_alloc_memory_arch as either:
      
      __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS))
      
      or:
      
      alloc_bootmem_align(size, align)
      
      Both of these evaluate to the same thing as does memblock_virt_alloc for
      bootmem. So we can disable the arch specific functions by making
      early_init_dt_alloc_memory_arch static and they can be removed in
      subsequent commits.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      0fa1c579
    • R
      of: Use SPDX license tag for DT files · af6074fc
      Rob Herring 提交于
      Convert remaining DT files to use SPDX-License-Identifier tags.
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Reviewed-by: NFrank Rowand <frank.rowand@sony.com>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      af6074fc
  13. 05 1月, 2018 1 次提交
  14. 03 1月, 2018 1 次提交
  15. 28 12月, 2017 1 次提交
  16. 14 12月, 2017 2 次提交
  17. 13 12月, 2017 3 次提交
  18. 08 12月, 2017 2 次提交
  19. 07 12月, 2017 5 次提交
  20. 21 11月, 2017 1 次提交
  21. 17 11月, 2017 2 次提交
    • R
      of: unittest: disable interrupts_property warning · c0075838
      Rob Herring 提交于
      The testcases.dts has purposely bad data which now generates a dtc warning:
      
      drivers/of/unittest-data/testcases.dtb: Warning (interrupts_property): interrupts size is (4), expected multiple of 8 in /testcase-data/testcase-device2
      
      Disable this warning for now. The proper solution is to split the unit
      tests into good and bad data.
      Signed-off-by: NRob Herring <robh@kernel.org>
      c0075838
    • R
      of: unittest: let dtc generate __local_fixups__ · f5525593
      Rob Herring 提交于
      Remove the manually added __local_fixups__ because dtc can now generate
      them. This also fixes a new warning in the process:
      
      drivers/of/unittest-data/testcases.dtb: Warning (interrupts_extended_property): Could not get phandle node for /__local_fixups__/testcase-data/interrupts/interrupts-extended0:interrupts-extended(cell 3)
      Signed-off-by: NRob Herring <robh@kernel.org>
      f5525593