Patch "crypto: brcm - Explicity ACK mailbox message" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
crypto: brcm - Explicity ACK mailbox message
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
crypto-brcm-explicity-ack-mailbox-message.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
f0e2ce58f853634d7ad1a418a49bd5fbd556227cMon Sep 17 00:00:00 2001
From: raveendra padasalagi <[email protected]>
Date: Tue, 29 Aug 2017 15:08:10 +0530
Subject: crypto: brcm - Explicity ACK mailbox message
From: raveendra padasalagi <[email protected]>
commit f0e2ce58f853634d7ad1a418a49bd5fbd556227c upstream.
Add support to explicity ACK mailbox message because after sending message we can know the send status via error attribute of brcm_message.
This is needed to support "txdone_ack" supported in mailbox controller driver.
--- drivers/crypto/bcm/cipher.c | 101 ++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 55 deletions(-)
drivers/crypto/bcm/cipher.c +46 -55
@@ -256,6 +256,44 @@ spu_ablkcipher_tx_sg_create(struct brcm_return 0 ; } +static int mailbox_send_message (struct brcm_message *mssg,u32 flags, +u8 chan_idx) +{ +int err; +int retry_cnt =0 ; +struct device *dev = &(iproc_priv.pdev->dev); + + err =mbox_send_message (iproc_priv.mbox[chan_idx], mssg); +if (flags &CRYPTO_TFM_REQ_MAY_SLEEP ) { +while ((err == -ENOBUFS ) && (retry_cnt <SPU_MB_RETRY_MAX )) { +/* +* Mailbox queue is full. Since MAY_SLEEP is set, assume +* not in atomic context and we can wait and try again. +*/ + retry_cnt++; +usleep_range (MBOX_SLEEP_MIN ,MBOX_SLEEP_MAX ); + err =mbox_send_message (iproc_priv.mbox[chan_idx], + mssg); +atomic_inc (&iproc_priv.mb_no_spc); + } + } +if (err <0 ) { +atomic_inc (&iproc_priv.mb_send_fail); +return err; + } + +/* Check error returned by mailbox controller */ + err = mssg->error; +if (unlikely (err <0 )) { +dev_err (dev,"message error %d" , err); +/* Signal txdone for mailbox channel */ + } + +/* Signal txdone for mailbox channel */ +mbox_client_txdone (iproc_priv.mbox[chan_idx], err); +return err; +} +/** * handle_ablkcipher_req() - Submit as much of a block cipher request as fits in * a single SPU request message, starting at the current position in the request
@@ -293,7 +331,6 @@ static int handle_ablkcipher_req(structu32 pad_len;/* total length of all padding */ bool update_key = false;struct brcm_message *mssg;/* mailbox message */ -int retry_cnt =0 ;/* number of entries in src and dst sg in mailbox message. */ u8 rx_frag_num =2 ;/* response header and STATUS */
@@ -462,24 +499,9 @@ static int handle_ablkcipher_req(structif (err)return err; - err =mbox_send_message (iproc_priv.mbox[rctx->chan_idx], mssg); -if (req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ) { -while ((err == -ENOBUFS ) && (retry_cnt <SPU_MB_RETRY_MAX )) { -/* -* Mailbox queue is full. Since MAY_SLEEP is set, assume -* not in atomic context and we can wait and try again. -*/ - retry_cnt++; -usleep_range (MBOX_SLEEP_MIN ,MBOX_SLEEP_MAX ); - err =mbox_send_message (iproc_priv.mbox[rctx->chan_idx], - mssg); -atomic_inc (&iproc_priv.mb_no_spc); - } - } -if (unlikely (err <0 )) { -atomic_inc (&iproc_priv.mb_send_fail); + err =mailbox_send_message (mssg, req->base.flags, rctx->chan_idx); +if (unlikely (err <0 ))return err; - }return -EINPROGRESS ; }
@@ -710,7 +732,6 @@ static int handle_ahash_req(struct iprocu32 spu_hdr_len;unsigned int digestsize;u16 rem =0 ; -int retry_cnt =0 ;/* * number of entries in src and dst sg. Always includes SPU msg header.
@@ -904,24 +925,10 @@ static int handle_ahash_req(struct iprocif (err)return err; - err =mbox_send_message (iproc_priv.mbox[rctx->chan_idx], mssg); -if (req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ) { -while ((err == -ENOBUFS ) && (retry_cnt <SPU_MB_RETRY_MAX )) { -/* -* Mailbox queue is full. Since MAY_SLEEP is set, assume -* not in atomic context and we can wait and try again. -*/ - retry_cnt++; -usleep_range (MBOX_SLEEP_MIN ,MBOX_SLEEP_MAX ); - err =mbox_send_message (iproc_priv.mbox[rctx->chan_idx], - mssg); -atomic_inc (&iproc_priv.mb_no_spc); - } - } -if (err <0 ) { -atomic_inc (&iproc_priv.mb_send_fail); + err =mailbox_send_message (mssg, req->base.flags, rctx->chan_idx); +if (unlikely (err <0 ))return err; - } +return -EINPROGRESS ; }
@@ -1320,7 +1327,6 @@ static int handle_aead_req(struct iproc_int assoc_nents =0 ;bool incl_icv = false;unsigned int digestsize = ctx->digestsize; -int retry_cnt =0 ;/* number of entries in src and dst sg. Always includes SPU msg header. */
@@ -1558,24 +1564,9 @@ static int handle_aead_req(struct iproc_if (err)return err; - err =mbox_send_message (iproc_priv.mbox[rctx->chan_idx], mssg); -if (req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ) { -while ((err == -ENOBUFS ) && (retry_cnt <SPU_MB_RETRY_MAX )) { -/* -* Mailbox queue is full. Since MAY_SLEEP is set, assume -* not in atomic context and we can wait and try again. -*/ - retry_cnt++; -usleep_range (MBOX_SLEEP_MIN ,MBOX_SLEEP_MAX ); - err =mbox_send_message (iproc_priv.mbox[rctx->chan_idx], - mssg); -atomic_inc (&iproc_priv.mb_no_spc); - } - } -if (err <0 ) { -atomic_inc (&iproc_priv.mb_send_fail); + err =mailbox_send_message (mssg, req->base.flags, rctx->chan_idx); +if (unlikely (err <0 ))return err; - }return -EINPROGRESS ; }
@@ -4537,7 +4528,7 @@ static int spu_mb_init(struct device *de mcl->dev = dev; mcl->tx_block = false; mcl->tx_tout =0 ; - mcl->knows_txdone = false; + mcl->knows_txdone = true; mcl->rx_callback = spu_rx_callback; mcl->tx_done =NULL ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/crypto-brcm-explicity-ack-mailbox-message.patch