@@ -146,7 +146,7 @@ static int hisi_zip_start_qp(struct hisi_qp *qp, struct hisi_zip_qp_ctx *ctx,
146146
147147 ret = hisi_qm_start_qp (qp , 0 );
148148 if (ret < 0 ) {
149- dev_err (dev , "start qp failed !\n" );
149+ dev_err (dev , "failed to start qp (%d) !\n" , ret );
150150 return ret ;
151151 }
152152
@@ -169,7 +169,7 @@ static int hisi_zip_ctx_init(struct hisi_zip_ctx *hisi_zip_ctx, u8 req_type, int
169169
170170 ret = zip_create_qps (qps , HZIP_CTX_Q_NUM , node );
171171 if (ret ) {
172- pr_err ("Can not create zip qps!\n" );
172+ pr_err ("failed to create zip qps (%d) !\n" , ret );
173173 return - ENODEV ;
174174 }
175175
@@ -380,19 +380,28 @@ static int hisi_zip_acomp_init(struct crypto_acomp *tfm)
380380{
381381 const char * alg_name = crypto_tfm_alg_name (& tfm -> base );
382382 struct hisi_zip_ctx * ctx = crypto_tfm_ctx (& tfm -> base );
383+ struct device * dev ;
383384 int ret ;
384385
385386 ret = hisi_zip_ctx_init (ctx , COMP_NAME_TO_TYPE (alg_name ), tfm -> base .node );
386- if (ret )
387+ if (ret ) {
388+ pr_err ("failed to init ctx (%d)!\n" , ret );
387389 return ret ;
390+ }
391+
392+ dev = & ctx -> qp_ctx [0 ].qp -> qm -> pdev -> dev ;
388393
389394 ret = hisi_zip_create_req_q (ctx );
390- if (ret )
395+ if (ret ) {
396+ dev_err (dev , "failed to create request queue (%d)!\n" , ret );
391397 goto err_ctx_exit ;
398+ }
392399
393400 ret = hisi_zip_create_sgl_pool (ctx );
394- if (ret )
401+ if (ret ) {
402+ dev_err (dev , "failed to create sgl pool (%d)!\n" , ret );
395403 goto err_release_req_q ;
404+ }
396405
397406 hisi_zip_set_acomp_cb (ctx , hisi_zip_acomp_cb );
398407
@@ -422,8 +431,10 @@ static int add_comp_head(struct scatterlist *dst, u8 req_type)
422431 int ret ;
423432
424433 ret = sg_copy_from_buffer (dst , sg_nents (dst ), head , head_size );
425- if (ret != head_size )
434+ if (ret != head_size ) {
435+ pr_err ("the head size of buffer is wrong (%d)!\n" , ret );
426436 return - ENOMEM ;
437+ }
427438
428439 return head_size ;
429440}
@@ -504,14 +515,19 @@ static int hisi_zip_do_work(struct hisi_zip_req *req,
504515
505516 req -> hw_src = hisi_acc_sg_buf_map_to_hw_sgl (dev , a_req -> src , pool ,
506517 req -> req_id << 1 , & input );
507- if (IS_ERR (req -> hw_src ))
518+ if (IS_ERR (req -> hw_src )) {
519+ dev_err (dev , "failed to map the src buffer to hw sgl (%ld)!\n" ,
520+ PTR_ERR (req -> hw_src ));
508521 return PTR_ERR (req -> hw_src );
522+ }
509523 req -> dma_src = input ;
510524
511525 req -> hw_dst = hisi_acc_sg_buf_map_to_hw_sgl (dev , a_req -> dst , pool ,
512526 (req -> req_id << 1 ) + 1 ,
513527 & output );
514528 if (IS_ERR (req -> hw_dst )) {
529+ dev_err (dev , "failed to map the dst buffer to hw slg (%ld)!\n" ,
530+ PTR_ERR (req -> hw_dst ));
515531 ret = PTR_ERR (req -> hw_dst );
516532 goto err_unmap_input ;
517533 }
@@ -527,6 +543,7 @@ static int hisi_zip_do_work(struct hisi_zip_req *req,
527543 ret = hisi_qp_send (qp , & zip_sqe );
528544 if (ret < 0 ) {
529545 atomic64_inc (& dfx -> send_busy_cnt );
546+ dev_dbg_ratelimited (dev , "failed to send request!\n" );
530547 goto err_unmap_output ;
531548 }
532549
@@ -543,22 +560,28 @@ static int hisi_zip_acompress(struct acomp_req *acomp_req)
543560{
544561 struct hisi_zip_ctx * ctx = crypto_tfm_ctx (acomp_req -> base .tfm );
545562 struct hisi_zip_qp_ctx * qp_ctx = & ctx -> qp_ctx [HZIP_QPC_COMP ];
563+ struct device * dev = & qp_ctx -> qp -> qm -> pdev -> dev ;
546564 struct hisi_zip_req * req ;
547565 int head_size ;
548566 int ret ;
549567
550568 /* let's output compression head now */
551569 head_size = add_comp_head (acomp_req -> dst , qp_ctx -> qp -> req_type );
552- if (head_size < 0 )
553- return - ENOMEM ;
570+ if (head_size < 0 ) {
571+ dev_err_ratelimited (dev , "failed to add comp head (%d)!\n" ,
572+ head_size );
573+ return head_size ;
574+ }
554575
555576 req = hisi_zip_create_req (acomp_req , qp_ctx , (size_t )head_size , true);
556577 if (IS_ERR (req ))
557578 return PTR_ERR (req );
558579
559580 ret = hisi_zip_do_work (req , qp_ctx );
560- if (ret != - EINPROGRESS )
581+ if (ret != - EINPROGRESS ) {
582+ dev_info_ratelimited (dev , "failed to do compress (%d)!\n" , ret );
561583 hisi_zip_remove_req (qp_ctx , req );
584+ }
562585
563586 return ret ;
564587}
@@ -567,6 +590,7 @@ static int hisi_zip_adecompress(struct acomp_req *acomp_req)
567590{
568591 struct hisi_zip_ctx * ctx = crypto_tfm_ctx (acomp_req -> base .tfm );
569592 struct hisi_zip_qp_ctx * qp_ctx = & ctx -> qp_ctx [HZIP_QPC_DECOMP ];
593+ struct device * dev = & qp_ctx -> qp -> qm -> pdev -> dev ;
570594 struct hisi_zip_req * req ;
571595 size_t head_size ;
572596 int ret ;
@@ -578,8 +602,11 @@ static int hisi_zip_adecompress(struct acomp_req *acomp_req)
578602 return PTR_ERR (req );
579603
580604 ret = hisi_zip_do_work (req , qp_ctx );
581- if (ret != - EINPROGRESS )
605+ if (ret != - EINPROGRESS ) {
606+ dev_info_ratelimited (dev , "failed to do decompress (%d)!\n" ,
607+ ret );
582608 hisi_zip_remove_req (qp_ctx , req );
609+ }
583610
584611 return ret ;
585612}
@@ -618,13 +645,13 @@ int hisi_zip_register_to_crypto(void)
618645
619646 ret = crypto_register_acomp (& hisi_zip_acomp_zlib );
620647 if (ret ) {
621- pr_err ("Zlib acomp algorithm registration failed \n" );
648+ pr_err ("failed to register to zlib (%d)! \n" , ret );
622649 return ret ;
623650 }
624651
625652 ret = crypto_register_acomp (& hisi_zip_acomp_gzip );
626653 if (ret ) {
627- pr_err ("Gzip acomp algorithm registration failed \n" );
654+ pr_err ("failed to register to gzip (%d)! \n" , ret );
628655 crypto_unregister_acomp (& hisi_zip_acomp_zlib );
629656 }
630657
0 commit comments