Prechádzať zdrojové kódy

qcedev: assign pattern info correctly

When non-pattern tests are run after pattern tests, there is
stale data from previous tests that never get erased, which
depending on crypto behavior might cause decrypt discrepancies.
Make the change to correctly set the pattern info to the
command descriptors.

Also, convert all debug logs to pr_info to avoid flooding serial
when QCE_DEBUG is enabled.

Change-Id: Ib84f4025263c622d6e51a47fc147856049bd75d4
Gaurav Kashyap 2 rokov pred
rodič
commit
3f33efa2c9
2 zmenil súbory, kde vykonal 16 pridanie a 16 odobranie
  1. 15 16
      crypto-qti/qce50.c
  2. 1 0
      crypto-qti/qcedev.c

+ 15 - 16
crypto-qti/qce50.c

@@ -204,12 +204,12 @@ static uint32_t qce_get_config_be(struct qce_device *pce_dev,
 static void dump_status_regs(unsigned int s1, unsigned int s2,unsigned int s3,
 			unsigned int s4, unsigned int s5,unsigned int s6)
 {
-	pr_err("%s: CRYPTO_STATUS_REG = 0x%x\n", __func__, s1);
-	pr_err("%s: CRYPTO_STATUS2_REG = 0x%x\n", __func__, s2);
-	pr_err("%s: CRYPTO_STATUS3_REG = 0x%x\n", __func__, s3);
-	pr_err("%s: CRYPTO_STATUS4_REG = 0x%x\n", __func__, s4);
-	pr_err("%s: CRYPTO_STATUS5_REG = 0x%x\n", __func__, s5);
-	pr_err("%s: CRYPTO_STATUS6_REG = 0x%x\n", __func__, s6);
+	pr_info("%s: CRYPTO_STATUS_REG = 0x%x\n", __func__, s1);
+	pr_info("%s: CRYPTO_STATUS2_REG = 0x%x\n", __func__, s2);
+	pr_info("%s: CRYPTO_STATUS3_REG = 0x%x\n", __func__, s3);
+	pr_info("%s: CRYPTO_STATUS4_REG = 0x%x\n", __func__, s4);
+	pr_info("%s: CRYPTO_STATUS5_REG = 0x%x\n", __func__, s5);
+	pr_info("%s: CRYPTO_STATUS6_REG = 0x%x\n", __func__, s6);
 }
 
 void qce_get_crypto_status(void *handle, unsigned int *s1, unsigned int *s2,
@@ -1121,8 +1121,7 @@ static int _ce_setup_cipher(struct qce_device *pce_dev, struct qce_req *creq,
 	if (is_offload_op(creq->offload_op)) {
 		/* pattern info */
 		pce = cmdlistinfo->pattern_info;
-		if (creq->is_pattern_valid)
-			pce->data = creq->pattern_info;
+		pce->data = creq->pattern_info;
 
 		/* block offset */
 		pce = cmdlistinfo->block_offset;
@@ -1289,11 +1288,11 @@ static void _qce_dump_descr_fifos(struct qce_device *pce_dev, int req_info)
 
 	pce_sps_data = &pce_dev->ce_request_info[req_info].ce_sps;
 	iovec = pce_sps_data->in_transfer.iovec;
-	pr_err("==============================================\n");
-	pr_err("CONSUMER (TX/IN/DEST) PIPE DESCRIPTOR\n");
-	pr_err("==============================================\n");
+	pr_info("==============================================\n");
+	pr_info("CONSUMER (TX/IN/DEST) PIPE DESCRIPTOR\n");
+	pr_info("==============================================\n");
 	for (i = 0; i <  pce_sps_data->in_transfer.iovec_count; i++) {
-		pr_err(" [%d] addr=0x%x  size=0x%x  flags=0x%x\n", i,
+		pr_info(" [%d] addr=0x%x  size=0x%x  flags=0x%x\n", i,
 					iovec->addr, iovec->size, iovec->flags);
 		if (iovec->flags & cmd_flags) {
 			struct sps_command_element *pced;
@@ -1302,7 +1301,7 @@ static void _qce_dump_descr_fifos(struct qce_device *pce_dev, int req_info)
 					(GET_VIRT_ADDR(iovec->addr));
 			ents = iovec->size/(sizeof(struct sps_command_element));
 			for (j = 0; j < ents; j++) {
-				pr_err("      [%d] [0x%x] 0x%x\n", j,
+				pr_info("      [%d] [0x%x] 0x%x\n", j,
 					pced->addr, pced->data);
 				pced++;
 			}
@@ -1310,9 +1309,9 @@ static void _qce_dump_descr_fifos(struct qce_device *pce_dev, int req_info)
 		iovec++;
 	}
 
-	pr_err("==============================================\n");
-	pr_err("PRODUCER (RX/OUT/SRC) PIPE DESCRIPTOR\n");
-	pr_err("==============================================\n");
+	pr_info("==============================================\n");
+	pr_info("PRODUCER (RX/OUT/SRC) PIPE DESCRIPTOR\n");
+	pr_info("==============================================\n");
 	iovec =  pce_sps_data->out_transfer.iovec;
 	for (i = 0; i <   pce_sps_data->out_transfer.iovec_count; i++) {
 		pr_info(" [%d] addr=0x%x  size=0x%x  flags=0x%x\n", i,

+ 1 - 0
crypto-qti/qcedev.c

@@ -517,6 +517,7 @@ static int start_offload_cipher_req(struct qcedev_control *podev,
 	u8 patt_sz = 0, proc_data_sz = 0;
 	int ret = 0;
 
+	memset(&creq, 0, sizeof(creq));
 	/* Start the command on the podev->active_command */
 	qcedev_areq = podev->active_command;
 	qcedev_areq->cipher_req.cookie = qcedev_areq->handle;