Merge tag 'devicetree-fixes-for-6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree fixes from Rob Herring:

- Disable #address-cells/#size-cells warning on coreboot (Chromebooks)
platforms

- Add missing root #address-cells/#size-cells in default empty DT

- Fix uninitialized variable in of_irq_parse_one()

- Fix interrupt-map cell length check in of_irq_parse_imap_parent()

- Fix refcount handling in __of_get_dma_parent()

- Fix error path in of_parse_phandle_with_args_map()

- Fix dma-ranges handling with flags cells

- Drop explicit fw_devlink handling of 'interrupt-parent'

- Fix "compression" typo in fixed-partitions binding

- Unify "fsl,liodn" property type definitions

* tag 'devicetree-fixes-for-6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
of: Add coreboot firmware to excluded default cells list
of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one()
of/irq: Fix interrupt-map cell length check in of_irq_parse_imap_parent()
of: Fix refcount leakage for OF node returned by __of_get_dma_parent()
of: Fix error path in of_parse_phandle_with_args_map()
dt-bindings: mtd: fixed-partitions: Fix "compression" typo
of: Add #address-cells/#size-cells in the device-tree root empty node
dt-bindings: Unify "fsl,liodn" type definitions
of: address: Preserve the flags portion on 1:1 dma-ranges mapping
of/unittest: Add empty dma-ranges address translation tests
of: property: fw_devlink: Do not use interrupt-parent directly

