Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3cdcadd authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

ARM: dts: msm: Use a carveout for memshare memory

The memshare driver currently uses CMA memory for its usecases. This
is problematic, as CMA memory has a normal cached mapping in the kernel,
which allows for speculative access. This makes it possible for a
speculative cache-line fill to occur, prior to the memory being unmapped
from the stage-2 page tables of Linux, as well as XPU protected. The
cache-line can later be evicted, while the memory is still XPU protected.
This results in a write to the system cache, which is blocked by the XPU,
resulting in an XPU violation.

Given the nature of the memshare usecases (i.e. the memory is allocated
once, and never given back to Linux), move the memshare driver to using
a carveout. Using a carveout makes it so that there are no normal cached
mappings in the kernel for the memory, which prevents speculative
cache-line fills from occurring.

Change-Id: I97e2fe144c8fde364ecd40fdd181a881ca93c4b1
parent 0fa79835
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -381,6 +381,14 @@
			alignment = <0x0 0x400000>;
			alignment = <0x0 0x400000>;
			size = <0x0 0x1000000>;
			size = <0x0 0x1000000>;
		};
		};

		memshare_mem: memshare_region {
			compatible = "shared-dma-pool";
			no-map;
			alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
			alignment = <0x0 0x100000>;
			size = <0x0 0x800000>;
		};
	};
	};


	soc: soc { };
	soc: soc { };
@@ -1044,6 +1052,7 @@
		qcom,client_3 {
		qcom,client_3 {
			compatible = "qcom,memshare-peripheral";
			compatible = "qcom,memshare-peripheral";
			qcom,peripheral-size = <0x500000>;
			qcom,peripheral-size = <0x500000>;
			memory-region = <&memshare_mem>;
			qcom,client-id = <1>;
			qcom,client-id = <1>;
			qcom,allocate-on-request;
			qcom,allocate-on-request;
			label = "modem";
			label = "modem";
+14 −0
Original line number Original line Diff line number Diff line
@@ -523,6 +523,19 @@
			label = "dfps_data_region";
			label = "dfps_data_region";
		};
		};


		memshare_mem: memshare_region {
			compatible = "shared-dma-pool";
			no-map;
			/*
			 * Memory shared with modem needs to be outside of
			 * the CLADE address space, which begins at
			 * 0xE0000000 and spans 512 MB.
			 */
			alloc-ranges = <0x0 0x00000000 0x0 0xdfffffff>;
			alignment = <0x0 0x100000>;
			size = <0x0 0x800000>;
		};

		non_secure_display_memory: non_secure_display_region {
		non_secure_display_memory: non_secure_display_region {
			compatible = "shared-dma-pool";
			compatible = "shared-dma-pool";
			alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
			alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
@@ -2288,6 +2301,7 @@
		qcom,client_3 {
		qcom,client_3 {
			compatible = "qcom,memshare-peripheral";
			compatible = "qcom,memshare-peripheral";
			qcom,peripheral-size = <0x500000>;
			qcom,peripheral-size = <0x500000>;
			memory-region = <&memshare_mem>;
			qcom,client-id = <1>;
			qcom,client-id = <1>;
			qcom,allocate-on-request;
			qcom,allocate-on-request;
			label = "modem";
			label = "modem";
+9 −0
Original line number Original line Diff line number Diff line
@@ -428,6 +428,14 @@
			size = <0x0 0x400000>;
			size = <0x0 0x400000>;
		};
		};


		memshare_mem: memshare_region {
			compatible = "shared-dma-pool";
			no-map;
			alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
			alignment = <0x0 0x100000>;
			size = <0x0 0x800000>;
		};

		dump_mem: mem_dump_region {
		dump_mem: mem_dump_region {
			compatible = "shared-dma-pool";
			compatible = "shared-dma-pool";
			alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
			alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>;
@@ -775,6 +783,7 @@
		qcom,client_3 {
		qcom,client_3 {
			compatible = "qcom,memshare-peripheral";
			compatible = "qcom,memshare-peripheral";
			qcom,peripheral-size = <0x500000>;
			qcom,peripheral-size = <0x500000>;
			memory-region = <&memshare_mem>;
			qcom,client-id = <1>;
			qcom,client-id = <1>;
			qcom,allocate-on-request;
			qcom,allocate-on-request;
			label = "modem";
			label = "modem";