OP-TEE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Export platform features from ccp driver
@ 2023-03-03 16:50 Mario Limonciello
  2023-03-03 16:50 ` [PATCH v3 2/9] crypto: ccp: Add a header for multiple drivers to use `__psp_pa` Mario Limonciello
  2023-03-03 20:58 ` [PATCH v3 0/9] Export platform features from ccp driver Tom Lendacky
  0 siblings, 2 replies; 4+ messages in thread
From: Mario Limonciello @ 2023-03-03 16:50 UTC (permalink / raw)
  To: op-tee

[-- Attachment #1: Type: text/plain, Size: 2415 bytes --]

The i2c-designware-amdpsp driver communicates with a platform
features mailbox provided by the PSP.  The address used for
communication is discovered via a non-architecturally
guaranteed mechanism.

To better scale, export a feature for communication with platform
features directly from the ccp driver.

v2->v3:
 * Split new ACPI ID to own patch
 * Squash doorbell offsets into doorbell patch
 * Fix all feedback from v2 (see individual patches for details)
Mario Limonciello (9):
  crypto: ccp: Drop TEE support for IRQ handler
  crypto: ccp: Add a header for multiple drivers to use `__psp_pa`
  crypto: ccp: Move some PSP mailbox bit definitions into common header
  crypto: ccp: Add support for an interface for platform features
  crypto: ccp: Enable platform access interface on client PSP parts
  i2c: designware: Use PCI PSP driver for communication
  crypto: ccp: Add support for ringing a platform doorbell
  i2c: designware: Add doorbell support for Skyrim
  i2c: designware: Add support for AMDI0020 ACPI ID

 arch/x86/kvm/svm/sev.c                      |   1 +
 drivers/crypto/ccp/Makefile                 |   3 +-
 drivers/crypto/ccp/platform-access.c        | 218 ++++++++++++++++++++
 drivers/crypto/ccp/platform-access.h        |  35 ++++
 drivers/crypto/ccp/psp-dev.c                |  32 +--
 drivers/crypto/ccp/psp-dev.h                |  11 +-
 drivers/crypto/ccp/sev-dev.c                |  16 +-
 drivers/crypto/ccp/sev-dev.h                |   2 +-
 drivers/crypto/ccp/sp-dev.h                 |  10 +
 drivers/crypto/ccp/sp-pci.c                 |   9 +
 drivers/crypto/ccp/tee-dev.c                |  17 +-
 drivers/i2c/busses/Kconfig                  |   2 +-
 drivers/i2c/busses/i2c-designware-amdpsp.c  | 179 +++-------------
 drivers/i2c/busses/i2c-designware-core.h    |   1 -
 drivers/i2c/busses/i2c-designware-platdrv.c |   2 +-
 drivers/tee/amdtee/call.c                   |   2 +-
 drivers/tee/amdtee/shm_pool.c               |   2 +-
 include/linux/psp-platform-access.h         |  65 ++++++
 include/linux/psp-sev.h                     |   8 -
 include/linux/psp.h                         |  29 +++
 20 files changed, 438 insertions(+), 206 deletions(-)
 create mode 100644 drivers/crypto/ccp/platform-access.c
 create mode 100644 drivers/crypto/ccp/platform-access.h
 create mode 100644 include/linux/psp-platform-access.h
 create mode 100644 include/linux/psp.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 2/9] crypto: ccp: Add a header for multiple drivers to use `__psp_pa`
  2023-03-03 16:50 [PATCH v3 0/9] Export platform features from ccp driver Mario Limonciello
@ 2023-03-03 16:50 ` Mario Limonciello
  2023-03-07 23:42   ` Sean Christopherson
  2023-03-03 20:58 ` [PATCH v3 0/9] Export platform features from ccp driver Tom Lendacky
  1 sibling, 1 reply; 4+ messages in thread
From: Mario Limonciello @ 2023-03-03 16:50 UTC (permalink / raw)
  To: op-tee

[-- Attachment #1: Type: text/plain, Size: 4405 bytes --]

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
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Add tags
---
 arch/x86/kvm/svm/sev.c                     |  1 +
 drivers/crypto/ccp/sev-dev.c               |  1 +
 drivers/crypto/ccp/tee-dev.c               |  2 +-
 drivers/i2c/busses/i2c-designware-amdpsp.c |  2 +-
 drivers/tee/amdtee/call.c                  |  2 +-
 drivers/tee/amdtee/shm_pool.c              |  2 +-
 include/linux/psp-sev.h                    |  8 --------
 include/linux/psp.h                        | 14 ++++++++++++++
 8 files changed, 20 insertions(+), 12 deletions(-)
 create mode 100644 include/linux/psp.h

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index c25aeb550cd9..ec18a756b7c9 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -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>
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index e2f25926eb51..28945ca7c856 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -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>
diff --git a/drivers/crypto/ccp/tee-dev.c b/drivers/crypto/ccp/tee-dev.c
index 5c9d47f3be37..f24fc953718a 100644
--- a/drivers/crypto/ccp/tee-dev.c
+++ b/drivers/crypto/ccp/tee-dev.c
@@ -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"
diff --git a/drivers/i2c/busses/i2c-designware-amdpsp.c b/drivers/i2c/busses/i2c-designware-amdpsp.c
index 8f36167bce62..80f28a1bbbef 100644
--- a/drivers/i2c/busses/i2c-designware-amdpsp.c
+++ b/drivers/i2c/busses/i2c-designware-amdpsp.c
@@ -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>
 
diff --git a/drivers/tee/amdtee/call.c b/drivers/tee/amdtee/call.c
index cec6e70f0ac9..e8cd9aaa3467 100644
--- a/drivers/tee/amdtee/call.c
+++ b/drivers/tee/amdtee/call.c
@@ -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"
 
diff --git a/drivers/tee/amdtee/shm_pool.c b/drivers/tee/amdtee/shm_pool.c
index f87f96a291c9..f0303126f199 100644
--- a/drivers/tee/amdtee/shm_pool.c
+++ b/drivers/tee/amdtee/shm_pool.c
@@ -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,
diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
index 1595088c428b..7fd17e82bab4 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -14,14 +14,6 @@
 
 #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
index 000000000000..202162487ec3
--- /dev/null
+++ b/include/linux/psp.h
@@ -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 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 0/9] Export platform features from ccp driver
  2023-03-03 16:50 [PATCH v3 0/9] Export platform features from ccp driver Mario Limonciello
  2023-03-03 16:50 ` [PATCH v3 2/9] crypto: ccp: Add a header for multiple drivers to use `__psp_pa` Mario Limonciello
