Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-07 Thread Gonglei (Arei)
Hi Sam,

>
> Subject: Re: [PATCH v5 1/1] crypto: add virtio-crypto driver
> 
> On Mon, Dec 05, 2016 at 03:12:52AM +, Gonglei (Arei) wrote:
> > I don't think the root cause of those warnings are introduced by 
> > virtio-crypto
> driver.
> >
> > What's your opinion? Sam and David?
> 
> Root cause here is that arch/sparc/include/asm/topology_64.h
> references cpu_data without including arch/sparc/include/asm/cpudata.h
> 
> I think other architectures pull in the dependency from
> either smp.h or they have it topology.h.
> 
> The easy fix would be to include cpudata.h in
> arch/sparc/include/asm/topology_64.h.
> And that should also be a correct fix.
> 
> Could you include this in your patch-set and build test it?
> 
Sure, I can add this one at the head of my patch set, but because I
haven't sparc environment, so it depends on the kbuild test robot
to test.

Thanks,
-Gonglei



Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-07 Thread Gonglei (Arei)
>
> Subject: Re: [PATCH v5 1/1] crypto: add virtio-crypto driver
> 
> On Tue, Dec 06, 2016 at 09:01:49AM +, Gonglei (Arei) wrote:
> >
> > Would you please review and/or ack the virtio_crypto_algs.c?
> > It is the realization of specified algs based on Linux Crypto Framework.
> 
> I have no issues with it.  If the virtio folks are happy with
> the interface with the host then I'll take this patch.
> 
Cool, thanks!

Regards,
-Gonglei



Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-07 Thread Sam Ravnborg
On Mon, Dec 05, 2016 at 03:12:52AM +, Gonglei (Arei) wrote:
> I don't think the root cause of those warnings are introduced by 
> virtio-crypto driver.
> 
> What's your opinion? Sam and David?

Root cause here is that arch/sparc/include/asm/topology_64.h
references cpu_data without including arch/sparc/include/asm/cpudata.h

I think other architectures pull in the dependency from
either smp.h or they have it topology.h.

The easy fix would be to include cpudata.h in 
arch/sparc/include/asm/topology_64.h.
And that should also be a correct fix.

Could you include this in your patch-set and build test it?

Sam



Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-07 Thread Herbert Xu
On Tue, Dec 06, 2016 at 09:01:49AM +, Gonglei (Arei) wrote:
> 
> Would you please review and/or ack the virtio_crypto_algs.c?
> It is the realization of specified algs based on Linux Crypto Framework.

I have no issues with it.  If the virtio folks are happy with
the interface with the host then I'll take this patch.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-06 Thread Gonglei (Arei)
Hi Herbert,

Would you please review and/or ack the virtio_crypto_algs.c?
It is the realization of specified algs based on Linux Crypto Framework.

Thanks!


Regards,
-Gonglei