Changed files
+75 -16
Documentation
devicetree
bindings
drivers
+6 -4
Documentation/devicetree/bindings/crypto/fsl,sec-v4.0.yaml
··· 114 114 table that specifies the PPID to LIODN mapping. Needed if the PAMU is 115 115 used. Value is a 12 bit value where value is a LIODN ID for this JR. 116 116 This property is normally set by boot firmware. 117 - $ref: /schemas/types.yaml#/definitions/uint32 118 - maximum: 0xfff 117 + $ref: /schemas/types.yaml#/definitions/uint32-array 118 + items: 119 + - maximum: 0xfff 119 120 120 121 '^rtic@[0-9a-f]+$': 121 122 type: object ··· 187 186 Needed if the PAMU is used. Value is a 12 bit value where value 188 187 is a LIODN ID for this JR. This property is normally set by boot 189 188 firmware. 190 - $ref: /schemas/types.yaml#/definitions/uint32 191 - maximum: 0xfff 189 + $ref: /schemas/types.yaml#/definitions/uint32-array 190 + items: 191 + - maximum: 0xfff 192 192 193 193 fsl,rtic-region: 194 194 description:
+1 -1
Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml
··· 82 82 83 83 uimage@100000 { 84 84 reg = <0x0100000 0x200000>; 85 - compress = "lzma"; 85 + compression = "lzma"; 86 86 }; 87 87 }; 88 88
+2
Documentation/devicetree/bindings/soc/fsl/fsl,qman-portal.yaml
··· 35 35 36 36 fsl,liodn: 37 37 $ref: /schemas/types.yaml#/definitions/uint32-array 38 + maxItems: 2 38 39 description: See pamu.txt. Two LIODN(s). DQRR LIODN (DLIODN) and Frame LIODN 39 40 (FLIODN) 40 41 ··· 70 69 type: object 71 70 properties: 72 71 fsl,liodn: 72 + $ref: /schemas/types.yaml#/definitions/uint32-array 73 73 description: See pamu.txt, PAMU property used for static LIODN assignment 74 74 75 75 fsl,iommu-parent:
+3 -2
drivers/of/address.c
··· 459 459 } 460 460 if (ranges == NULL || rlen == 0) { 461 461 offset = of_read_number(addr, na); 462 - memset(addr, 0, pna * 4); 462 + /* set address to zero, pass flags through */ 463 + memset(addr + pbus->flag_cells, 0, (pna - pbus->flag_cells) * 4); 463 464 pr_debug("empty ranges; 1:1 translation\n"); 464 465 goto finish; 465 466 } ··· 620 619 if (ret < 0) 621 620 return of_get_parent(np); 622 621 623 - return of_node_get(args.np); 622 + return args.np; 624 623 } 625 624 #endif 626 625
+12 -6
drivers/of/base.c
··· 88 88 } 89 89 90 90 #define EXCLUDED_DEFAULT_CELLS_PLATFORMS ( \ 91 - IS_ENABLED(CONFIG_SPARC) \ 91 + IS_ENABLED(CONFIG_SPARC) || \ 92 + of_find_compatible_node(NULL, NULL, "coreboot") \ 92 93 ) 93 94 94 95 int of_bus_n_addr_cells(struct device_node *np) ··· 1508 1507 map_len--; 1509 1508 1510 1509 /* Check if not found */ 1511 - if (!new) 1510 + if (!new) { 1511 + ret = -EINVAL; 1512 1512 goto put; 1513 + } 1513 1514 1514 1515 if (!of_device_is_available(new)) 1515 1516 match = 0; ··· 1521 1518 goto put; 1522 1519 1523 1520 /* Check for malformed properties */ 1524 - if (WARN_ON(new_size > MAX_PHANDLE_ARGS)) 1521 + if (WARN_ON(new_size > MAX_PHANDLE_ARGS) || 1522 + map_len < new_size) { 1523 + ret = -EINVAL; 1525 1524 goto put; 1526 - if (map_len < new_size) 1527 - goto put; 1525 + } 1528 1526 1529 1527 /* Move forward by new node's #<list>-cells amount */ 1530 1528 map += new_size; 1531 1529 map_len -= new_size; 1532 1530 } 1533 - if (!match) 1531 + if (!match) { 1532 + ret = -ENOENT; 1534 1533 goto put; 1534 + } 1535 1535 1536 1536 /* Get the <list>-map-pass-thru property (optional) */ 1537 1537 pass = of_get_property(cur, pass_name, NULL);
+8 -1
drivers/of/empty_root.dts
··· 2 2 /dts-v1/; 3 3 4 4 / { 5 - 5 + /* 6 + * #address-cells/#size-cells are required properties at root node. 7 + * Use 2 cells for both address cells and size cells in order to fully 8 + * support 64-bit addresses and sizes on systems using this empty root 9 + * node. 10 + */ 11 + #address-cells = <0x02>; 12 + #size-cells = <0x02>; 6 13 };
+2
drivers/of/irq.c
··· 111 111 else 112 112 np = of_find_node_by_phandle(be32_to_cpup(imap)); 113 113 imap++; 114 + len--; 114 115 115 116 /* Check if not found */ 116 117 if (!np) { ··· 355 354 return of_irq_parse_oldworld(device, index, out_irq); 356 355 357 356 /* Get the reg property (if any) */ 357 + addr_len = 0; 358 358 addr = of_get_property(device, "reg", &addr_len); 359 359 360 360 /* Prevent out-of-bounds read in case of longer interrupt parent address size */
-2
drivers/of/property.c
··· 1286 1286 DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells") 1287 1287 DEFINE_SIMPLE_PROP(io_channels, "io-channels", "#io-channel-cells") 1288 1288 DEFINE_SIMPLE_PROP(io_backends, "io-backends", "#io-backend-cells") 1289 - DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL) 1290 1289 DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells") 1291 1290 DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") 1292 1291 DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") ··· 1431 1432 { .parse_prop = parse_mboxes, }, 1432 1433 { .parse_prop = parse_io_channels, }, 1433 1434 { .parse_prop = parse_io_backends, }, 1434 - { .parse_prop = parse_interrupt_parent, }, 1435 1435 { .parse_prop = parse_dmas, .optional = true, }, 1436 1436 { .parse_prop = parse_power_domains, }, 1437 1437 { .parse_prop = parse_hwlocks, },
+2
drivers/of/unittest-data/tests-address.dtsi
··· 114 114 device_type = "pci"; 115 115 ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x7f00000>, 116 116 <0x81000000 0 0x00000000 0 0xefff0000 0 0x0010000>; 117 + dma-ranges = <0x43000000 0x10 0x00 0x00 0x00 0x00 0x10000000>; 117 118 reg = <0x00000000 0xd1070000 0x20000>; 118 119 119 120 pci@0,0 { ··· 143 142 #size-cells = <0x01>; 144 143 ranges = <0xa0000000 0 0 0 0x2000000>, 145 144 <0xb0000000 1 0 0 0x1000000>; 145 + dma-ranges = <0xc0000000 0x43000000 0x10 0x00 0x10000000>; 146 146 147 147 dev@e0000000 { 148 148 reg = <0xa0001000 0x1000>,
+39
drivers/of/unittest.c
··· 1213 1213 of_node_put(np); 1214 1214 } 1215 1215 1216 + static void __init of_unittest_pci_empty_dma_ranges(void) 1217 + { 1218 + struct device_node *np; 1219 + struct of_pci_range range; 1220 + struct of_pci_range_parser parser; 1221 + 1222 + if (!IS_ENABLED(CONFIG_PCI)) 1223 + return; 1224 + 1225 + np = of_find_node_by_path("/testcase-data/address-tests2/pcie@d1070000/pci@0,0/dev@0,0/local-bus@0"); 1226 + if (!np) { 1227 + pr_err("missing testcase data\n"); 1228 + return; 1229 + } 1230 + 1231 + if (of_pci_dma_range_parser_init(&parser, np)) { 1232 + pr_err("missing dma-ranges property\n"); 1233 + return; 1234 + } 1235 + 1236 + /* 1237 + * Get the dma-ranges from the device tree 1238 + */ 1239 + for_each_of_pci_range(&parser, &range) { 1240 + unittest(range.size == 0x10000000, 1241 + "for_each_of_pci_range wrong size on node %pOF size=%llx\n", 1242 + np, range.size); 1243 + unittest(range.cpu_addr == 0x00000000, 1244 + "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", 1245 + range.cpu_addr, np); 1246 + unittest(range.pci_addr == 0xc0000000, 1247 + "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", 1248 + range.pci_addr, np); 1249 + } 1250 + 1251 + of_node_put(np); 1252 + } 1253 + 1216 1254 static void __init of_unittest_bus_ranges(void) 1217 1255 { 1218 1256 struct device_node *np; ··· 4310 4272 of_unittest_dma_get_max_cpu_address(); 4311 4273 of_unittest_parse_dma_ranges(); 4312 4274 of_unittest_pci_dma_ranges(); 4275 + of_unittest_pci_empty_dma_ranges(); 4313 4276 of_unittest_bus_ranges(); 4314 4277 of_unittest_bus_3cell_ranges(); 4315 4278 of_unittest_reg();