crypto: ccp - Add a header for multiple drivers to use `__psp_pa`
authorMario Limonciello <mario.limonciello@amd.com>
Fri, 10 Mar 2023 21:19:45 +0000 (15:19 -0600)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 17 Mar 2023 03:16:43 +0000 (11:16 +0800)
The TEE subdriver for CCP, the amdtee driver and the i2c-designware-amdpsp
drivers all include `psp-sev.h` even though they don't use SEV
functionality.

Move the definition of `__psp_pa` into a common header to be included
by all of these drivers.

Reviewed-by: Jan Dabros <jsd@semihalf.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> # For the drivers/i2c/busses/i2c-designware-amdpsp.c
Acked-by: Sumit Garg <sumit.garg@linaro.org> # For TEE subsystem bits
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Sean Christopherson <seanjc@google.com> # KVM
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/kvm/svm/sev.c
drivers/crypto/ccp/sev-dev.c
drivers/crypto/ccp/tee-dev.c
drivers/i2c/busses/i2c-designware-amdpsp.c
drivers/tee/amdtee/call.c
drivers/tee/amdtee/shm_pool.c
include/linux/psp-sev.h
include/linux/psp.h [new file with mode: 0644]

index c25aeb550cd97fbbbae82e7f1b95a5d0f8bc8add..ec18a756b7c994fc37d87268bfe3feb72af0d764 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/kvm_host.h>
 #include <linux/kernel.h>
 #include <linux/highmem.h>
+#include <linux/psp.h>
 #include <linux/psp-sev.h>
 #include <linux/pagemap.h>
 #include <linux/swap.h>
index e2f25926eb514e477f92eac95bb7d54a4eb834b1..28945ca7c856383133c1ffc342fe4eea236c6132 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/cpufeature.h>
 #include <linux/fs.h>
 #include <linux/fs_struct.h>
+#include <linux/psp.h>
 
 #include <asm/smp.h>
 #include <asm/cacheflush.h>
index 5c9d47f3be375093fc31c96f336570555fa04df0..f24fc953718a07b0abbb54b4aba3a6a8ec61c011 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/gfp.h>
-#include <linux/psp-sev.h>
+#include <linux/psp.h>
 #include <linux/psp-tee.h>
 
 #include "psp-dev.h"
index 8f36167bce6244fd5dfc74f7612334bead5fe904..80f28a1bbbef6b621c6e0a851acf6a428ba24460 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/bits.h>
 #include <linux/i2c.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
-#include <linux/psp-sev.h>
+#include <linux/psp.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
 
index cec6e70f0ac92f30013c27669616e430f20b751a..e8cd9aaa346750fd7e47a2a861813ecb512b51b5 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/tee_drv.h>
 #include <linux/psp-tee.h>
 #include <linux/slab.h>
-#include <linux/psp-sev.h>
+#include <linux/psp.h>
 #include "amdtee_if.h"
 #include "amdtee_private.h"
 
index f87f96a291c99d68619664ecbfebbd6bbce6de5c..f0303126f199d2a922397a0d80e53d2625ba0088 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <linux/slab.h>
 #include <linux/tee_drv.h>
-#include <linux/psp-sev.h>
+#include <linux/psp.h>
 #include "amdtee_private.h"
 
 static int pool_op_alloc(struct tee_shm_pool *pool, struct tee_shm *shm,
index 1595088c428b4c0c5c7bc4e473382686ce79196e..7fd17e82bab43ff4409cf9e4c8827ff35c9df4d9 100644 (file)
 
 #include <uapi/linux/psp-sev.h>
 
-#ifdef CONFIG_X86
-#include <linux/mem_encrypt.h>
-
-#define __psp_pa(x)    __sme_pa(x)
-#else
-#define __psp_pa(x)    __pa(x)
-#endif
-
 #define SEV_FW_BLOB_MAX_SIZE   0x4000  /* 16KB */
 
 /**
diff --git a/include/linux/psp.h b/include/linux/psp.h
new file mode 100644 (file)
index 0000000..2021624
--- /dev/null
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __PSP_H
+#define __PSP_H
+
+#ifdef CONFIG_X86
+#include <linux/mem_encrypt.h>
+
+#define __psp_pa(x)    __sme_pa(x)
+#else
+#define __psp_pa(x)    __pa(x)
+#endif
+
+#endif /* __PSP_H */