1. 17 10月, 2017 2 次提交
  2. 04 10月, 2017 1 次提交
    • R
      of/fdt: only store the device node basename in full_name · a7e4cfb0
      Rob Herring 提交于
      With dependencies on a statically allocated full path name converted to
      use %pOF format specifier, we can store just the basename of node, and
      the unflattening of the FDT can be simplified.
      
      This commit will affect the remaining users of full_name. After
      analyzing these users, the remaining cases should only change some print
      messages. The main users of full_name are providing a name for struct
      resource. The resource names shouldn't be important other than providing
      /proc/iomem names.
      
      We no longer distinguish between pre and post 0x10 dtb formats as either
      a full path or basename will work. However, less than 0x10 formats have
      been broken since the conversion to use libfdt (and no one has cared).
      The conversion of the unflattening code to be non-recursive also broke
      pre 0x10 formats as the populate_node function would return 0 in that
      case.
      Signed-off-by: NRob Herring <robh@kernel.org>
      a7e4cfb0
  3. 23 6月, 2017 2 次提交
  4. 18 5月, 2017 1 次提交
  5. 09 5月, 2017 1 次提交
  6. 05 5月, 2017 1 次提交
    • R
      of: fix sparse warnings in fdt, irq, reserved mem, and resolver code · 17a70355
      Rob Herring 提交于
      sparse generates the following warnings in drivers/of/:
      
      ../drivers/of/fdt.c:63:36: warning: cast to restricted __be32
      ../drivers/of/fdt.c:68:33: warning: cast to restricted __be32
      ../drivers/of/irq.c:105:88: warning: incorrect type in initializer (different base types)
      ../drivers/of/irq.c:105:88:    expected restricted __be32
      ../drivers/of/irq.c:105:88:    got int
      ../drivers/of/irq.c:526:35: warning: incorrect type in assignment (different modifiers)
      ../drivers/of/irq.c:526:35:    expected int ( *const [usertype] irq_init_cb )( ... )
      ../drivers/of/irq.c:526:35:    got void const *const data
      ../drivers/of/of_reserved_mem.c:200:50: warning: incorrect type in initializer (different modifiers)
      ../drivers/of/of_reserved_mem.c:200:50:    expected int ( *[usertype] initfn )( ... )
      ../drivers/of/of_reserved_mem.c:200:50:    got void const *const data
      ../drivers/of/resolver.c:95:42: warning: incorrect type in assignment (different base types)
      ../drivers/of/resolver.c:95:42:    expected unsigned int [unsigned] [usertype] <noident>
      ../drivers/of/resolver.c:95:42:    got restricted __be32 [usertype] <noident>
      
      All these are harmless type mismatches fixed by adjusting the types.
      Signed-off-by: NRob Herring <robh@kernel.org>
      17a70355
  7. 28 4月, 2017 1 次提交
  8. 09 2月, 2017 1 次提交
  9. 03 1月, 2017 1 次提交
  10. 13 12月, 2016 1 次提交
  11. 28 9月, 2016 1 次提交
  12. 10 8月, 2016 1 次提交
    • G
      drivers/of: Validate device node in __unflatten_device_tree() · 89c67752
      Gavin Shan 提交于
      @mynodes is set to NULL when __unflatten_device_tree() is called
      to unflatten device sub-tree in PCI hot add scenario on PowerPC
      PowerNV platform. Marking @mynodes detached unconditionally causes
      kernel crash as below backtrace shows:
      
      Unable to handle kernel paging request for data at address 0x00000000
      Faulting instruction address: 0xc000000000b26f64
      cpu 0x0: Vector: 300 (Data Access) at [c000003fcc7cf740]
          pc: c000000000b26f64: __unflatten_device_tree+0xf4/0x190
          lr: c000000000b26f40: __unflatten_device_tree+0xd0/0x190
          sp: c000003fcc7cf9c0
         msr: 900000000280b033
         dar: 0
       dsisr: 40000000
        current = 0xc000003fcc281680
        paca    = 0xc00000000ff00000	 softe: 0	 irq_happened: 0x01
          pid   = 2724, comm = sh
      Linux version 4.7.0-gavin-07754-g92a6836 (gwshan@gwshan) (gcc version \
      4.9.3 (Buildroot 2016.02-rc2-00093-g5ea3bce) ) #539 SMP Mon Aug 1 \
      12:40:29 AEST 2016
      enter ? for help
      [c000003fcc7cfa50] c000000000b27060 of_fdt_unflatten_tree+0x60/0x90
      [c000003fcc7cfaa0] c0000000004c6288 pnv_php_set_slot_power_state+0x118/0x440
      [c000003fcc7cfb80] c0000000004c6a10 pnv_php_enable+0xc0/0x170
      [c000003fcc7cfbd0] c0000000004c4d80 power_write_file+0xa0/0x190
      [c000003fcc7cfc50] c0000000004be93c pci_slot_attr_store+0x3c/0x60
      [c000003fcc7cfc70] c0000000002d3fd4 sysfs_kf_write+0x94/0xc0
      [c000003fcc7cfcb0] c0000000002d2c30 kernfs_fop_write+0x180/0x260
      [c000003fcc7cfd00] c000000000230fe0 __vfs_write+0x40/0x190
      [c000003fcc7cfd90] c000000000232278 vfs_write+0xc8/0x240
      [c000003fcc7cfde0] c000000000233d90 SyS_write+0x60/0x110
      [c000003fcc7cfe30] c000000000009524 system_call+0x38/0x108
      
      This avoids the kernel crash by marking @mynodes detached only when
      @mynodes is dereferencing valid device node in __unflatten_device_tree().
      
      Fixes: 1d1bde55 ("of: fdt: mark unflattened tree as detached")
      Reported-by: NMeng Li <shlimeng@cn.ibm.com>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      89c67752
  13. 19 7月, 2016 2 次提交
  14. 06 7月, 2016 1 次提交
  15. 10 6月, 2016 1 次提交
  16. 19 5月, 2016 2 次提交
    • G
      drivers/of: Fix build warning in populate_node() · dddc33e5
      Gavin Shan 提交于
      Function populate_node() is used to unflatten FDT blob to device
      tree. It supports maximal 64 level of device nodes. There is one
      array @fpsizes[64] tracking the full name length of last unflattened
      device node in the corresponding level (index of element in the
      array - 1). Build warning is seen with CONFIG_FRAME_WARN=1024 like
      below on ARM64 as Geert reported. The issue can be reproduced on
      PPC64 as well.
      
        $ make drivers/of/fdt.o
        drivers/of/fdt.c:443:1: warning: the frame size of 1136 bytes is \
        larger than 1024 bytes [-Wframe-larger-than=]
      
      This changes the data type of @fpsizes[i] from "unsigned long" to
      "unsigned int" to avoid the build warning. The return value type
      of populate_node() and its @fpsize argument is adjusted accordingly.
      With this applied, 256 bytes saved from the stack frame on ARM64 and
      PPC64 platforms and the above warning isn't seen.
      
      Fixes: 50800082 ("drivers/of: Avoid recursively calling unflatten_dt_node()")
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      dddc33e5
    • R
      drivers/of: Fix depth when unflattening devicetree · 78c44d91
      Rhyland Klein 提交于
      When the implementation for unflatten_dt_node() changed from being
      recursive to being non-recursive, it had a side effect of increasing the
      depth passed to fdt_next_node() by 1. This is fine most of the time, but
      it seems that when the end of the dtb is being parsed, it will cause the
      FDT_END condition in fdt_next_node() to return a different value
      (returning nextoffset instead of -FDT_ERR_NOTFOUND). This ends up passing
      an FDT_ERR_TRUNCATED error back to the unflatten_dt_node() which then
      sees that and complains "Error -8 processing FDT" causing boot to fail.
      
      This patch simply avoids incrementing depth and uses modified accesses
      for local array indices so that the depth is the same as it was before
      the change as far as fdt_next_node() is concerned.
      
      This problem was discovered trying to boot Tegra210-Smaug platforms.
      
      Fixes: 50800082 ("drivers/of: Avoid recursively calling unflatten_dt_node()")
      Signed-off-by: NRhyland Klein <rklein@nvidia.com>
      [robh: squashed in KASAN fix from Rhyland]
      Signed-off-by: NRob Herring <robh@kernel.org>
      78c44d91
  17. 16 5月, 2016 5 次提交
  18. 20 4月, 2016 1 次提交
  19. 19 2月, 2016 2 次提交
  20. 07 2月, 2016 6 次提交
  21. 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
  22. 01 12月, 2015 1 次提交
  23. 31 10月, 2015 1 次提交
  24. 28 10月, 2015 1 次提交
  25. 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
  26. 24 8月, 2015 1 次提交