我正在ARM Trustzone中运行一个安全的操作系统,而Linux正在" normal"世界。由于某些部分RAM受到硬件的保护而无法正常访问(使用TZASC),因此我想阻止Linux尝试访问它,否则会崩溃。我还需要一个由Linux分配的两个世界之间的共享缓冲区。为此,我想使用this document保留两个内存区域。
我有两种方面:
以下是我的设备树的摘录:
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
/* global autoconfigured region for contiguous allocations */
linux,cma {
compatible = "shared-dma-pool";
reusable;
reg = <0 0xa0000000 0 0x14000000>;
linux,cma-default;
};
/* First range, static, that I don't want anyone to touch */
reserved_static: mymem@0xc0000000 {
compatible = "mymem,reserved-memory";
reg = <0 0xc0000000 0 0x08000000>;
no-map;
};
/* Second range, limited to a single driver */
reserved_dynamic: shared {
compatible = "mymem,memory-shared";
size = <0 0x08000000>;
alignment = <0 0x200000>;
alloc-ranges = <0 0xc8000000 0 0x38000000>;
};
};
mydev {
compatible = "mydev,mydev";
memory-region = <&reserved_dynamic>;
};
我可以从我的驱动程序代码访问设备树信息,我想阻止任何访问静态内存范围(我想我已经覆盖了no-map
属性),并且只有我的驱动程序才能访问动态属性。
这是可能的,我该如何实现呢?