summaryrefslogtreecommitdiff
path: root/drivers/crypto/ccp/psp-dev.c
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@amd.com>2024-05-28 16:07:08 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2024-06-07 19:46:39 +0800
commit8609dd25f9b271b3338e38b018fd39e49de1e6ca (patch)
tree7fca12c516e5d021fe8219e2e026da39d0fb394e /drivers/crypto/ccp/psp-dev.c
parent56ddb9aa3b324c2d9645b5a7343e46010cf3f6ce (diff)
downloadlinux-8609dd25f9b271b3338e38b018fd39e49de1e6ca.tar.gz
linux-8609dd25f9b271b3338e38b018fd39e49de1e6ca.tar.bz2
linux-8609dd25f9b271b3338e38b018fd39e49de1e6ca.zip
crypto: ccp - Represent capabilities register as a union
Making the capabilities register a union makes it easier to refer to the members instead of always doing bit shifts. No intended functional changes. Acked-by: Tom Lendacky <thomas.lendacky@amd.com> Suggested-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/psp-dev.c')
-rw-r--r--drivers/crypto/ccp/psp-dev.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 56bf832c2947..7d9d2042be35 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -154,11 +154,10 @@ static unsigned int psp_get_capability(struct psp_device *psp)
dev_notice(psp->dev, "psp: unable to access the device: you might be running a broken BIOS.\n");
return -ENODEV;
}
- psp->capability = val;
+ psp->capability.raw = val;
/* Detect TSME and/or SME status */
- if (PSP_CAPABILITY(psp, PSP_SECURITY_REPORTING) &&
- psp->capability & (PSP_SECURITY_TSME_STATUS << PSP_CAPABILITY_PSP_SECURITY_OFFSET)) {
+ if (psp->capability.security_reporting && psp->capability.tsme_status) {
if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))
dev_notice(psp->dev, "psp: Both TSME and SME are active, SME is unnecessary when TSME is active.\n");
else
@@ -171,7 +170,7 @@ static unsigned int psp_get_capability(struct psp_device *psp)
static int psp_check_sev_support(struct psp_device *psp)
{
/* Check if device supports SEV feature */
- if (!PSP_CAPABILITY(psp, SEV)) {
+ if (!psp->capability.sev) {
dev_dbg(psp->dev, "psp does not support SEV\n");
return -ENODEV;
}
@@ -182,7 +181,7 @@ static int psp_check_sev_support(struct psp_device *psp)
static int psp_check_tee_support(struct psp_device *psp)
{
/* Check if device supports TEE feature */
- if (!PSP_CAPABILITY(psp, TEE)) {
+ if (!psp->capability.tee) {
dev_dbg(psp->dev, "psp does not support TEE\n");
return -ENODEV;
}
@@ -214,7 +213,7 @@ static int psp_init(struct psp_device *psp)
/* dbc must come after platform access as it tests the feature */
if (PSP_FEATURE(psp, DBC) ||
- PSP_CAPABILITY(psp, DBC_THRU_EXT)) {
+ psp->capability.dbc_thru_ext) {
ret = dbc_dev_init(psp);
if (ret)
return ret;