Re: [PATCH] tee: amdtee: add support for use of cma region

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8/19/2023 4:34 AM, Randy Dunlap wrote:
Hi--

On 8/18/23 07:42, Devaraj Rangasamy wrote:
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 722b6eca2e93..5e38423f3d53 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -363,6 +363,13 @@
  			  selects a performance level in this range and appropriate
  			  to the current workload.
+ amdtee_cma=nn [HW,TEE]
+			Sets the memory size reserved for contiguous memory
+			allocations, to be used by amdtee device driver.
+			Value is in MB and can range from 4 to 128 (MBs)
			                                       128 (MBs).
Ack.
In updated patch, we dont use new custom kernel command line parameter, and resorted to generic cma zone.

+			CMA will be active only when CMA is enabled, and amdtee is
	That could use some improvement. How about:

			AMD-TEE CMA will be active only when CONFIG_CMA is enabled,
			and amdtee is
Ack, as above.

+			built as inbuilt driver, and not loaded as module.
+
  	amijoy.map=	[HW,JOY] Amiga joystick support
  			Map of devices attached to JOY0DAT and JOY1DAT
  			Format: <a>,<b>
diff --git a/drivers/tee/amdtee/Kconfig b/drivers/tee/amdtee/Kconfig
index 191f9715fa9a..5843c739a7b8 100644
--- a/drivers/tee/amdtee/Kconfig
+++ b/drivers/tee/amdtee/Kconfig
@@ -6,3 +6,12 @@ config AMDTEE
  	depends on CRYPTO_DEV_SP_PSP && CRYPTO_DEV_CCP_DD
  	help
  	  This implements AMD's Trusted Execution Environment (TEE) driver.
+
+config AMDTEE_CMA_SIZE
+	int "Size of Memory in MiB reserved in CMA for AMD-TEE"
+	default "0"
Why won't this default value cause an allocation error message?
Maybe I'm just not following the call paths correctly.

It looks to me like this causes a call to
cma_declare_contiguous_nid() with @size = 0, and that function says:

	if (!size)
		return -EINVAL;
Ack.
It did resulted in error message. We have revoked new exclusive cma zone now.
+	depends on CMA && (AMDTEE=y)
+	help
+	  Specify the default amount of memory in MiB reserved in CMA for AMD-TEE driver
	                                                                          driver.
Ack.
+	  Any amdtee shm buffer allocation larger than 64k will allocate memory from the CMA
	                                                                                 CMA.
Ack.
+	  The default can be overridden with the kernel commandline parameter "amdtee_cma".
\ No newline at end of file
Please fix that ^^^ warning.
Ack, as above. Thanks for the review.

Thanks.



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux