1. 16 5月, 2016 2 次提交
    • G
      drivers/of: Avoid recursively calling unflatten_dt_node() · 50800082
      Gavin Shan 提交于
      In current implementation, unflatten_dt_node() is called recursively
      to unflatten device nodes in FDT blob. It's stress to limited stack
      capacity, especially to adopt the function to unflatten device sub-tree
      that possibly has multiple root nodes. In that case, we runs out of
      stack and the system can't boot up successfully.
      
      In order to reuse the function to unflatten device sub-tree, this avoids
      calling the function recursively, meaning the device nodes are unflattened
      in one call on unflatten_dt_node(): two arrays are introduced to track the
      parent path size and the device node of current level of depth, which will
      be used by the device node on next level of depth to be unflattened. All
      device nodes in more than 64 level of depth are dropped and hopefully,
      the system can boot up successfully with the partial device-tree.
      
      Also, the parameter "poffset" and "fpsize" are unused and dropped and the
      parameter "dryrun" is figured out from "mem == NULL". Besides, the return
      value of the function is changed to indicate the size of memory consumed by
      the unflatten device tree or error code.
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      50800082
    • G
      drivers/of: Split unflatten_dt_node() · dfbd4c6e
      Gavin Shan 提交于
      The function unflatten_dt_node() is called recursively to unflatten
      device nodes and properties in the FDT blob. It looks complicated
      and hard to be understood.
      
      This splits the function into 3 functions: populate_properties(),
      populate_node() and unflatten_dt_node(). populate_properties(),
      which is called by populate_node(), creates properties for the
      indicated device node. The later one creates the device nodes
      from FDT blob. populate_node() gets the offset in FDT blob for
      next device nodes and then calls populate_node(). No logical
      changes introduced.
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      dfbd4c6e
  2. 20 4月, 2016 1 次提交
  3. 19 2月, 2016 2 次提交
  4. 07 2月, 2016 6 次提交
  5. 08 12月, 2015 1 次提交
    • G
      of/fdt: Add mutex protection for calls to __unflatten_device_tree() · f8062386
      Guenter Roeck 提交于
      __unflatten_device_tree() calls unflatten_dt_node(), which declares
      a static variable. It is therefore not reentrant.
      
      One of the callers of __unflatten_device_tree(), unflatten_device_tree(),
      is only called once during early initialization and does not need to be
      protected. The other caller, of_fdt_unflatten_tree(), can be called at
      any time, possibly multiple times in parallel. This can happen, for
      example, if multiple devicetree overlays have to be loaded and installed.
      
      Without this protection, errors such as the following may be seen.
      
      kernel: End of tree marker overwritten: e6a3a458
      kernel: find_target_node:
      	Failed to find target-indirect node at /fragment@0
      kernel: __of_overlay_create: of_build_overlay_info() failed for tree@/
      
      Add a mutex to of_fdt_unflatten_tree() to make the call reentrant.
      
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: stable@vger.kernel.org # v4.1+
      Signed-off-by: NRob Herring <robh@kernel.org>
      f8062386
  6. 01 12月, 2015 1 次提交
  7. 31 10月, 2015 1 次提交
  8. 28 10月, 2015 1 次提交
  9. 14 10月, 2015 1 次提交
    • S
      of/fdt: fix aliases with baudrate in earlycon · 6296ad9e
      Stefan Agner 提交于
      Many boards use an alias in the stdout-path specification along
      with console options after a colon (e.g. serial0:115200n8). When
      using earlycon, this specification currently does not work. While
      fdt_path_offset supports alias resolution, it does not remove the
      console options by itself. Use the fdt_path_offset_namelen variant
      and provide the length of the alias to enable aliases with console
      options in the stdout-path.
      Signed-off-by: NStefan Agner <stefan@agner.ch>
      Signed-off-by: NRob Herring <robh@kernel.org>
      6296ad9e
  10. 24 8月, 2015 1 次提交
  11. 19 6月, 2015 1 次提交
    • R
      dt/fdt: add empty versions of early_init_dt_*_memory_arch · aefc7ec2
      Rob Herring 提交于
      With the addition of commit 0166dc11 (of: make CONFIG_OF user
      selectable), architectures which don't enable memblock and don't
      have their own early_init_dt_*_memory_arch implementations will break
      when CONFIG_OF is enabled.
      
      Really, we should have better separation of CONFIG_OF and
      CONFIG_OF_EARLY_FLATTREE, but doing that will require quite a bit of
      shuffling of architecture code. That will have to wait for another day.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: Grant Likely <grant.likely@linaro.org>
      aefc7ec2
  12. 04 6月, 2015 1 次提交
  13. 02 6月, 2015 1 次提交
  14. 29 5月, 2015 1 次提交
  15. 15 4月, 2015 3 次提交
  16. 05 2月, 2015 1 次提交
  17. 04 12月, 2014 1 次提交
    • G
      of: Drop ->next pointer from struct device_node · 70161ff3
      Grant Likely 提交于
      The ->next pointer in struct device_node is a hanger-on from when it was
      used to iterate over the whole tree by a particular device_type property
      value. Those days are long over, but the fdt unflattening code still
      uses it to put nodes in the unflattened tree into the same order as node
      in the flat tree. By reworking the unflattening code to reverse the list
      after unflattening all the children of a node, the pointer can be
      dropped which gives a small amount of memory savings.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NFrank Rowand <frank.rowand@sonymobile.com>
      Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
      70161ff3
  18. 26 11月, 2014 1 次提交
    • I
      of/fdt: memblock_reserve /memreserve/ regions in the case of partial overlap · 094cb981
      Ian Campbell 提交于
      memblock_is_region_reserved() returns true in the case of a partial
      overlap, meaning that the current code fails to reserve the
      non-overlapping portion.
      
      This call was introduced as part of d1552ce4 "of/fdt: move
      memreserve and dtb memory reservations into core" which went into
      v3.16.
      
      I observed this causing a Midway system with a buggy fdt (the header
      declares itself to be larger than it really is) failing to boot
      because the over-inflated size of the fdt was causing it to seem to
      run into the swapper_pg_dir region, meaning the DT wasn't reserved.
      The symptoms were failing to find an disks or network and failing to
      boot.
      
      However given the ambiguity of whether things like the initrd are
      covered by /memreserve/ and similar I think it is best to also
      register the region rather than just ignoring it.
      
      Since memblock_reserve() handles overlaps just fine lets just warn and
      carry on.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: stable@vger.kernel.org # v3.16+
      094cb981
  19. 19 11月, 2014 2 次提交
    • A
      of/fdt: export fdt blob as /sys/firmware/fdt · 08d53aa5
      Ard Biesheuvel 提交于
      Create a new /sys entry '/sys/firmware/fdt' to export the FDT blob
      that was passed to the kernel by the bootloader. This allows userland
      applications such as kexec to access the raw binary.
      
      The fact that this node does not reside under /sys/firmware/device-tree
      is deliberate: FDT is also used on arm64 UEFI/ACPI systems to
      communicate just the UEFI and ACPI entry points, but the FDT is never
      unflattened and used to configure the system.
      
      A CRC32 checksum is calculated over the entire FDT blob, and verified
      at late_initcall time. The sysfs entry is instantiated only if the
      checksum is valid, i.e., if the FDT blob has not been modified in the
      mean time. Otherwise, a warning is printed.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      08d53aa5
    • K
      of: Fix crash if an earlycon driver is not found · ab74d00a
      Kevin Cernekee 提交于
      __earlycon_of_table_sentinel.compatible is a char[128], not a pointer, so
      it will never be NULL.  Checking it against NULL causes the match loop to
      run past the end of the array, and eventually match a bogus entry, under
      the following conditions:
      
       - Kernel command line specifies "earlycon" with no parameters
       - DT has a stdout-path pointing to a UART node
       - The UART driver doesn't use OF_EARLYCON_DECLARE (or maybe the console
         driver is compiled out)
      
      Fix this by checking to see if match->compatible is a non-empty string.
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.16+
      Signed-off-by: NRob Herring <robh@kernel.org>
      ab74d00a
  20. 05 11月, 2014 2 次提交
  21. 04 11月, 2014 1 次提交
    • G
      of: Eliminate of_allnodes list · 5063e25a
      Grant Likely 提交于
      The device tree structure is composed of two lists; the 'allnodes' list
      which is a singly linked list containing every node in the tree, and the
      child->parent structure where each parent node has a singly linked list
      of children. All of the data in the allnodes list can be easily
      reproduced with the parent-child lists, so of_allnodes is actually
      unnecessary. Remove it entirely which saves a bit of memory and
      simplifies the data structure quite a lot.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
      Cc: Pantelis Antoniou <pantelis@pantelis.antoniou@konsulko.com>
      5063e25a
  22. 25 9月, 2014 1 次提交
    • S
      of/fdt: fix memory range check · 9aacd602
      Srinivas Kandagatla 提交于
      In cases where board has below memory DT node
      
      memory{
      	device_type = "memory";
      	reg = <0x80000000 0x80000000>;
      };
      
      Check on the memory range in fdt.c will always fail because it is
      comparing MAX_PHYS_ADDR with base + size, in fact it should compare
      it with base + size - 1.
      
      This issue was originally noticed on Qualcomm IFC6410 board.
      Without this patch kernel shows up noticed unnecessary warnings
      
      [    0.000000] Machine model: Qualcomm APQ8064/IFC6410
      [    0.000000] Ignoring memory range 0xffffffff - 0x100000000
      [    0.000000] cma: Reserved 64 MiB at ab800000
      
      as a result the size get reduced to 0x7fffffff which looks wrong.
      
      This patch fixes the check involved in generating this warning and
      as a result it also fixes the wrong size calculation.
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      [grant.likely: adjust new size calculation also]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      9aacd602
  23. 08 9月, 2014 1 次提交
  24. 16 8月, 2014 1 次提交
    • A
      of: Allow mem_reserve of memory with a base address of zero · b5f2a8c0
      Al Cooper 提交于
      __reserved_mem_reserve_reg() won't reserve memory if the base address
      is zero. This change removes the check for a base address of zero and
      allows it to be reserved.
      
      Allowing the first 4K of memory to be reserved will help solve a
      problem on some ARM systems where the the first 16K of memory is
      unused and becomes allocable memory. This will prevent this memory
      from being used for DMA by drivers like the USB OHCI driver which
      consider a physical address of zero to be illegal.
      
      Cc: stable@vger.kernel.org # 3.15+
      Signed-off-by: NAl Cooper <alcooperx@gmail.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      b5f2a8c0
  25. 02 8月, 2014 1 次提交
  26. 30 7月, 2014 2 次提交
  27. 27 6月, 2014 1 次提交
  28. 23 5月, 2014 1 次提交
    • L
      of: Handle memory@0 node on PPC32 only · b44aa25d
      Leif Lindholm 提交于
      In order to deal with an firmware bug on a specific ppc32 platform
      (longtrail), early_init_dt_scan_memory() looks for a node called
      memory@0 on all platforms. Restrict this quirk to ppc32 kernels only.
      Signed-off-by: NLeif Lindholm <leif.lindholm@linaro.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      b44aa25d