crypto: ccp - Return doorbell status code as an argument
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 3 Apr 2023 18:32:12 +0000 (13:32 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Apr 2023 10:59:34 +0000 (18:59 +0800)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/platform-access.c
include/linux/psp-platform-access.h

index 1cc154a..48f59ae 100644 (file)
@@ -132,7 +132,7 @@ unlock:
 }
 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;
        }
index 89df454..1b66134 100644 (file)
@@ -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