* [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration
@ 2023-04-03 18:32 Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 1/6] crypto: ccp: Drop extra doorbell checks Mario Limonciello
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Mario Limonciello @ 2023-04-03 18:32 UTC (permalink / raw)
To: Herbert Xu, Andy Shevchenko, Mika Westerberg, Jan Dabros,
linux-crypto, linux-i2c
Cc: Held Felix, linux-kernel, Mark Hasemeyer, Grzegorz Bernacki,
Mario Limonciello
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.
v7->v8:
* Pick up tags
* Drop hunk for error message change
* Fix kernel robot build failures
Mario Limonciello (6):
crypto: ccp: Drop extra doorbell checks
crypto: ccp: Bump up doorbell debug message to error
crypto: ccp: Return doorbell status code as an argument
crypto: ccp: Use lower 8 bytes to communicate with doorbell command
register
i2c: designware: Use PCI PSP driver for communication
i2c: designware: Add doorbell support for Mendocino
drivers/crypto/ccp/platform-access.c | 31 +--
drivers/i2c/busses/Kconfig | 5 +-
drivers/i2c/busses/i2c-designware-amdpsp.c | 197 +++++---------------
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, 62 insertions(+), 178 deletions(-)
base-commit: d6cb9ab4bfeaaa69147948e42d7cff080db82d07
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v8 1/6] crypto: ccp: Drop extra doorbell checks
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
@ 2023-04-03 18:32 ` Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 2/6] crypto: ccp: Bump up doorbell debug message to error Mario Limonciello
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Mario Limonciello @ 2023-04-03 18:32 UTC (permalink / raw)
To: Herbert Xu, Tom Lendacky, John Allen
Cc: Held Felix, linux-kernel, linux-i2c, Mark Hasemeyer,
Grzegorz Bernacki, Jan Dąbroś, Mario Limonciello,
David S. Miller, linux-crypto
The doorbell register set used for I2C arbitration is dedicated for this
purpose and there is no need to utilize other safety checks the platform
access register set uses.
Suggested-by: Mark Hasemeyer <markhas@chromium.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mark Hasemeyer <markhas@chromium.org>
Tested-by: Mark Hasemeyer <markhas@chromium.org>
---
drivers/crypto/ccp/platform-access.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
index b51fb1196932..1ad3a0a512b1 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -20,14 +20,6 @@
#define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC)
-/* Doorbell shouldn't be ringing */
-static int check_doorbell(u32 __iomem *doorbell)
-{
- u32 tmp;
-
- return readl_poll_timeout(doorbell, tmp, tmp != 0, 0, PSP_CMD_TIMEOUT_US);
-}
-
/* Recovery field should be equal 0 to start sending commands */
static int check_recovery(u32 __iomem *cmd)
{
@@ -156,18 +148,6 @@ 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");
- ret = -EBUSY;
- goto unlock;
- }
-
- if (check_recovery(cmd)) {
- dev_dbg(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");
ret = -EBUSY;
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v8 2/6] crypto: ccp: Bump up doorbell debug message to error
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 1/6] crypto: ccp: Drop extra doorbell checks Mario Limonciello
@ 2023-04-03 18:32 ` Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 3/6] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Mario Limonciello @ 2023-04-03 18:32 UTC (permalink / raw)
To: Herbert Xu, Tom Lendacky, John Allen
Cc: Held Felix, linux-kernel, linux-i2c, Mark Hasemeyer,
Grzegorz Bernacki, Jan Dąbroś, Mario Limonciello,
David S. Miller, linux-crypto
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>
Tested-by: Mark Hasemeyer <markhas@chromium.org>
---
drivers/crypto/ccp/platform-access.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
index 1ad3a0a512b1..1cc154a1c6ab 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -149,7 +149,7 @@ int psp_ring_platform_doorbell(int msg)
mutex_lock(&pa_dev->doorbell_mutex);
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] 10+ messages in thread
* [PATCH v8 3/6] crypto: ccp: Return doorbell status code as an argument
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 1/6] crypto: ccp: Drop extra doorbell checks Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 2/6] crypto: ccp: Bump up doorbell debug message to error Mario Limonciello
@ 2023-04-03 18:32 ` Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 4/6] crypto: ccp: Use lower 8 bytes to communicate with doorbell command register Mario Limonciello
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Mario Limonciello @ 2023-04-03 18:32 UTC (permalink / raw)
To: Herbert Xu, Tom Lendacky, John Allen
Cc: Held Felix, linux-kernel, linux-i2c, Mark Hasemeyer,
Grzegorz Bernacki, Jan Dąbroś, Mario Limonciello,
David S. Miller, linux-crypto
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>
Reviewed-by: Mark Hasemeyer <markhas@chromium.org>
Tested-by: Mark Hasemeyer <markhas@chromium.org>
---
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 1cc154a1c6ab..48f59ae91692 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -132,7 +132,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;
@@ -164,6 +164,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] 10+ messages in thread
* [PATCH v8 4/6] crypto: ccp: Use lower 8 bytes to communicate with doorbell command register
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
` (2 preceding siblings ...)
2023-04-03 18:32 ` [PATCH v8 3/6] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
@ 2023-04-03 18:32 ` Mario Limonciello
2023-04-06 6:42 ` [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Wolfram Sang
2023-04-14 11:05 ` Herbert Xu
5 siblings, 0 replies; 10+ messages in thread
From: Mario Limonciello @ 2023-04-03 18:32 UTC (permalink / raw)
To: Herbert Xu, Tom Lendacky, John Allen
Cc: Held Felix, linux-kernel, linux-i2c, Mark Hasemeyer,
Grzegorz Bernacki, Jan Dąbroś, Mario Limonciello,
David S. Miller, linux-crypto
Unlike other command registers used by the PSP, only the lower 8 bytes are
used for communication for both command and status of the command.
Suggested-by: Mark Hasemeyer <markhas@chromium.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mark Hasemeyer <markhas@chromium.org>
Tested-by: Mark Hasemeyer <markhas@chromium.org>
---
drivers/crypto/ccp/platform-access.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
index 48f59ae91692..939c924fc383 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -19,6 +19,7 @@
#include "platform-access.h"
#define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC)
+#define DOORBELL_CMDRESP_STS GENMASK(7, 0)
/* Recovery field should be equal 0 to start sending commands */
static int check_recovery(u32 __iomem *cmd)
@@ -154,7 +155,7 @@ int psp_ring_platform_doorbell(int msg, u32 *result)
goto unlock;
}
- iowrite32(FIELD_PREP(PSP_DRBL_MSG, msg), cmd);
+ iowrite32(FIELD_PREP(DOORBELL_CMDRESP_STS, msg), cmd);
iowrite32(PSP_DRBL_RING, button);
if (wait_cmd(cmd)) {
@@ -162,7 +163,7 @@ int psp_ring_platform_doorbell(int msg, u32 *result)
goto unlock;
}
- val = FIELD_GET(PSP_CMDRESP_STS, ioread32(cmd));
+ val = FIELD_GET(DOORBELL_CMDRESP_STS, ioread32(cmd));
if (val) {
if (result)
*result = val;
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
` (3 preceding siblings ...)
2023-04-03 18:32 ` [PATCH v8 4/6] crypto: ccp: Use lower 8 bytes to communicate with doorbell command register Mario Limonciello
@ 2023-04-06 6:42 ` Wolfram Sang
2023-04-06 11:58 ` Mario Limonciello
2023-04-14 11:05 ` Herbert Xu
5 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2023-04-06 6:42 UTC (permalink / raw)
To: Mario Limonciello
Cc: Herbert Xu, Andy Shevchenko, Mika Westerberg, Jan Dabros,
linux-crypto, linux-i2c, Held Felix, linux-kernel, Mark Hasemeyer,
Grzegorz Bernacki
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
On Mon, Apr 03, 2023 at 01:32:09PM -0500, Mario Limonciello wrote:
> 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.
How should this go upstream, i.e. are there dependencies? Shall I pick
the I2C patches or is it better if all goes via the crypto tree?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration
2023-04-06 6:42 ` [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Wolfram Sang
@ 2023-04-06 11:58 ` Mario Limonciello
2023-04-07 6:18 ` Wolfram Sang
0 siblings, 1 reply; 10+ messages in thread
From: Mario Limonciello @ 2023-04-06 11:58 UTC (permalink / raw)
To: Wolfram Sang, Herbert Xu, Andy Shevchenko, Mika Westerberg,
Jan Dabros, linux-crypto, linux-i2c, Held Felix, linux-kernel,
Mark Hasemeyer, Grzegorz Bernacki
On 4/6/23 01:42, Wolfram Sang wrote:
> On Mon, Apr 03, 2023 at 01:32:09PM -0500, Mario Limonciello wrote:
>> 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.
> How should this go upstream, i.e. are there dependencies? Shall I pick
> the I2C patches or is it better if all goes via the crypto tree?
>
IMO it's better to go through the crypto tree. There are dependencies
in the crypto part from the earlier series that was merged.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration
2023-04-06 11:58 ` Mario Limonciello
@ 2023-04-07 6:18 ` Wolfram Sang
2023-04-12 16:28 ` Limonciello, Mario
0 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2023-04-07 6:18 UTC (permalink / raw)
To: Mario Limonciello
Cc: Herbert Xu, Andy Shevchenko, Mika Westerberg, Jan Dabros,
linux-crypto, linux-i2c, Held Felix, linux-kernel, Mark Hasemeyer,
Grzegorz Bernacki
[-- Attachment #1: Type: text/plain, Size: 365 bytes --]
> > How should this go upstream, i.e. are there dependencies? Shall I pick
> > the I2C patches or is it better if all goes via the crypto tree?
> >
> IMO it's better to go through the crypto tree. There are dependencies
> in the crypto part from the earlier series that was merged.
Ok, fine with me. I acked the I2C patches. Thanks for the heads up.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration
2023-04-07 6:18 ` Wolfram Sang
@ 2023-04-12 16:28 ` Limonciello, Mario
0 siblings, 0 replies; 10+ messages in thread
From: Limonciello, Mario @ 2023-04-12 16:28 UTC (permalink / raw)
To: Herbert Xu
Cc: Wolfram Sang, Andy Shevchenko, Mika Westerberg, Jan Dabros,
linux-crypto, linux-i2c, Held Felix, linux-kernel, Mark Hasemeyer,
Grzegorz Bernacki
On 4/7/2023 01:18, Wolfram Sang wrote:
>
>>> How should this go upstream, i.e. are there dependencies? Shall I pick
>>> the I2C patches or is it better if all goes via the crypto tree?
>>>
>> IMO it's better to go through the crypto tree. There are dependencies
>> in the crypto part from the earlier series that was merged.
>
> Ok, fine with me. I acked the I2C patches. Thanks for the heads up.
>
Herbert,
Would you mind to queue these up for -next? I do have some other
separate work I will be submitting that is going to layer on top of
them, so I'd like to base it off your branch with these landed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
` (4 preceding siblings ...)
2023-04-06 6:42 ` [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Wolfram Sang
@ 2023-04-14 11:05 ` Herbert Xu
5 siblings, 0 replies; 10+ messages in thread
From: Herbert Xu @ 2023-04-14 11:05 UTC (permalink / raw)
To: Mario Limonciello
Cc: Andy Shevchenko, Mika Westerberg, Jan Dabros, linux-crypto,
linux-i2c, Held Felix, linux-kernel, Mark Hasemeyer,
Grzegorz Bernacki
On Mon, Apr 03, 2023 at 01:32:09PM -0500, Mario Limonciello wrote:
> 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.
>
> v7->v8:
> * Pick up tags
> * Drop hunk for error message change
> * Fix kernel robot build failures
>
> Mario Limonciello (6):
> crypto: ccp: Drop extra doorbell checks
> crypto: ccp: Bump up doorbell debug message to error
> crypto: ccp: Return doorbell status code as an argument
> crypto: ccp: Use lower 8 bytes to communicate with doorbell command
> register
> i2c: designware: Use PCI PSP driver for communication
> i2c: designware: Add doorbell support for Mendocino
>
> drivers/crypto/ccp/platform-access.c | 31 +--
> drivers/i2c/busses/Kconfig | 5 +-
> drivers/i2c/busses/i2c-designware-amdpsp.c | 197 +++++---------------
> 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, 62 insertions(+), 178 deletions(-)
>
>
> base-commit: d6cb9ab4bfeaaa69147948e42d7cff080db82d07
> --
> 2.34.1
Patches 1-4 applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-04-14 11:06 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 18:32 [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 1/6] crypto: ccp: Drop extra doorbell checks Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 2/6] crypto: ccp: Bump up doorbell debug message to error Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 3/6] crypto: ccp: Return doorbell status code as an argument Mario Limonciello
2023-04-03 18:32 ` [PATCH v8 4/6] crypto: ccp: Use lower 8 bytes to communicate with doorbell command register Mario Limonciello
2023-04-06 6:42 ` [PATCH v8 0/6] Use CCP driver to handle PSP I2C arbitration Wolfram Sang
2023-04-06 11:58 ` Mario Limonciello
2023-04-07 6:18 ` Wolfram Sang
2023-04-12 16:28 ` Limonciello, Mario
2023-04-14 11:05 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox