* [PATCH v6 0/4] Use CCP driver to handle PSP I2C arbitration
@ 2023-03-22 21:02 Mario Limonciello
2023-03-22 21:02 ` [PATCH v6 1/4] crypto: ccp: Bump up doorbell debug messages to error Mario Limonciello
2023-03-22 21:02 ` [PATCH v6 2/4] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
0 siblings, 2 replies; 4+ messages in thread
From: Mario Limonciello @ 2023-03-22 21:02 UTC (permalink / raw)
To: Jan Dąbroś,
Grzegorz Bernacki, Mark Hasemeyer, Andy Shevchenko,
Mika Westerberg, linux-crypto, linux-i2c
Cc: Mario Limonciello, linux-kernel
The CCP driver now has symbols that can be used by i2c-designware-amdpsp
to handle the communication regarding i2c arbitration with the PSP for
both Cezanne and Mendocino based designs.
Utilize those symbols.
Mario Limonciello (4):
crypto: ccp: Bump up doorbell debug messages to error
crypto: ccp: Return doorbell status code as an argument
i2c: designware: Use PCI PSP driver for communication
i2c: designware: Add doorbell support for Mendocino
drivers/crypto/ccp/platform-access.c | 10 +-
drivers/i2c/busses/Kconfig | 3 +-
drivers/i2c/busses/i2c-designware-amdpsp.c | 196 +++++---------------
drivers/i2c/busses/i2c-designware-core.h | 1 -
drivers/i2c/busses/i2c-designware-platdrv.c | 1 -
include/linux/psp-platform-access.h | 5 +-
6 files changed, 58 insertions(+), 158 deletions(-)
base-commit: e6af5c0c4d32a27e04a56f29aad587e03ff427f1
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v6 1/4] crypto: ccp: Bump up doorbell debug messages to error
2023-03-22 21:02 [PATCH v6 0/4] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
@ 2023-03-22 21:02 ` Mario Limonciello
2023-03-22 21:02 ` [PATCH v6 2/4] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
1 sibling, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2023-03-22 21:02 UTC (permalink / raw)
To: Jan Dąbroś,
Grzegorz Bernacki, Mark Hasemeyer, Mario Limonciello,
Tom Lendacky, John Allen
Cc: Herbert Xu, David S. Miller, linux-crypto, linux-kernel
This is helpful not just for debugging problems, but also for investigating
captured logs later on.
Suggested-by: Grzegorz Bernacki <gjb@semihalf.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/crypto/ccp/platform-access.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
index b51fb1196932..3e97ce60270d 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -157,19 +157,19 @@ int psp_ring_platform_doorbell(int msg)
mutex_lock(&pa_dev->doorbell_mutex);
if (check_doorbell(button)) {
- dev_dbg(psp->dev, "doorbell is not ready\n");
+ dev_err(psp->dev, "doorbell is not ready\n");
ret = -EBUSY;
goto unlock;
}
if (check_recovery(cmd)) {
- dev_dbg(psp->dev, "doorbell command in recovery\n");
+ dev_err(psp->dev, "doorbell command in recovery\n");
ret = -EBUSY;
goto unlock;
}
if (wait_cmd(cmd)) {
- dev_dbg(psp->dev, "doorbell command not done processing\n");
+ dev_err(psp->dev, "doorbell command not done processing\n");
ret = -EBUSY;
goto unlock;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v6 2/4] crypto: ccp: Return doorbell status code as an argument
2023-03-22 21:02 [PATCH v6 0/4] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
2023-03-22 21:02 ` [PATCH v6 1/4] crypto: ccp: Bump up doorbell debug messages to error Mario Limonciello
@ 2023-03-22 21:02 ` Mario Limonciello
2023-03-27 16:26 ` Mark Hasemeyer
1 sibling, 1 reply; 4+ messages in thread
From: Mario Limonciello @ 2023-03-22 21:02 UTC (permalink / raw)
To: Jan Dąbroś,
Grzegorz Bernacki, Mark Hasemeyer, Mario Limonciello,
Tom Lendacky, John Allen
Cc: Herbert Xu, David S. Miller, linux-crypto, linux-kernel
If the doorbell failed to ring we return -EIO, but the caller can't
determine why it failed. Pass the reason for the failure in an
argument for caller to investigate.
Suggested-by: Mark Hasemeyer <markhas@chromium.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v5->v6:
* New patch
---
drivers/crypto/ccp/platform-access.c | 4 +++-
include/linux/psp-platform-access.h | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
index 3e97ce60270d..9f3d469bbe76 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -140,7 +140,7 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg,
}
EXPORT_SYMBOL_GPL(psp_send_platform_access_msg);
-int psp_ring_platform_doorbell(int msg)
+int psp_ring_platform_doorbell(int msg, u32 *result)
{
struct psp_device *psp = psp_get_master_device();
struct psp_platform_access_device *pa_dev;
@@ -184,6 +184,8 @@ int psp_ring_platform_doorbell(int msg)
val = FIELD_GET(PSP_CMDRESP_STS, ioread32(cmd));
if (val) {
+ if (result)
+ *result = val;
ret = -EIO;
goto unlock;
}
diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platform-access.h
index 89df4549fada..1b661341d8f3 100644
--- a/include/linux/psp-platform-access.h
+++ b/include/linux/psp-platform-access.h
@@ -45,9 +45,9 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg, struct psp_reques
* -%EBUSY: mailbox in recovery or in use
* -%ENODEV: driver not bound with PSP device
* -%ETIMEDOUT: request timed out
- * -%EIO: unknown error (see kernel log)
+ * -%EIO: error will be stored in result argument
*/
-int psp_ring_platform_doorbell(int msg);
+int psp_ring_platform_doorbell(int msg, u32 *result);
/**
* psp_check_platform_access_status() - Checks whether platform features is ready
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v6 2/4] crypto: ccp: Return doorbell status code as an argument
2023-03-22 21:02 ` [PATCH v6 2/4] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
@ 2023-03-27 16:26 ` Mark Hasemeyer
0 siblings, 0 replies; 4+ messages in thread
From: Mark Hasemeyer @ 2023-03-27 16:26 UTC (permalink / raw)
To: Mario Limonciello
Cc: Jan Dąbroś,
Grzegorz Bernacki, Tom Lendacky, John Allen, Herbert Xu,
David S. Miller, linux-crypto, linux-kernel
> -int psp_ring_platform_doorbell(int msg)
> +int psp_ring_platform_doorbell(int msg, u32 *result)
> {
> struct psp_device *psp = psp_get_master_device();
> struct psp_platform_access_device *pa_dev;
> @@ -184,6 +184,8 @@ int psp_ring_platform_doorbell(int msg)
>
> val = FIELD_GET(PSP_CMDRESP_STS, ioread32(cmd));
> if (val) {
> + if (result)
> + *result = val;
> ret = -EIO;
> goto unlock;
> }
The bitfields in the new mailbox architecture have changed, as it is
now a dedicated mailbox for I2C arbitration. The 8 lsbs are used for
command and response status, and bit 31 is the ready bit.
Accounting for these changes, I was able to get the TPM contention
test to pass locally. I also removed calls to "check_doorbell" and
"check_recovery" as those steps weren't described in the design doc.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-27 16:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 21:02 [PATCH v6 0/4] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
2023-03-22 21:02 ` [PATCH v6 1/4] crypto: ccp: Bump up doorbell debug messages to error Mario Limonciello
2023-03-22 21:02 ` [PATCH v6 2/4] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
2023-03-27 16:26 ` Mark Hasemeyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).