linux/drivers/of
Stephen Boyd da17d6905d of/fdt: Don't worry about non-memory region overlap for no-map
In commit 8a5a75e5e9 ("of/fdt: Make sure no-map does not remove
already reserved regions") we returned -EBUSY when trying to mark
regions as no-map when they intersect with reserved memory. The goal was
to find bad no-map reserved memory DT nodes that would unmap the kernel
text/data sections.

The problem is the reserved memory check will still trigger if the DT
has a /memreserve/ that completely subsumes the no-map memory carveouts
in the reserved memory node _and_ that region is also not part of the
memory reg property. For example in sc7180.dtsi we have the following
reserved-memory and memory node:

      memory@80000000 {
          /* We expect the bootloader to fill in the size */
          reg = <0 0x80000000 0 0>;
      };

      smem_mem: memory@80900000 {
              reg = <0x0 0x80900000 0x0 0x200000>;
              no-map;
      };

and the memreserve filled in by the bootloader is

      /memreserve/ 0x80800000 0x400000;

while the /memory node is transformed into

      memory@80000000 {
          /* The bootloader fills in the size, and adds another region */
          reg = <0 0x80000000 0 0x00800000>,
                <0 0x80c00000 0 0x7f200000>;
      };

The smem region is doubly reserved via /memreserve/ and by not being
part of the /memory reg property. This leads to the following warning
printed at boot.

 OF: fdt: Reserved memory: failed to reserve memory for node 'memory@80900000': base 0x0000000080900000, size 2 MiB

Otherwise nothing really goes wrong because the smem region is not going
to be mapped by the kernel's direct linear mapping given that it isn't
part of the memory node. Therefore, let's only consider this to be a
problem if we're trying to mark a region as no-map and it is actually
memory that we're intending to keep out of the kernel's direct mapping
but it's already been reserved.

Acked-by: Mike Rapoport <rppt@kernel.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Nicolas Boichat <drinkcat@chromium.org>
Cc: Quentin Perret <qperret@google.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Fixes: 8a5a75e5e9 ("of/fdt: Make sure no-map does not remove already reserved regions")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220107194233.2793146-1-swboyd@chromium.org
2022-01-08 08:50:39 -06:00
..
unittest-data of: unittest: document intentional interrupt-map provider build warning 2021-11-01 20:33:56 -05:00
address.c of: Move of_dma_set_restricted_buffer() into device.c 2021-08-23 06:32:02 -04:00
base.c of: base: Improve argument length mismatch error 2022-01-08 08:50:39 -06:00
device.c of: restricted dma: Fix condition for rmem init 2021-09-17 15:58:09 -05:00
dynamic.c of: Add missing 'Return' section in kerneldoc comments 2021-03-27 12:59:03 -06:00
fdt.c of/fdt: Don't worry about non-memory region overlap for no-map 2022-01-08 08:50:39 -06:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
irq.c of/irq: Don't ignore interrupt-controller when interrupt-map failed 2021-11-12 16:10:00 +00:00
Kconfig of: net: move of_net under net/ 2021-10-07 13:39:51 +01:00
kexec.c memblock: rename memblock_free to memblock_phys_free 2021-11-06 13:30:41 -07:00
kobj.c of: kobj: make of_node_is_(initialized|attached) parameters const 2021-10-20 13:37:25 -05:00
Makefile of: net: move of_net under net/ 2021-10-07 13:39:51 +01: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: kobj: make of_node_is_(initialized|attached) parameters const 2021-10-20 13:37:25 -05:00
of_reserved_mem.c memblock: rename memblock_free to memblock_phys_free 2021-11-06 13:30:41 -07:00
overlay.c of: overlay: Remove redundant assignment to ret 2021-05-03 13:57:56 -05:00
pdt.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
platform.c of: Support using 'mask' in making device bus id 2021-11-11 22:27:16 -06:00
property.c of: property: fw_devlink: Fixup behaviour when 'node_not_dev' is set 2021-11-18 08:13:52 -06:00
resolver.c of: overlay: log the error cause on resolver failure 2020-03-02 11:32:44 -06:00
unittest.c of: unittest: remove unneeded semicolon 2022-01-08 08:50:39 -06:00