OpenCloudOS-Kernel/drivers/of
Andrew Jones 0022085f11 of/irq: Support #msi-cells=<0> in of_msi_get_domain
commit db8e81132cf051843c9a59b46fa5a071c45baeb3 upstream.

An 'msi-parent' property with a single entry and no accompanying
'#msi-cells' property is considered the legacy definition as opposed
to its definition after being expanded with commit 126b16e2ad
("Docs: dt: add generic MSI bindings"). However, the legacy
definition is completely compatible with the current definition and,
since of_phandle_iterator_next() tolerates missing and present-but-
zero *cells properties since commit e42ee61017 ("of: Let
of_for_each_phandle fallback to non-negative cell_count"), there's no
need anymore to special case the legacy definition in
of_msi_get_domain().

Indeed, special casing has turned out to be harmful, because, as of
commit 7c025238b4 ("dt-bindings: irqchip: Describe the IMX MU block
as a MSI controller"), MSI controller DT bindings have started
specifying '#msi-cells' as a required property (even when the value
must be zero) as an effort to make the bindings more explicit. But,
since the special casing of 'msi-parent' only uses the existence of
'#msi-cells' for its heuristic, and not whether or not it's also
nonzero, the legacy path is not taken. Furthermore, the path to
support the new, broader definition isn't taken either since that
path has been restricted to the platform-msi bus.

But, neither the definition of 'msi-parent' nor the definition of
'#msi-cells' is platform-msi-specific (the platform-msi bus was just
the first bus that needed '#msi-cells'), so remove both the special
casing and the restriction. The code removal also requires changing
to of_parse_phandle_with_optional_args() in order to ensure the
legacy (but compatible) use of 'msi-parent' remains supported. This
not only simplifies the code but also resolves an issue with PCI
devices finding their MSI controllers on riscv, as the riscv,imsics
binding requires '#msi-cells=<0>'.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20240817074107.31153-2-ajones@ventanamicro.com
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-10 11:57:50 +02:00
..
unittest-data of: Fix double free in of_parse_phandle_with_args_map 2024-01-25 15:35:40 -08:00
Kconfig of: make OF_EARLY_FLATTREE depend on HAS_IOMEM 2023-07-10 08:48:35 -06:00
Makefile Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
address.c of: address: Report error on resource bounds overflow 2024-10-10 11:57:49 +02:00
base.c of: Fix double free in of_parse_phandle_with_args_map 2024-01-25 15:35:40 -08:00
cpu.c of: Move CPU node related functions to their own file 2023-04-13 17:46:34 -05:00
device.c Devicetree updates for v6.6: 2023-08-30 16:59:03 -07:00
dynamic.c of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-10 16:36:03 +02:00
fdt.c Devicetree fixes for 6.4, part 1: 2023-05-05 13:27:59 -07:00
fdt_address.c
irq.c of/irq: Support #msi-cells=<0> in of_msi_get_domain 2024-10-10 11:57:50 +02:00
kexec.c mm,ima,kexec,of: use memblock_free_late from ima_free_kexec_buffer 2023-08-18 11:47:45 -05:00
kobj.c of: make of_node_ktype constant 2023-02-06 11:03:00 -06:00
module.c of: module: add buffer overflow check in of_modalias() 2024-06-12 11:12:10 +02:00
of_numa.c of, numa: Fetch empty NUMA node ID from distance map 2021-10-04 13:13:44 -05:00
of_private.h of/irq: Factor out parsing of interrupt-map parent phandle+args from of_irq_parse_raw() 2024-07-25 09:50:43 +02:00
of_reserved_mem.c of: reserved_mem: Use stable allocation order 2023-06-20 09:34:58 -06:00
overlay.c of: overlay: Reorder struct fragment fields kerneldoc 2023-10-02 11:34:23 -05:00
pdt.c
platform.c of: Move of_skipped_node_table within #ifdef CONFIG_OF_ADDRESS 2023-08-22 12:53:11 -05:00
property.c of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing 2024-03-06 14:48:39 +00:00
resolver.c
unittest.c of: unittest: Fix compile in the non-dynamic case 2024-02-23 09:24:49 +01:00