> -Original Message-
> From: Gonglei (Arei)
> Sent: Thursday, December 01, 2016 8:39 PM
> To: linux-ker...@vger.kernel.org; qemu-devel@nongnu.org;
> virtio-...@lists.oasis-open.org; virtualizat...@lists.linux-foundation.org;
> linux-cry...@vger.kernel.org
> Cc: Luonengjun; m...@redhat.com; stefa...@redhat.com; Huangweidong (C);
> Wubin (H); xin.z...@intel.com; Claudio Fontana;
> herb...@gondor.apana.org.au; pa...@linux.vnet.ibm.com;
> da...@davemloft.net; Zhoujian (jay, Euler); Hanweidong (Randy);
> arei.gong...@hotmail.com; cornelia.h...@de.ibm.com; Xuquan (Quan Xu);
> longpeng; Wanzongshun (Vincent); Gonglei (Arei)
> Subject: [PATCH v5 1/1] crypto: add virtio-crypto driver
> 
> This patch introduces virtio-crypto driver for Linux Kernel.
> 
> The virtio crypto device is a virtual cryptography device
> as well as a kind of virtual hardware accelerator for
> virtual machines. The encryption anddecryption requests
> are placed in the data queue and are ultimately handled by
> thebackend crypto accelerators. The second queue is the
> control queue used to create or destroy sessions for
> symmetric algorithms and will control some advanced features
> in the future. The virtio crypto device provides the following
> cryptoservices: CIPHER, MAC, HASH, and AEAD.
> 
> For more information about virtio-crypto device, please see:
>   http://qemu-project.org/Features/VirtioCrypto
> 
> CC: Michael S. Tsirkin 
> CC: Cornelia Huck 
> CC: Stefan Hajnoczi 
> CC: Herbert Xu 
> CC: Halil Pasic 
> CC: David S. Miller 
> CC: Zeng Xin 
> Signed-off-by: Gonglei 
> ---
>  MAINTAINERS  |   9 +
>  drivers/crypto/Kconfig   |   2 +
>  drivers/crypto/Makefile  |   1 +
>  drivers/crypto/virtio/Kconfig|  10 +
>  drivers/crypto/virtio/Makefile   |   5 +
>  drivers/crypto/virtio/virtio_crypto_algs.c   | 537
> +++
>  drivers/crypto/virtio/virtio_crypto_common.h | 122 ++
>  drivers/crypto/virtio/virtio_crypto_core.c   | 464
> +++
>  drivers/crypto/virtio/virtio_crypto_mgr.c| 264 +
>  include/uapi/linux/Kbuild|   1 +
>  include/uapi/linux/virtio_crypto.h   | 450
> ++
>  include/uapi/linux/virtio_ids.h  |   1 +
>  12 files changed, 1866 insertions(+)
>  create mode 100644 drivers/crypto/virtio/Kconfig
>  create mode 100644 drivers/crypto/virtio/Makefile
>  create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.c
>  create mode 100644 drivers/crypto/virtio/virtio_crypto_common.h
>  create mode 100644 drivers/crypto/virtio/virtio_crypto_core.c
>  create mode 100644 drivers/crypto/virtio/virtio_crypto_mgr.c
>  create mode 100644 include/uapi/linux/virtio_crypto.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index ad9b965..cccaaf0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -12810,6 +12810,7 @@ F:drivers/net/virtio_net.c
>  F:   drivers/block/virtio_blk.c
>  F:   include/linux/virtio_*.h
>  F:   include/uapi/linux/virtio_*.h
> +F:   drivers/crypto/virtio/
> 
>  VIRTIO DRIVERS FOR S390
>  M:   Christian Borntraeger 
> @@ -12846,6 +12847,14 @@ S:   Maintained
>  F:   drivers/virtio/virtio_input.c
>  F:   include/uapi/linux/virtio_input.h
> 
> +VIRTIO CRYPTO DRIVER
> +M:  Gonglei 
> +L:  virtualizat...@lists.linux-foundation.org
> +L:  linux-cry...@vger.kernel.org
> +S:  Maintained
> +F:  drivers/crypto/virtio/
> +F:  include/uapi/linux/virtio_crypto.h
> +
>  VIA RHINE NETWORK DRIVER
>  S:   Orphan
>  F:   drivers/net/ethernet/via/via-rhine.c
> diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
> index 4d2b81f..7956478 100644
> --- a/drivers/crypto/Kconfig
> +++ b/drivers/crypto/Kconfig
> @@ -555,4 +555,6 @@ config CRYPTO_DEV_ROCKCHIP
> 
>  source "drivers/crypto/chelsio/Kconfig"
> 
> +source "drivers/crypto/virtio/Kconfig"
> +
>  endif # CRYPTO_HW
> diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
> index ad7250f..bc53cb8 100644
> --- a/drivers/crypto/Makefile
> +++ b/drivers/crypto/Makefile
> @@ -32,3 +32,4 @@ obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
>  obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sunxi-ss/
>  obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rockchip/
>  obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chelsio/
> +obj-$(CONFIG_CRYPTO_DEV_VIRTIO) += virtio/
> diff --git a/drivers/crypto/virtio/Kconfig b/drivers/crypto/virtio/Kconfig
> new file mode 100644
> index 000..d80f733
> --- /dev/null
> +++ b/drivers/crypto/virtio/Kconfig
> @@ -0,0 +1,10 @@
> +config CRYPTO_DEV_VIRTIO
> + 

Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-04 Thread Gonglei (Arei)
I don't think the root cause of those warnings are introduced by virtio-crypto 
driver.

What's your opinion? Sam and David?

Thanks,
-Gonglei


> -Original Message-
> From: kbuild test robot [mailto:l...@intel.com]
> Sent: Sunday, December 04, 2016 10:40 AM
> Subject: Re: [PATCH v5 1/1] crypto: add virtio-crypto driver
> 
> Hi Gonglei,
> 
> [auto build test ERROR on cryptodev/master]
> [also build test ERROR on v4.9-rc7 next-20161202]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Gonglei/crypto-add-virtio-crypto-dri
> ver/20161202-190424
> base:
> https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
> master
> config: sparc64-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cr
> oss -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=sparc64
> 
> All errors (new ones prefixed by >>):
> 
>In file included from arch/sparc/include/asm/topology.h:4:0,
> from include/linux/topology.h:35,
> from include/linux/gfp.h:8,
> from include/linux/kmod.h:22,
> from include/linux/module.h:13,
> from drivers/crypto/virtio/virtio_crypto_mgr.c:21:
>drivers/crypto/virtio/virtio_crypto_common.h: In function
> 'virtio_crypto_get_current_node':
> >> arch/sparc/include/asm/topology_64.h:44:44: error: implicit declaration of
> function 'cpu_data' [-Werror=implicit-function-declaration]
> #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
>^
>drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of
> macro 'topology_physical_package_id'
>  return topology_physical_package_id(smp_processor_id());
> ^~~~
> >> arch/sparc/include/asm/topology_64.h:44:57: error: request for member
> 'proc_id' in something not a structure or union
> #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
> ^
>drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of
> macro 'topology_physical_package_id'
>  return topology_physical_package_id(smp_processor_id());
> ^~~~
>cc1: some warnings being treated as errors
> 
> vim +/cpu_data +44 arch/sparc/include/asm/topology_64.h
> 
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  28
> 9d079337 arch/sparc/include/asm/topology_64.h David Miller
> 2009-01-11  29  #define cpumask_of_pcibus(bus)\
> 9d079337 arch/sparc/include/asm/topology_64.h David Miller
> 2009-01-11  30(pcibus_to_node(bus) == -1 ? \
> e9b37512 arch/sparc/include/asm/topology_64.h Rusty Russell
> 2009-03-16  31 cpu_all_mask : \
> 9d079337 arch/sparc/include/asm/topology_64.h David Miller
> 2009-01-11  32 cpumask_of_node(pcibus_to_node(bus)))
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  33
> 52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta
> 2015-11-02  34  int __node_distance(int, int);
> 52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta
> 2015-11-02  35  #define node_distance(a, b) __node_distance(a, b)
> 52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta
> 2015-11-02  36
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  37  #else /* CONFIG_NUMA */
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  38
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  39  #include 
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  40
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  41  #endif /* !(CONFIG_NUMA) */
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  42
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  43  #ifdef CONFIG_SMP
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17 @44  #define topology_physical_package_id(cpu)
>   (cpu_data(cpu).proc_id)
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  45  #define topology_core_id(cpu)
>   (cpu_data(cpu).core_id)
> acc455cf arch/sparc/include/asm/topology_64.h chris hyser
> 2015-04-22  46  #define topology_core_cpumask(cpu)
>   (_core_sib_map[cpu])
> 06931e62 arch/sparc/include/asm/topology_64.h Bartosz Golaszewski
> 2015-05-26  47  #define topology_sibling_cpumask(cpu)
>   (_cpu(cpu_sibling_map, cpu))
> f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg
> 2008-07-17  48  #endif /* CONFIG_SMP */
> f5e706ad 

Re: [Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-03 Thread kbuild test robot
Hi Gonglei,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.9-rc7 next-20161202]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Gonglei/crypto-add-virtio-crypto-driver/20161202-190424
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All errors (new ones prefixed by >>):

   In file included from arch/sparc/include/asm/topology.h:4:0,
from include/linux/topology.h:35,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/crypto/virtio/virtio_crypto_mgr.c:21:
   drivers/crypto/virtio/virtio_crypto_common.h: In function 
'virtio_crypto_get_current_node':
>> arch/sparc/include/asm/topology_64.h:44:44: error: implicit declaration of 
>> function 'cpu_data' [-Werror=implicit-function-declaration]
#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
   ^
   drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of 
macro 'topology_physical_package_id'
 return topology_physical_package_id(smp_processor_id());
^~~~
>> arch/sparc/include/asm/topology_64.h:44:57: error: request for member 
>> 'proc_id' in something not a structure or union
#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
^
   drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of 
macro 'topology_physical_package_id'
 return topology_physical_package_id(smp_processor_id());
^~~~
   cc1: some warnings being treated as errors

vim +/cpu_data +44 arch/sparc/include/asm/topology_64.h

f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
28  
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
29  #define cpumask_of_pcibus(bus)\
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
30(pcibus_to_node(bus) == -1 ? \
e9b37512 arch/sparc/include/asm/topology_64.h Rusty Russell   2009-03-16  
31 cpu_all_mask : \
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
32 cpumask_of_node(pcibus_to_node(bus)))
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
33  
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
34  int __node_distance(int, int);
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
35  #define node_distance(a, b) __node_distance(a, b)
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
36  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
37  #else /* CONFIG_NUMA */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
38  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
39  #include 
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
40  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
41  #endif /* !(CONFIG_NUMA) */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
42  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
43  #ifdef CONFIG_SMP
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17 
@44  #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
45  #define topology_core_id(cpu) (cpu_data(cpu).core_id)
acc455cf arch/sparc/include/asm/topology_64.h chris hyser 2015-04-22  
46  #define topology_core_cpumask(cpu)(_core_sib_map[cpu])
06931e62 arch/sparc/include/asm/topology_64.h Bartosz Golaszewski 2015-05-26  
47  #define topology_sibling_cpumask(cpu) (_cpu(cpu_sibling_map, 
cpu))
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
48  #endif /* CONFIG_SMP */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
49  
3905c54f arch/sparc/include/asm/topology_64.h Stephen Rothwell2011-04-12  
50  extern cpumask_t cpu_core_map[NR_CPUS];
acc455cf arch/sparc/include/asm/topology_64.h chris hyser 2015-04-22  
51  extern cpumask_t 

[Qemu-devel] [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-01 Thread Gonglei
This patch introduces virtio-crypto driver for Linux Kernel.

The virtio crypto device is a virtual cryptography device
as well as a kind of virtual hardware accelerator for
virtual machines. The encryption anddecryption requests
are placed in the data queue and are ultimately handled by
thebackend crypto accelerators. The second queue is the
control queue used to create or destroy sessions for
symmetric algorithms and will control some advanced features
in the future. The virtio crypto device provides the following
cryptoservices: CIPHER, MAC, HASH, and AEAD.

For more information about virtio-crypto device, please see:
  http://qemu-project.org/Features/VirtioCrypto

CC: Michael S. Tsirkin 
CC: Cornelia Huck 
CC: Stefan Hajnoczi 
CC: Herbert Xu 
CC: Halil Pasic 
CC: David S. Miller 
CC: Zeng Xin 
Signed-off-by: Gonglei 
---
 MAINTAINERS  |   9 +
 drivers/crypto/Kconfig   |   2 +
 drivers/crypto/Makefile  |   1 +
 drivers/crypto/virtio/Kconfig|  10 +
 drivers/crypto/virtio/Makefile   |   5 +
 drivers/crypto/virtio/virtio_crypto_algs.c   | 537 +++
 drivers/crypto/virtio/virtio_crypto_common.h | 122 ++
 drivers/crypto/virtio/virtio_crypto_core.c   | 464 +++
 drivers/crypto/virtio/virtio_crypto_mgr.c| 264 +
 include/uapi/linux/Kbuild|   1 +
 include/uapi/linux/virtio_crypto.h   | 450 ++
 include/uapi/linux/virtio_ids.h  |   1 +
 12 files changed, 1866 insertions(+)
 create mode 100644 drivers/crypto/virtio/Kconfig
 create mode 100644 drivers/crypto/virtio/Makefile
 create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.c
 create mode 100644 drivers/crypto/virtio/virtio_crypto_common.h
 create mode 100644 drivers/crypto/virtio/virtio_crypto_core.c
 create mode 100644 drivers/crypto/virtio/virtio_crypto_mgr.c
 create mode 100644 include/uapi/linux/virtio_crypto.h

diff --git a/MAINTAINERS b/MAINTAINERS
index ad9b965..cccaaf0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12810,6 +12810,7 @@ F:  drivers/net/virtio_net.c
 F: drivers/block/virtio_blk.c
 F: include/linux/virtio_*.h
 F: include/uapi/linux/virtio_*.h
+F: drivers/crypto/virtio/
 
 VIRTIO DRIVERS FOR S390
 M: Christian Borntraeger 
@@ -12846,6 +12847,14 @@ S: Maintained
 F: drivers/virtio/virtio_input.c
 F: include/uapi/linux/virtio_input.h
 
+VIRTIO CRYPTO DRIVER
+M:  Gonglei 
+L:  virtualizat...@lists.linux-foundation.org
+L:  linux-cry...@vger.kernel.org
+S:  Maintained
+F:  drivers/crypto/virtio/
+F:  include/uapi/linux/virtio_crypto.h
+
 VIA RHINE NETWORK DRIVER
 S: Orphan
 F: drivers/net/ethernet/via/via-rhine.c
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 4d2b81f..7956478 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -555,4 +555,6 @@ config CRYPTO_DEV_ROCKCHIP
 
 source "drivers/crypto/chelsio/Kconfig"
 
+source "drivers/crypto/virtio/Kconfig"
+
 endif # CRYPTO_HW
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index ad7250f..bc53cb8 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -32,3 +32,4 @@ obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
 obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sunxi-ss/
 obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rockchip/
 obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chelsio/
+obj-$(CONFIG_CRYPTO_DEV_VIRTIO) += virtio/
diff --git a/drivers/crypto/virtio/Kconfig b/drivers/crypto/virtio/Kconfig
new file mode 100644
index 000..d80f733
--- /dev/null
+++ b/drivers/crypto/virtio/Kconfig
@@ -0,0 +1,10 @@
+config CRYPTO_DEV_VIRTIO
+   tristate "VirtIO crypto driver"
+   depends on VIRTIO
+   select CRYPTO_AEAD
+   select CRYPTO_AUTHENC
+   select CRYPTO_BLKCIPHER
+   default m
+   help
+ This driver provides support for virtio crypto device. If you
+ choose 'M' here, this module will be called virtio_crypto.
diff --git a/drivers/crypto/virtio/Makefile b/drivers/crypto/virtio/Makefile
new file mode 100644
index 000..dd342c9
--- /dev/null
+++ b/drivers/crypto/virtio/Makefile
@@ -0,0 +1,5 @@
+obj-$(CONFIG_CRYPTO_DEV_VIRTIO) += virtio_crypto.o
+virtio_crypto-objs := \
+   virtio_crypto_algs.o \
+   virtio_crypto_mgr.o \
+   virtio_crypto_core.o
diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c 
b/drivers/crypto/virtio/virtio_crypto_algs.c
new file mode 100644
index 000..5100056
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_crypto_algs.c
@@ -0,0 +1,537 @@
+ /* Algorithms supported by virtio crypto device
+  *
+  * Authors: Gonglei 
+  *
+  * Copyright 2016 HUAWEI TECHNOLOGIES CO.,