crypto/nx: Add P9 NX specific error codes for 842 engine
authorHaren Myneni <haren@linux.vnet.ibm.com>
Thu, 31 Aug 2017 07:18:18 +0000 (00:18 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 1 Sep 2017 06:42:50 +0000 (16:42 +1000)
This patch adds changes for checking P9 specific 842 engine
error codes. These errros are reported in coprocessor status
block (CSB) for failures.

Signed-off-by: Haren Myneni <haren@us.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/icswx.h
drivers/crypto/nx/nx-842-powernv.c
drivers/crypto/nx/nx-842.h

index 27e588f6c72eec75b1a4f2644272ac16ebd4d7dd..6a2c875775419b523cd1edbb53205e042cdcccfa 100644 (file)
@@ -69,7 +69,10 @@ struct coprocessor_completion_block {
 #define CSB_CC_WR_PROTECTION   (16)
 #define CSB_CC_UNKNOWN_CODE    (17)
 #define CSB_CC_ABORT           (18)
+#define CSB_CC_EXCEED_BYTE_COUNT       (19)    /* P9 or later */
 #define CSB_CC_TRANSPORT       (20)
+#define CSB_CC_INVALID_CRB     (21)    /* P9 or later */
+#define CSB_CC_INVALID_DDE     (30)    /* P9 or later */
 #define CSB_CC_SEGMENTED_DDL   (31)
 #define CSB_CC_PROGRESS_POINT  (32)
 #define CSB_CC_DDE_OVERFLOW    (33)
index 829b5cad0043cdb7784143c37c94ec1b9594bf28..c0dd4c7e17d3423e5850a79cd2196f6ea8456ce5 100644 (file)
@@ -243,6 +243,13 @@ static int wait_for_csb(struct nx842_workmem *wmem,
        case CSB_CC_TEMPL_OVERFLOW:
                CSB_ERR(csb, "Compressed data template shows data past end");
                return -EINVAL;
+       case CSB_CC_EXCEED_BYTE_COUNT:  /* P9 or later */
+               /*
+                * DDE byte count exceeds the limit specified in Maximum
+                * byte count register.
+                */
+               CSB_ERR(csb, "DDE byte count exceeds the limit");
+               return -EINVAL;
 
        /* these should not happen */
        case CSB_CC_INVALID_ALIGN:
@@ -284,9 +291,17 @@ static int wait_for_csb(struct nx842_workmem *wmem,
                CSB_ERR(csb, "Too many DDEs in DDL");
                return -EINVAL;
        case CSB_CC_TRANSPORT:
+       case CSB_CC_INVALID_CRB:        /* P9 or later */
                /* shouldn't happen, we setup CRB correctly */
                CSB_ERR(csb, "Invalid CRB");
                return -EINVAL;
+       case CSB_CC_INVALID_DDE:        /* P9 or later */
+               /*
+                * shouldn't happen, setup_direct/indirect_dde creates
+                * DDE right
+                */
+               CSB_ERR(csb, "Invalid DDE");
+               return -EINVAL;
        case CSB_CC_SEGMENTED_DDL:
                /* shouldn't happen, setup_ddl creates DDL right */
                CSB_ERR(csb, "Segmented DDL error");
@@ -330,6 +345,9 @@ static int wait_for_csb(struct nx842_workmem *wmem,
        case CSB_CC_HW:
                CSB_ERR(csb, "Correctable hardware error");
                return -EPROTO;
+       case CSB_CC_HW_EXPIRED_TIMER:   /* P9 or later */
+               CSB_ERR(csb, "Job did not finish within allowed time");
+               return -EPROTO;
 
        default:
                CSB_ERR(csb, "Invalid CC %d", csb->cc);
index 30929bd7d1a93afbffb1fe65ada0ea6864ef7fc4..bb2f317926838e01e09318ccb2593d380b9119ec 100644 (file)
 #define CSB_CC_DECRYPT_OVERFLOW        (64)
 /* asym crypt codes */
 #define CSB_CC_MINV_OVERFLOW   (128)
+/*
+ * HW error - Job did not finish in the maximum time allowed.
+ * Job terminated.
+ */
+#define CSB_CC_HW_EXPIRED_TIMER                (224)
 /* These are reserved for hypervisor use */
 #define CSB_CC_HYP_RESERVE_START       (240)
 #define CSB_CC_HYP_RESERVE_END         (253)
+#define CSB_CC_HYP_RESERVE_P9_END      (251)
+/* No valid interrupt server (P9 or later). */
+#define CSB_CC_HYP_RESERVE_NO_INTR_SERVER      (252)
 #define CSB_CC_HYP_NO_HW               (254)
 #define CSB_CC_HYP_HANG_ABORTED                (255)