qcedev: add gpce key pause error conditions
Add support in the qcedev driver to detect KEY_PAUSE error conditions and report accordingly to userspace. Change-Id: Id7bbde02ca4d08917bcf21d6f62e21f3c71abc7b
This commit is contained in:
@@ -85,7 +85,7 @@ static LIST_HEAD(qce50_bam_list);
|
|||||||
#define TOTAL_IOVEC_SPACE_PER_PIPE (QCE_MAX_NUM_DSCR * sizeof(struct sps_iovec))
|
#define TOTAL_IOVEC_SPACE_PER_PIPE (QCE_MAX_NUM_DSCR * sizeof(struct sps_iovec))
|
||||||
|
|
||||||
#define AES_CTR_IV_CTR_SIZE 64
|
#define AES_CTR_IV_CTR_SIZE 64
|
||||||
#define EXPECTED_STATUS1_REG_VAL 0x2000006
|
#define STATUS1_ERR_INTR_MASK 0x10
|
||||||
|
|
||||||
enum qce_owner {
|
enum qce_owner {
|
||||||
QCE_OWNER_NONE = 0,
|
QCE_OWNER_NONE = 0,
|
||||||
@@ -228,7 +228,7 @@ void qce_get_crypto_status(void *handle, unsigned int *s1, unsigned int *s2,
|
|||||||
#ifdef QCE_DEBUG
|
#ifdef QCE_DEBUG
|
||||||
dump_status_regs(*s1, *s2, *s3, *s4, *s5, *s6);
|
dump_status_regs(*s1, *s2, *s3, *s4, *s5, *s6);
|
||||||
#else
|
#else
|
||||||
if (*s1 != EXPECTED_STATUS1_REG_VAL)
|
if (*s1 & STATUS1_ERR_INTR_MASK)
|
||||||
dump_status_regs(*s1, *s2, *s3, *s4, *s5, *s6);
|
dump_status_regs(*s1, *s2, *s3, *s4, *s5, *s6);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@@ -57,8 +57,16 @@ static uint8_t _std_init_vector_sha256_uint8[] = {
|
|||||||
#define QCEDEV_CTX_USE_HW_KEY 0x00000001
|
#define QCEDEV_CTX_USE_HW_KEY 0x00000001
|
||||||
#define QCEDEV_CTX_USE_PIPE_KEY 0x00000002
|
#define QCEDEV_CTX_USE_PIPE_KEY 0x00000002
|
||||||
|
|
||||||
#define QCEDEV_PIPE_KEY_TIMER1_EXPIRED_VEC_MASK 0x000000FF
|
// Key timer expiry for pipes 1-15 (Status3)
|
||||||
#define QCEDEV_PIPE_KEY_TIMER2_EXPIRED_VEC_MASK 0x00000003
|
#define PIPE_KEY_TIMER_EXPIRED_STATUS3_MASK 0x000000FF
|
||||||
|
// Key timer expiry for pipes 16-19 (Status6)
|
||||||
|
#define PIPE_KEY_TIMER_EXPIRED_STATUS6_MASK 0x00000003
|
||||||
|
// Key pause for pipes 1-15 (Status3)
|
||||||
|
#define PIPE_KEY_PAUSE_STATUS3_MASK 0xFF0000
|
||||||
|
// Key pause for pipes 16-19 (Status6)
|
||||||
|
#define PIPE_KEY_PAUSE_STATUS6_MASK 0x30000
|
||||||
|
|
||||||
|
#define QCEDEV_STATUS1_ERR_INTR_MASK 0x10
|
||||||
|
|
||||||
static DEFINE_MUTEX(send_cmd_lock);
|
static DEFINE_MUTEX(send_cmd_lock);
|
||||||
static DEFINE_MUTEX(qcedev_sent_bw_req);
|
static DEFINE_MUTEX(qcedev_sent_bw_req);
|
||||||
@@ -678,18 +686,41 @@ static void qcedev_check_crypto_status(
|
|||||||
pr_err("%s: sts = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __func__,
|
pr_err("%s: sts = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __func__,
|
||||||
s1, s2, s3, s4, s5, s6);
|
s1, s2, s3, s4, s5, s6);
|
||||||
}
|
}
|
||||||
if ((s6 & QCEDEV_PIPE_KEY_TIMER2_EXPIRED_VEC_MASK) ||
|
|
||||||
(s3 & QCEDEV_PIPE_KEY_TIMER1_EXPIRED_VEC_MASK)) {
|
// Check for key timer expiry
|
||||||
|
if ((s6 & PIPE_KEY_TIMER_EXPIRED_STATUS6_MASK) ||
|
||||||
|
(s3 & PIPE_KEY_TIMER_EXPIRED_STATUS3_MASK)) {
|
||||||
pr_info("%s: crypto timer expired\n", __func__);
|
pr_info("%s: crypto timer expired\n", __func__);
|
||||||
pr_info("%s: sts = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __func__,
|
pr_info("%s: sts = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __func__,
|
||||||
s1, s2, s3, s4, s5, s6);
|
s1, s2, s3, s4, s5, s6);
|
||||||
qcedev_areq->offload_cipher_op_req.err =
|
qcedev_areq->offload_cipher_op_req.err =
|
||||||
QCEDEV_OFFLOAD_TIMER_ERROR;
|
QCEDEV_OFFLOAD_KEY_TIMER_EXPIRED_ERROR;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for key pause
|
||||||
|
if ((s6 & PIPE_KEY_PAUSE_STATUS6_MASK) ||
|
||||||
|
(s3 & PIPE_KEY_PAUSE_STATUS3_MASK)) {
|
||||||
|
pr_info("%s: crypto key paused\n", __func__);
|
||||||
|
pr_info("%s: sts = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __func__,
|
||||||
|
s1, s2, s3, s4, s5, s6);
|
||||||
|
qcedev_areq->offload_cipher_op_req.err =
|
||||||
|
QCEDEV_OFFLOAD_KEY_PAUSE_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for generic error
|
||||||
|
if (s1 & QCEDEV_STATUS1_ERR_INTR_MASK) {
|
||||||
|
pr_err("%s: generic crypto error\n", __func__);
|
||||||
|
pr_info("%s: sts = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __func__,
|
||||||
|
s1, s2, s3, s4, s5, s6);
|
||||||
|
qcedev_areq->offload_cipher_op_req.err =
|
||||||
|
QCEDEV_OFFLOAD_GENERIC_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static int submit_req(struct qcedev_async_req *qcedev_areq,
|
static int submit_req(struct qcedev_async_req *qcedev_areq,
|
||||||
struct qcedev_handle *handle)
|
struct qcedev_handle *handle)
|
||||||
{
|
{
|
||||||
@@ -743,6 +774,9 @@ static int submit_req(struct qcedev_async_req *qcedev_areq,
|
|||||||
print_sts = true;
|
print_sts = true;
|
||||||
qcedev_check_crypto_status(qcedev_areq, podev->qce, print_sts);
|
qcedev_check_crypto_status(qcedev_areq, podev->qce, print_sts);
|
||||||
qce_manage_timeout(podev->qce, current_req_info);
|
qce_manage_timeout(podev->qce, current_req_info);
|
||||||
|
if (qcedev_areq->offload_cipher_op_req.err !=
|
||||||
|
QCEDEV_OFFLOAD_NO_ERROR)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@@ -58,12 +58,14 @@ enum qcedev_offload_oper_enum {
|
|||||||
*qcedev_offload_err_enum: Offload error conditions
|
*qcedev_offload_err_enum: Offload error conditions
|
||||||
* @QCEDEV_OFFLOAD_NO_ERROR: Successful crypto operation.
|
* @QCEDEV_OFFLOAD_NO_ERROR: Successful crypto operation.
|
||||||
* @QCEDEV_OFFLOAD_GENERIC_ERROR: Generic error in crypto status.
|
* @QCEDEV_OFFLOAD_GENERIC_ERROR: Generic error in crypto status.
|
||||||
* @QCEDEV_OFFLOAD_TIMER_ERROR: Pipe key timer errors in crypto status.
|
* @QCEDEV_OFFLOAD_TIMER_EXPIRED_ERROR: Pipe key timer expired.
|
||||||
|
* @QCEDEV_OFFLOAD_KEY_PAUSE_ERROR: Pipe key pause (means GPCE is paused).
|
||||||
*/
|
*/
|
||||||
enum qcedev_offload_err_enum {
|
enum qcedev_offload_err_enum {
|
||||||
QCEDEV_OFFLOAD_NO_ERROR = 0,
|
QCEDEV_OFFLOAD_NO_ERROR = 0,
|
||||||
QCEDEV_OFFLOAD_GENERIC_ERROR = 1,
|
QCEDEV_OFFLOAD_GENERIC_ERROR = 1,
|
||||||
QCEDEV_OFFLOAD_TIMER_ERROR = 2
|
QCEDEV_OFFLOAD_KEY_TIMER_EXPIRED_ERROR = 2,
|
||||||
|
QCEDEV_OFFLOAD_KEY_PAUSE_ERROR = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user