From: "Gonglei (Arei)" Subject: RE: [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver Date: Thu, 15 Dec 2016 00:45:27 +0000 Message-ID: <33183CC9F5247A488A2544077AF19020DA163033@DGGEMA505-MBX.china.huawei.com> References: <1481716249-185392-1-git-send-email-arei.gonglei@huawei.com> <1481716249-185392-2-git-send-email-arei.gonglei@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: "Xuquan \(Quan Xu\)" , "Huangweidong \(C\)" , "herbert@gondor.apana.org.au" , "Hanweidong \(Randy\)" , Claudio Fontana , "mst@redhat.com" , Luonengjun , "Wanzongshun \(Vincent\)" , "stefanha@redhat.com" , "Zhoujian \(jay, Euler\)" , longpeng , "davem@davemloft.net" , "Wubin \(H\)" , "arei.gonglei@hotmail.com" To: Halil Pasic , "linux-kernel@vger.kernel.org" , "qemu-devel@nongnu.org" , "virtio-dev@lists.oasis-open.org" , "virtualization@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" Return-path: In-Reply-To: Content-Language: zh-CN List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: linux-crypto.vger.kernel.org > > > On 12/14/2016 12:50 PM, Gonglei wrote: > > diff --git a/drivers/crypto/virtio/virtio_crypto_core.c > b/drivers/crypto/virtio/virtio_crypto_core.c > > new file mode 100644 > > index 0000000..c0854a1 > > --- /dev/null > > +++ b/drivers/crypto/virtio/virtio_crypto_core.c > > @@ -0,0 +1,474 @@ > [..] > > + > > +static void virtcrypto_dataq_callback(struct virtqueue *vq) > > +{ > > + struct virtio_crypto *vcrypto = vq->vdev->priv; > > + struct virtio_crypto_request *vc_req; > > + unsigned long flags; > > + unsigned int len; > > + struct ablkcipher_request *ablk_req; > > + int error; > > + > > + spin_lock_irqsave(&vcrypto->lock, flags); > > Would it make sense to use a per virtqueue lock > like in virtio_blk for example instead of locking on the whole > device? OK, it seems you use only one dataqueue, so it > may not be that relevant. > Currently yes, both the backend device (cryptodev-backend-builtin) and the frontend driver use one dataqueue. Regards, -Gonglei