Skip to content

Commit bcde95c

Browse files
committed
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
2 parents 48f506a + 8600058 commit bcde95c

File tree

10 files changed

+75
-16
lines changed

10 files changed

+75
-16
lines changed

Documentation/devicetree/bindings/crypto/fsl,sec-v4.0.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ patternProperties:
114114
table that specifies the PPID to LIODN mapping. Needed if the PAMU is
115115
used. Value is a 12 bit value where value is a LIODN ID for this JR.
116116
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
119120

120121
'^rtic@[0-9a-f]+$':
121122
type: object
@@ -186,8 +187,9 @@ patternProperties:
186187
Needed if the PAMU is used. Value is a 12 bit value where value
187188
is a LIODN ID for this JR. This property is normally set by boot
188189
firmware.
189-
$ref: /schemas/types.yaml#/definitions/uint32
190-
maximum: 0xfff
190+
$ref: /schemas/types.yaml#/definitions/uint32-array
191+
items:
192+
- maximum: 0xfff
191193

192194
fsl,rtic-region:
193195
description:

Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ examples:
8282
8383
uimage@100000 {
8484
reg = <0x0100000 0x200000>;
85-
compress = "lzma";
85+
compression = "lzma";
8686
};
8787
};
8888

Documentation/devicetree/bindings/soc/fsl/fsl,qman-portal.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ properties:
3535

3636
fsl,liodn:
3737
$ref: /schemas/types.yaml#/definitions/uint32-array
38+
maxItems: 2
3839
description: See pamu.txt. Two LIODN(s). DQRR LIODN (DLIODN) and Frame LIODN
3940
(FLIODN)
4041

@@ -69,6 +70,7 @@ patternProperties:
6970
type: object
7071
properties:
7172
fsl,liodn:
73+
$ref: /schemas/types.yaml#/definitions/uint32-array
7274
description: See pamu.txt, PAMU property used for static LIODN assignment
7375

7476
fsl,iommu-parent:

drivers/of/address.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ static int of_translate_one(const struct device_node *parent, const struct of_bu
459459
}
460460
if (ranges == NULL || rlen == 0) {
461461
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);
463464
pr_debug("empty ranges; 1:1 translation\n");
464465
goto finish;
465466
}
@@ -619,7 +620,7 @@ struct device_node *__of_get_dma_parent(const struct device_node *np)
619620
if (ret < 0)
620621
return of_get_parent(np);
621622

622-
return of_node_get(args.np);
623+
return args.np;
623624
}
624625
#endif
625626

drivers/of/base.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ static bool __of_node_is_type(const struct device_node *np, const char *type)
8888
}
8989

9090
#define EXCLUDED_DEFAULT_CELLS_PLATFORMS ( \
91-
IS_ENABLED(CONFIG_SPARC) \
91+
IS_ENABLED(CONFIG_SPARC) || \
92+
of_find_compatible_node(NULL, NULL, "coreboot") \
9293
)
9394

9495
int of_bus_n_addr_cells(struct device_node *np)
@@ -1507,8 +1508,10 @@ int of_parse_phandle_with_args_map(const struct device_node *np,
15071508
map_len--;
15081509

15091510
/* Check if not found */
1510-
if (!new)
1511+
if (!new) {
1512+
ret = -EINVAL;
15111513
goto put;
1514+
}
15121515

15131516
if (!of_device_is_available(new))
15141517
match = 0;
@@ -1518,17 +1521,20 @@ int of_parse_phandle_with_args_map(const struct device_node *np,
15181521
goto put;
15191522

15201523
/* Check for malformed properties */
1521-
if (WARN_ON(new_size > MAX_PHANDLE_ARGS))
1522-
goto put;
1523-
if (map_len < new_size)
1524+
if (WARN_ON(new_size > MAX_PHANDLE_ARGS) ||
1525+
map_len < new_size) {
1526+
ret = -EINVAL;
15241527
goto put;
1528+
}
15251529

15261530
/* Move forward by new node's #<list>-cells amount */
15271531
map += new_size;
15281532
map_len -= new_size;
15291533
}
1530-
if (!match)
1534+
if (!match) {
1535+
ret = -ENOENT;
15311536
goto put;
1537+
}
15321538

15331539
/* Get the <list>-map-pass-thru property (optional) */
15341540
pass = of_get_property(cur, pass_name, NULL);

drivers/of/empty_root.dts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
/dts-v1/;
33

44
/ {
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>;
613
};

drivers/of/irq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_ph
111111
else
112112
np = of_find_node_by_phandle(be32_to_cpup(imap));
113113
imap++;
114+
len--;
114115

115116
/* Check if not found */
116117
if (!np) {
@@ -354,6 +355,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
354355
return of_irq_parse_oldworld(device, index, out_irq);
355356

356357
/* Get the reg property (if any) */
358+
addr_len = 0;
357359
addr = of_get_property(device, "reg", &addr_len);
358360

359361
/* Prevent out-of-bounds read in case of longer interrupt parent address size */

drivers/of/property.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,6 @@ DEFINE_SIMPLE_PROP(iommus, "iommus", "#iommu-cells")
12861286
DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells")
12871287
DEFINE_SIMPLE_PROP(io_channels, "io-channels", "#io-channel-cells")
12881288
DEFINE_SIMPLE_PROP(io_backends, "io-backends", "#io-backend-cells")
1289-
DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL)
12901289
DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells")
12911290
DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells")
12921291
DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells")
@@ -1432,7 +1431,6 @@ static const struct supplier_bindings of_supplier_bindings[] = {
14321431
{ .parse_prop = parse_mboxes, },
14331432
{ .parse_prop = parse_io_channels, },
14341433
{ .parse_prop = parse_io_backends, },
1435-
{ .parse_prop = parse_interrupt_parent, },
14361434
{ .parse_prop = parse_dmas, .optional = true, },
14371435
{ .parse_prop = parse_power_domains, },
14381436
{ .parse_prop = parse_hwlocks, },

drivers/of/unittest-data/tests-address.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
device_type = "pci";
115115
ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x7f00000>,
116116
<0x81000000 0 0x00000000 0 0xefff0000 0 0x0010000>;
117+
dma-ranges = <0x43000000 0x10 0x00 0x00 0x00 0x00 0x10000000>;
117118
reg = <0x00000000 0xd1070000 0x20000>;
118119

119120
pci@0,0 {
@@ -142,6 +143,7 @@
142143
#size-cells = <0x01>;
143144
ranges = <0xa0000000 0 0 0 0x2000000>,
144145
<0xb0000000 1 0 0 0x1000000>;
146+
dma-ranges = <0xc0000000 0x43000000 0x10 0x00 0x10000000>;
145147

146148
dev@e0000000 {
147149
reg = <0xa0001000 0x1000>,

drivers/of/unittest.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,44 @@ static void __init of_unittest_pci_dma_ranges(void)
12131213
of_node_put(np);
12141214
}
12151215

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+
12161254
static void __init of_unittest_bus_ranges(void)
12171255
{
12181256
struct device_node *np;
@@ -4272,6 +4310,7 @@ static int __init of_unittest(void)
42724310
of_unittest_dma_get_max_cpu_address();
42734311
of_unittest_parse_dma_ranges();
42744312
of_unittest_pci_dma_ranges();
4313+
of_unittest_pci_empty_dma_ranges();
42754314
of_unittest_bus_ranges();
42764315
of_unittest_bus_3cell_ranges();
42774316
of_unittest_reg();

0 commit comments

Comments
 (0)