From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjemn-0006Pt-9Q for qemu-devel@nongnu.org; Mon, 12 Sep 2016 23:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjemj-00035f-FO for qemu-devel@nongnu.org; Mon, 12 Sep 2016 23:53:29 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:40281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjemi-00034C-H1 for qemu-devel@nongnu.org; Mon, 12 Sep 2016 23:53:25 -0400 From: Gonglei Date: Tue, 13 Sep 2016 11:52:06 +0800 Message-ID: <1473738741-220600-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v2 00/15] virtio-crypto: introduce framework and device emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, virtio-dev@lists.oasis-open.org Cc: peter.huangpeng@huawei.com, luonengjun@huawei.com, mst@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, berrange@redhat.com, weidong.huang@huawei.com, mike.caraman@nxp.com, agraf@suse.de, xin.zeng@intel.com, claudio.fontana@huawei.com, nmorey@kalray.eu, vincent.jardin@6wind.com, Gonglei Changes since v1: - rmmove mixed endian-ness handler for virtio-crypto device, just use little-endian. [mst] - add sg list support according virtio-crypto spec v10 (will be posted soon). - fix a memory leak in session handler. - add a feature page link in qemu.org (http://qemu-project.org/Features/VirtioCrypto) - fix some trivial problems, sush as 's/Since 2.7/Since 2.8/g' in qapi-schema.json - rebase the latest qemu master tree. Please review, thanks! This patch series realize the framework and emulation of a new virtio crypto device, which is similar with virtio net device. - I introduce the cryptodev backend as the client of virtio crypto device which can be realized by different methods, such as cryptodev-linux in my series, vhost-crypto kernel module, vhost-user etc. - The patch set abides by the virtio crypto speccification. - The virtio crypto support symmetric algorithms (including CIPHER and algorithm chainning) at present, except HASH, MAC and AEAD services. - unsupport hot plug/unplug cryptodev client at this moment. Cryptodev-linux is a device that allows access to Linux kernel cryptographic drivers; thus allowing of userspace applications to take advantage of hardware accelerators. It can be found here: http://cryptodev-linux.org/ (please use the latest version) To use the cryptodev-linux as the client, the cryptodev.ko should be insert on the host. # enter cryptodev-linux module root directory, then make;make install then configuring QEMU shows: [...] jemalloc support no avx2 optimization no cryptodev-linux support yes QEMU can then be started using the following parameters: qemu-system-x86_64 \ [...] \ -cryptodev type=cryptodev-linux,id=cryptodev0 \ -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \ [...] The front-end linux kernel driver (Experimental at present) is publicly accessible from: https://github.com/gongleiarei/virtio-crypto-linux-driver.git After insmod virtio-crypto.ko, you also can use cryptodev-linux test the crypto function in the guest. For example: linux-guest:/home/gonglei/cryptodev-linux/tests # ./cipher - requested cipher CRYPTO_AES_CBC, got cbc(aes) with driver virtio_crypto_aes_cbc AES Test passed requested cipher CRYPTO_AES_CBC, got cbc(aes) with driver virtio_crypto_aes_cbc requested cipher CRYPTO_AES_CBC, got cbc(aes) with driver virtio_crypto_aes_cbc Test passed QEMU code also can be accessible from: https://github.com/gongleiarei/qemu.git branch virtio-crypto For more information, please see: http://qemu-project.org/Features/VirtioCrypto Gonglei (15): crypto: introduce cryptodev backend and crypto legacy hardware crypto: introduce crypto queue handler crypto: add cryptoLegacyHW stuff crypto: add symetric algorithms support crypto: add cryptodev-linux as a cryptodev backend crypto: add internal handle logic layer virtio-crypto: introduce virtio-crypto.h virtio-crypto-pci: add virtio crypto pci support virtio-crypto: add virtio crypto realization virtio-crypto: set capacity of crypto legacy hardware virtio-crypto: add control queue handler virtio-crypto: add destroy session logic virtio-crypto: get correct input data address for each request virtio-crypto: add data virtqueue processing handler virtio-crypto: support scatter gather list configure | 16 + crypto/Makefile.objs | 3 + crypto/crypto-queue.c | 206 +++++ crypto/crypto.c | 378 +++++++++ crypto/cryptodev-linux.c | 419 ++++++++++ hw/core/qdev-properties-system.c | 86 ++ hw/virtio/Makefile.objs | 3 +- hw/virtio/virtio-crypto-pci.c | 71 ++ hw/virtio/virtio-crypto.c | 1013 ++++++++++++++++++++++++ hw/virtio/virtio-pci.h | 15 + include/crypto/crypto-clients.h | 39 + include/crypto/crypto-queue.h | 69 ++ include/crypto/crypto.h | 192 +++++ include/hw/qdev-properties.h | 3 + include/hw/virtio/virtio-crypto.h | 96 +++ include/qemu/typedefs.h | 1 + include/standard-headers/linux/virtio_crypto.h | 466 +++++++++++ include/sysemu/sysemu.h | 1 + qapi-schema.json | 61 ++ qemu-options.hx | 19 + vl.c | 13 + 21 files changed, 3169 insertions(+), 1 deletion(-) create mode 100644 crypto/crypto-queue.c create mode 100644 crypto/crypto.c create mode 100644 crypto/cryptodev-linux.c create mode 100644 hw/virtio/virtio-crypto-pci.c create mode 100644 hw/virtio/virtio-crypto.c create mode 100644 include/crypto/crypto-clients.h create mode 100644 include/crypto/crypto-queue.h create mode 100644 include/crypto/crypto.h create mode 100644 include/hw/virtio/virtio-crypto.h create mode 100644 include/standard-headers/linux/virtio_crypto.h -- 1.7.12.4