Re: [PATCH v38 7/7] arm64: dts: imx8ulp: add reserved memory for EdgeLock Enclave

[email protected]
Newsgroups dev.linux.lists.imx,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The dynamically allocated `ele-reserved` `no-map` node lacks an `alignment` property, leading to unaligned `no-map` memory boundaries that cause driver initialization failure via `memremap()`/`ioremap()` restrictions.
--

--- Patch [7]: [PATCH v38 7/7] arm64: dts: imx8ulp: add reserved memory for EdgeLock Enclave ---
commit 823a1957195d7807067b0fe5d633790925b23c7b
Author: Pankaj Gupta <[email protected]>

arm64: dts: imx8ulp: add reserved memory for EdgeLock Enclave

This commit reserves 1MB of DDR for the EdgeLock Enclave in a new shared
imx8ulp-firmware.dtsi file. The allocation is constrained to a specific
address window to allow dynamic placement by the kernel.

> diff --git a/arch/arm64/boot/dts/freescale/imx8ulp-firmware.dtsi b/arch/arm64/boot/dts/freescale/imx8ulp-firmware.dtsi
> new file mode 100644
> index 0000000000000..e4bc352f68afb
> --- /dev/null
> +++ b/arch/arm64/boot/dts/freescale/imx8ulp-firmware.dtsi
[ ... ]
> @@ -0,0 +1,31 @@
[ ... ]
> +/ {
> +	reserved-memory {
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +
> +		ele_reserved: ele-reserved {
> +			compatible = "shared-dma-pool";
> +			alloc-ranges = <0 0x80000000 0 0x30000000>;
> +			size = <0 0x100000>;
> +			no-map;
> +		};

[Severity: High]
Should this dynamically allocated no-map region include an alignment property?

Without an explicit alignment, early_init_dt_alloc_reserved_memory_arch()
defaults to SMP_CACHE_BYTES (128 bytes). If the memblock allocator places
the region at a non-page-aligned physical address, the no-map region can
split a physical page.

During driver initialization, dma_init_coherent_memory() calls memremap()
to map this reserved pool. On arm64, this invokes ioremap(), which strictly
verifies that the target PFN does not overlap linearly mapped System RAM.

Because the physical page starts before the unaligned no-map region, it
evaluates as regular mapped RAM. This triggers the architectural safety check
prohibiting the mapping of RAM as I/O memory, causing ioremap() to warn and
return NULL, preventing the driver from initializing.

> +	};
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.