@ 2023-03-03 20:58 ` Tom Lendacky
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2023-03-03 20:58 UTC (permalink / raw)
  To: op-tee

[-- Attachment #1: Type: text/plain, Size: 2716 bytes --]

On 3/3/23 10:50, Mario Limonciello wrote:
> The i2c-designware-amdpsp driver communicates with a platform
> features mailbox provided by the PSP.  The address used for
> communication is discovered via a non-architecturally
> guaranteed mechanism.
> 
> To better scale, export a feature for communication with platform
> features directly from the ccp driver.
> 

If there is agreement with Jan and Grzegorz for patches 7-9, I'm ok with 
the rest.

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

> v2->v3:
>   * Split new ACPI ID to own patch
>   * Squash doorbell offsets into doorbell patch
>   * Fix all feedback from v2 (see individual patches for details)
> Mario Limonciello (9):
>    crypto: ccp: Drop TEE support for IRQ handler
>    crypto: ccp: Add a header for multiple drivers to use `__psp_pa`
>    crypto: ccp: Move some PSP mailbox bit definitions into common header
>    crypto: ccp: Add support for an interface for platform features
>    crypto: ccp: Enable platform access interface on client PSP parts
>    i2c: designware: Use PCI PSP driver for communication
>    crypto: ccp: Add support for ringing a platform doorbell
>    i2c: designware: Add doorbell support for Skyrim
>    i2c: designware: Add support for AMDI0020 ACPI ID
> 
>   arch/x86/kvm/svm/sev.c                      |   1 +
>   drivers/crypto/ccp/Makefile                 |   3 +-
>   drivers/crypto/ccp/platform-access.c        | 218 ++++++++++++++++++++
>   drivers/crypto/ccp/platform-access.h        |  35 ++++
>   drivers/crypto/ccp/psp-dev.c                |  32 +--
>   drivers/crypto/ccp/psp-dev.h                |  11 +-
>   drivers/crypto/ccp/sev-dev.c                |  16 +-
>   drivers/crypto/ccp/sev-dev.h                |   2 +-
>   drivers/crypto/ccp/sp-dev.h                 |  10 +
>   drivers/crypto/ccp/sp-pci.c                 |   9 +
>   drivers/crypto/ccp/tee-dev.c                |  17 +-
>   drivers/i2c/busses/Kconfig                  |   2 +-
>   drivers/i2c/busses/i2c-designware-amdpsp.c  | 179 +++-------------
>   drivers/i2c/busses/i2c-designware-core.h    |   1 -
>   drivers/i2c/busses/i2c-designware-platdrv.c |   2 +-
>   drivers/tee/amdtee/call.c                   |   2 +-
>   drivers/tee/amdtee/shm_pool.c               |   2 +-
>   include/linux/psp-platform-access.h         |  65 ++++++
>   include/linux/psp-sev.h                     |   8 -
>   include/linux/psp.h                         |  29 +++
>   20 files changed, 438 insertions(+), 206 deletions(-)
>   create mode 100644 drivers/crypto/ccp/platform-access.c
>   create mode 100644 drivers/crypto/ccp/platform-access.h
>   create mode 100644 include/linux/psp-platform-access.h
>   create mode 100644 include/linux/psp.h
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/9] crypto: ccp: Add a header for multiple drivers to use `__psp_pa`
  2023-03-03 16:50 ` [PATCH v3 2/9] crypto: ccp: Add a header for multiple drivers to use `__psp_pa` Mario Limonciello
@ 2023-03-07 23:42   ` Sean Christopherson
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2023-03-07 23:42 UTC (permalink / raw)
  To: op-tee

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

On Fri, Mar 03, 2023, Mario Limonciello wrote:
> 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
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---

Acked-by: Sean Christopherson <seanjc@google.com> # KVM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-07 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-03 16:50 [PATCH v3 0/9] Export platform features from ccp driver Mario Limonciello
2023-03-03 16:50 ` [PATCH v3 2/9] crypto: ccp: Add a header for multiple drivers to use `__psp_pa` Mario Limonciello
2023-03-07 23:42   ` Sean Christopherson
2023-03-03 20:58 ` [PATCH v3 0/9] Export platform features from ccp driver Tom Lendacky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox