mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-27 16:26:58 +00:00
Devicetree fixes for 6.13, part 1:
- 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 -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAmdoKtIACgkQ+vtdtY28 YcPM9w//foQifBxhfhjGFOZT/nZhlQu2EJT4eJ02hmFSDyvSBHTTdWELcjOKaGO7 QDex/Pw8gv1x0XMywaAOcCcZlQKUd0R9KjC+bWi+lC+f1MGyj5Pd1O2/jtZLJbuB BwGm/h4rxzM0nNDhD+mQwC/pZId0+ATA9kV4iR4RexWTxWdeYV8KDc7zA1pxi/aI PpKEQ6aapXCNjwYGANzs3ylA5AUHijQHOs9L64ACPAIJTN5ZOZvB1mZ33vp4NHl6 yNdNnZ8xZl8vecTM3rYTX9/yDRU18ME4gE72Hz5PfJ7aO7Xy8ebc4JCFTP8Iefwl ivVYsFFKIvqKArE0NRDxqYYmOpBob8id7nDuAZ2wmx0LLNgM/bkrk1ysuUwoMeQd aP/sGZ3+roKLDpBBTnOmTw89YWYkaLFXVwU4TbN7UIzqSYX5onGzSagN3fEnmHQu Q6hehVa9M758hwxiVK4S4z79RKTVwq8u1BLMe/s765xDKpvJGVwH4QlV+MfKLcn9 jbG2hT/mYwAQebmNqVWI7dAb8dt7zXijebuJCGPMW4RquBNGi+59MRAd4HrkJ2i4 DABbp3A5OqlyN05ilpB89w+GsPCgDL179mTy0MxRGY4O6GIqKdcBGjzqPHPW6UQf o9zdnw5ZnP9YicApGLwGgMpdoUS7voWyyrHGw+4i9oiOKLldVww= =CFJI -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
bcde95ce32
@ -114,8 +114,9 @@ patternProperties:
|
||||
table that specifies the PPID to LIODN mapping. Needed if the PAMU is
|
||||
used. Value is a 12 bit value where value is a LIODN ID for this JR.
|
||||
This property is normally set by boot firmware.
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
maximum: 0xfff
|
||||
$ref: /schemas/types.yaml#/definitions/uint32-array
|
||||
items:
|
||||
- maximum: 0xfff
|
||||
|
||||
'^rtic@[0-9a-f]+$':
|
||||
type: object
|
||||
@ -186,8 +187,9 @@ patternProperties:
|
||||
Needed if the PAMU is used. Value is a 12 bit value where value
|
||||
is a LIODN ID for this JR. This property is normally set by boot
|
||||
firmware.
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
maximum: 0xfff
|
||||
$ref: /schemas/types.yaml#/definitions/uint32-array
|
||||
items:
|
||||
- maximum: 0xfff
|
||||
|
||||
fsl,rtic-region:
|
||||
description:
|
||||
|
@ -82,7 +82,7 @@ examples:
|
||||
|
||||
uimage@100000 {
|
||||
reg = <0x0100000 0x200000>;
|
||||
compress = "lzma";
|
||||
compression = "lzma";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,7 @@ properties:
|
||||
|
||||
fsl,liodn:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32-array
|
||||
maxItems: 2
|
||||
description: See pamu.txt. Two LIODN(s). DQRR LIODN (DLIODN) and Frame LIODN
|
||||
(FLIODN)
|
||||
|
||||
@ -69,6 +70,7 @@ patternProperties:
|
||||
type: object
|
||||
properties:
|
||||
fsl,liodn:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32-array
|
||||
description: See pamu.txt, PAMU property used for static LIODN assignment
|
||||
|
||||
fsl,iommu-parent:
|
||||
|
@ -459,7 +459,8 @@ static int of_translate_one(const struct device_node *parent, const struct of_bu
|
||||
}
|
||||
if (ranges == NULL || rlen == 0) {
|
||||
offset = of_read_number(addr, na);
|
||||
memset(addr, 0, pna * 4);
|
||||
/* set address to zero, pass flags through */
|
||||
memset(addr + pbus->flag_cells, 0, (pna - pbus->flag_cells) * 4);
|
||||
pr_debug("empty ranges; 1:1 translation\n");
|
||||
goto finish;
|
||||
}
|
||||
@ -619,7 +620,7 @@ struct device_node *__of_get_dma_parent(const struct device_node *np)
|
||||
if (ret < 0)
|
||||
return of_get_parent(np);
|
||||
|
||||
return of_node_get(args.np);
|
||||
return args.np;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -88,7 +88,8 @@ static bool __of_node_is_type(const struct device_node *np, const char *type)
|
||||
}
|
||||
|
||||
#define EXCLUDED_DEFAULT_CELLS_PLATFORMS ( \
|
||||
IS_ENABLED(CONFIG_SPARC) \
|
||||
IS_ENABLED(CONFIG_SPARC) || \
|
||||
of_find_compatible_node(NULL, NULL, "coreboot") \
|
||||
)
|
||||
|
||||
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,
|
||||
map_len--;
|
||||
|
||||
/* Check if not found */
|
||||
if (!new)
|
||||
if (!new) {
|
||||
ret = -EINVAL;
|
||||
goto put;
|
||||
}
|
||||
|
||||
if (!of_device_is_available(new))
|
||||
match = 0;
|
||||
@ -1518,17 +1521,20 @@ int of_parse_phandle_with_args_map(const struct device_node *np,
|
||||
goto put;
|
||||
|
||||
/* Check for malformed properties */
|
||||
if (WARN_ON(new_size > MAX_PHANDLE_ARGS))
|
||||
goto put;
|
||||
if (map_len < new_size)
|
||||
if (WARN_ON(new_size > MAX_PHANDLE_ARGS) ||
|
||||
map_len < new_size) {
|
||||
ret = -EINVAL;
|
||||
goto put;
|
||||
}
|
||||
|
||||
/* Move forward by new node's #<list>-cells amount */
|
||||
map += new_size;
|
||||
map_len -= new_size;
|
||||
}
|
||||
if (!match)
|
||||
if (!match) {
|
||||
ret = -ENOENT;
|
||||
goto put;
|
||||
}
|
||||
|
||||
/* Get the <list>-map-pass-thru property (optional) */
|
||||
pass = of_get_property(cur, pass_name, NULL);
|
||||
|
@ -2,5 +2,12 @@
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
|
||||
/*
|
||||
* #address-cells/#size-cells are required properties at root node.
|
||||
* Use 2 cells for both address cells and size cells in order to fully
|
||||
* support 64-bit addresses and sizes on systems using this empty root
|
||||
* node.
|
||||
*/
|
||||
#address-cells = <0x02>;
|
||||
#size-cells = <0x02>;
|
||||
};
|
||||
|
@ -111,6 +111,7 @@ const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_ph
|
||||
else
|
||||
np = of_find_node_by_phandle(be32_to_cpup(imap));
|
||||
imap++;
|
||||
len--;
|
||||
|
||||
/* Check if not found */
|
||||
if (!np) {
|
||||
@ -354,6 +355,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
|
||||
return of_irq_parse_oldworld(device, index, out_irq);
|
||||
|
||||
/* Get the reg property (if any) */
|
||||
addr_len = 0;
|
||||
addr = of_get_property(device, "reg", &addr_len);
|
||||
|
||||
/* Prevent out-of-bounds read in case of longer interrupt parent address size */
|
||||
|
@ -1286,7 +1286,6 @@ DEFINE_SIMPLE_PROP(iommus, "iommus", "#iommu-cells")
|
||||
DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells")
|
||||
DEFINE_SIMPLE_PROP(io_channels, "io-channels", "#io-channel-cells")
|
||||
DEFINE_SIMPLE_PROP(io_backends, "io-backends", "#io-backend-cells")
|
||||
DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL)
|
||||
DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells")
|
||||
DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells")
|
||||
DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells")
|
||||
@ -1432,7 +1431,6 @@ static const struct supplier_bindings of_supplier_bindings[] = {
|
||||
{ .parse_prop = parse_mboxes, },
|
||||
{ .parse_prop = parse_io_channels, },
|
||||
{ .parse_prop = parse_io_backends, },
|
||||
{ .parse_prop = parse_interrupt_parent, },
|
||||
{ .parse_prop = parse_dmas, .optional = true, },
|
||||
{ .parse_prop = parse_power_domains, },
|
||||
{ .parse_prop = parse_hwlocks, },
|
||||
|
@ -114,6 +114,7 @@ pcie@d1070000 {
|
||||
device_type = "pci";
|
||||
ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x7f00000>,
|
||||
<0x81000000 0 0x00000000 0 0xefff0000 0 0x0010000>;
|
||||
dma-ranges = <0x43000000 0x10 0x00 0x00 0x00 0x00 0x10000000>;
|
||||
reg = <0x00000000 0xd1070000 0x20000>;
|
||||
|
||||
pci@0,0 {
|
||||
@ -142,6 +143,7 @@ local-bus@0 {
|
||||
#size-cells = <0x01>;
|
||||
ranges = <0xa0000000 0 0 0 0x2000000>,
|
||||
<0xb0000000 1 0 0 0x1000000>;
|
||||
dma-ranges = <0xc0000000 0x43000000 0x10 0x00 0x10000000>;
|
||||
|
||||
dev@e0000000 {
|
||||
reg = <0xa0001000 0x1000>,
|
||||
|
@ -1213,6 +1213,44 @@ static void __init of_unittest_pci_dma_ranges(void)
|
||||
of_node_put(np);
|
||||
}
|
||||
|
||||
static void __init of_unittest_pci_empty_dma_ranges(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
struct of_pci_range range;
|
||||
struct of_pci_range_parser parser;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_PCI))
|
||||
return;
|
||||
|
||||
np = of_find_node_by_path("/testcase-data/address-tests2/pcie@d1070000/pci@0,0/dev@0,0/local-bus@0");
|
||||
if (!np) {
|
||||
pr_err("missing testcase data\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (of_pci_dma_range_parser_init(&parser, np)) {
|
||||
pr_err("missing dma-ranges property\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the dma-ranges from the device tree
|
||||
*/
|
||||
for_each_of_pci_range(&parser, &range) {
|
||||
unittest(range.size == 0x10000000,
|
||||
"for_each_of_pci_range wrong size on node %pOF size=%llx\n",
|
||||
np, range.size);
|
||||
unittest(range.cpu_addr == 0x00000000,
|
||||
"for_each_of_pci_range wrong CPU addr (%llx) on node %pOF",
|
||||
range.cpu_addr, np);
|
||||
unittest(range.pci_addr == 0xc0000000,
|
||||
"for_each_of_pci_range wrong DMA addr (%llx) on node %pOF",
|
||||
range.pci_addr, np);
|
||||
}
|
||||
|
||||
of_node_put(np);
|
||||
}
|
||||
|
||||
static void __init of_unittest_bus_ranges(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
@ -4272,6 +4310,7 @@ static int __init of_unittest(void)
|
||||
of_unittest_dma_get_max_cpu_address();
|
||||
of_unittest_parse_dma_ranges();
|
||||
of_unittest_pci_dma_ranges();
|
||||
of_unittest_pci_empty_dma_ranges();
|
||||
of_unittest_bus_ranges();
|
||||
of_unittest_bus_3cell_ranges();
|
||||
of_unittest_reg();
|
||||
|
Loading…
Reference in New Issue
Block a user