From patchwork Wed Aug 1 10:22:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenneth Lee X-Patchwork-Id: 143265 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp680328ljj; Wed, 1 Aug 2018 03:23:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfx8czLk7RlQX+py9y2GseWyd9rd1wjQGF32KSApF05HmYgjr8l2cDgJCd3DpYO+w39AB41 X-Received: by 2002:a63:f:: with SMTP id 15-v6mr24071987pga.430.1533119026929; Wed, 01 Aug 2018 03:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533119026; cv=none; d=google.com; s=arc-20160816; b=ASDqdm6EBX3YF7JK/6yLIzo48wqNTULTJ5syU0AmYN3NT3uvZEAKu92VMzoBAAouVj 7VQAN+GWIa9aCd6gDQCYmPK48Sb16Czp5X+JEmtSwSNuoqoGgh6hPu0WVhmHbL8gShXB i0aEN5j7VigwbqbGXQuIEOxMSnfeTEm4+HG9SygnIstNAsmIjGJnwWPvj/gBzA6VoRgp 3PWhe83+THAPCtDiR/2kOc5yACN45XlJPhcJXfknfcMR8U7EzOAp0JLThj0R+q+cmO7N +6NrmZR8ieV5fSsAhu3D0BWS8mp/9zffA72gokbTYWCGz/NGluTXBJUlOo/FJBmYTNkR 9NFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=t47TSg/XpU729y7A0WZQIYbQn6t4RDOZX46+Kk0EX+w=; b=P4ci5FxVppzTEeFEtAx7jvZEbZdsE/po6y7zRAUp/iBncWWKvi2NsX85k+5r3YGTox CwjrNu9B2t+/NRvtRdLi+3v1EupT6cdnnxqpBRo6cKbNl25aIkx/ccU0CWDfphf/W2br EH0nZ8UqcsPygM7twTUnlglxv1eDXUlW2YNhk0LI5qRvt4vA7/nCzFxCsPPhV6v9tzoY j5O63JYqmpNQGxGT4IQdpYv9IAVIAxiCQ6YI+mrZiSpmo4LYXeTYcnvFu8Vweo2o4zuM nAg0BE+oJ7gb88iO4gqV2iMK28R6Y9J3B61ZXrVCFpL09J46G3EWbaNbmJ7GqNZeYhfh TkMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IAwjfq6o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2-v6si15981035pgl.140.2018.08.01.03.23.46; Wed, 01 Aug 2018 03:23:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IAwjfq6o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387621AbeHAMIt (ORCPT + 31 others); Wed, 1 Aug 2018 08:08:49 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:37571 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387528AbeHAMIs (ORCPT ); Wed, 1 Aug 2018 08:08:48 -0400 Received: by mail-qk0-f193.google.com with SMTP id t79-v6so12279619qke.4; Wed, 01 Aug 2018 03:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=t47TSg/XpU729y7A0WZQIYbQn6t4RDOZX46+Kk0EX+w=; b=IAwjfq6oGZSq7SzH/E9V99MvJFB1OipTE18ZSOFjGri20aBtjG1cCDFPbDgn4akU/N 7pBqQKo0/RPNCML92qqGZ2aQjVs8+zXz+34MaAgN8z35hfXKbAZ87MHPqo5pt35WD0KS emwwp0lAOHrvVV3saVTScHJ1PTcBqdVVlNzuSTDrTBQYlgxs539hXj5W1Bmafb0NNGOV xk/uJVZ8s/9CfVAztz+hmpvjVeoaVpWS8pG6hpjTUbF8UQSA01s6OW9H/ZuudGrdGqH+ iL6G8bfFqDzlYSoixzj95MWMPn27l09vT6TfTNG1AExT2wDrf3JRK9CugVLyB5dXjbs9 iCUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=t47TSg/XpU729y7A0WZQIYbQn6t4RDOZX46+Kk0EX+w=; b=Lq6gEtw1OA0YRCwJNWrb/0dGgwU+Tg0p8inZD5JvAzEcUzI3oMk7tjORszakj6MHX+ pBRtbICAITj0IR9Cv6AtF1IeMpY//XwXON0Fk0YwT9TCuJDrZtoGaPCBmu5/FgS9VNWd Ba9ozaM2qaI5C4FI/aykdwKubmkYVlpYoN8nDvc+5yzqyqLNvb9tWFuodxVUitPsC3+9 JfWNnCiCZMjMhko6Ayr3Gy/zy2yPXj1cbCKNSYg4u/C4x3DUFD/BCMczzr2fPJpY1FQm pTJ3+wuia0wjiubbsi40IZEtoGE3nSG0aZ7j/wP2ACksfy3bngysxzpi03GkW7saS7l5 83fQ== X-Gm-Message-State: AOUpUlG9LnA28f2I/tVZKB5wrwrgTQMrR4W0WtNCDRO/T74Bbc4UEfeo 7AG0M1VeBJPX1OT74NMzAA8= X-Received: by 2002:a37:5a06:: with SMTP id o6-v6mr23693189qkb.44.1533119022682; Wed, 01 Aug 2018 03:23:42 -0700 (PDT) Received: from localhost.localdomain ([104.237.86.144]) by smtp.gmail.com with ESMTPSA id s19-v6sm11176890qtj.61.2018.08.01.03.23.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 03:23:42 -0700 (PDT) From: Kenneth Lee To: Jonathan Corbet , Herbert Xu , "David S . Miller" , Joerg Roedel , Alex Williamson , Kenneth Lee , Hao Fang , Zhou Wang , Zaibo Xu , Philippe Ombredanne , Greg Kroah-Hartman , Thomas Gleixner , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-accelerators@lists.ozlabs.org, Lu Baolu , Sanjay Kumar Cc: linuxarm@huawei.com Subject: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive Date: Wed, 1 Aug 2018 18:22:14 +0800 Message-Id: <20180801102221.5308-1-nek.in.cn@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kenneth Lee WarpDrive is an accelerator framework to expose the hardware capabilities directly to the user space. It makes use of the exist vfio and vfio-mdev facilities. So the user application can send request and DMA to the hardware without interaction with the kernel. This remove the latency of syscall and context switch. The patchset contains documents for the detail. Please refer to it for more information. This patchset is intended to be used with Jean Philippe Brucker's SVA patch [1] (Which is also in RFC stage). But it is not mandatory. This patchset is tested in the latest mainline kernel without the SVA patches. So it support only one process for each accelerator. With SVA support, WarpDrive can support multi-process in the same accelerator device. We tested it in our SoC integrated Accelerator (board ID: D06, Chip ID: HIP08). A reference work tree can be found here: [2]. We have noticed the IOMMU aware mdev RFC announced recently [3]. The IOMMU aware mdev has similar idea but different intention comparing to WarpDrive. It intends to dedicate part of the hardware resource to a VM. And the design is supposed to be used with Scalable I/O Virtualization. While spimdev is intended to share the hardware resource with a big amount of processes. It just requires the hardware supporting address translation per process (PCIE's PASID or ARM SMMU's substream ID). But we don't see serious confliction on both design. We believe they can be normalized as one. The patch 1 is document. The patch 2 and 3 add spimdev support. The patch 4, 5 and 6 is drivers for Hislicon's ZIP Accelerator which is registered to both crypto and warpdrive(spimdev) and can be used from kernel or user space at the same time. The patch 7 is a user space sample demonstrating how WarpDrive works. Refernces: [1] https://www.spinics.net/lists/kernel/msg2651481.html [2] https://github.com/Kenneth-Lee/linux-kernel-warpdrive/tree/warpdrive-sva-v0.5 [3] https://lkml.org/lkml/2018/7/22/34 Best Regards Kenneth Lee Kenneth Lee (7): vfio/spimdev: Add documents for WarpDrive framework iommu: Add share domain interface in iommu for spimdev vfio: add spimdev support crypto: add hisilicon Queue Manager driver crypto: Add Hisilicon Zip driver crypto: add spimdev support to Hisilicon QM vfio/spimdev: add user sample for spimdev Documentation/00-INDEX | 2 + Documentation/warpdrive/warpdrive.rst | 153 ++++ Documentation/warpdrive/wd-arch.svg | 732 +++++++++++++++ Documentation/warpdrive/wd.svg | 526 +++++++++++ drivers/crypto/Kconfig | 2 + drivers/crypto/Makefile | 1 + drivers/crypto/hisilicon/Kconfig | 15 + drivers/crypto/hisilicon/Makefile | 2 + drivers/crypto/hisilicon/qm.c | 1005 +++++++++++++++++++++ drivers/crypto/hisilicon/qm.h | 123 +++ drivers/crypto/hisilicon/zip/Makefile | 2 + drivers/crypto/hisilicon/zip/zip.h | 55 ++ drivers/crypto/hisilicon/zip/zip_crypto.c | 358 ++++++++ drivers/crypto/hisilicon/zip/zip_crypto.h | 18 + drivers/crypto/hisilicon/zip/zip_main.c | 182 ++++ drivers/iommu/iommu.c | 28 +- drivers/vfio/Kconfig | 1 + drivers/vfio/Makefile | 1 + drivers/vfio/spimdev/Kconfig | 10 + drivers/vfio/spimdev/Makefile | 3 + drivers/vfio/spimdev/vfio_spimdev.c | 421 +++++++++ drivers/vfio/vfio_iommu_type1.c | 136 ++- include/linux/iommu.h | 2 + include/linux/vfio_spimdev.h | 95 ++ include/uapi/linux/vfio_spimdev.h | 28 + samples/warpdrive/AUTHORS | 2 + samples/warpdrive/ChangeLog | 1 + samples/warpdrive/Makefile.am | 9 + samples/warpdrive/NEWS | 1 + samples/warpdrive/README | 32 + samples/warpdrive/autogen.sh | 3 + samples/warpdrive/cleanup.sh | 13 + samples/warpdrive/configure.ac | 52 ++ samples/warpdrive/drv/hisi_qm_udrv.c | 223 +++++ samples/warpdrive/drv/hisi_qm_udrv.h | 53 ++ samples/warpdrive/test/Makefile.am | 7 + samples/warpdrive/test/comp_hw.h | 23 + samples/warpdrive/test/test_hisi_zip.c | 204 +++++ samples/warpdrive/wd.c | 325 +++++++ samples/warpdrive/wd.h | 153 ++++ samples/warpdrive/wd_adapter.c | 74 ++ samples/warpdrive/wd_adapter.h | 43 + 42 files changed, 5112 insertions(+), 7 deletions(-) create mode 100644 Documentation/warpdrive/warpdrive.rst create mode 100644 Documentation/warpdrive/wd-arch.svg create mode 100644 Documentation/warpdrive/wd.svg create mode 100644 drivers/crypto/hisilicon/Kconfig create mode 100644 drivers/crypto/hisilicon/Makefile create mode 100644 drivers/crypto/hisilicon/qm.c create mode 100644 drivers/crypto/hisilicon/qm.h create mode 100644 drivers/crypto/hisilicon/zip/Makefile create mode 100644 drivers/crypto/hisilicon/zip/zip.h create mode 100644 drivers/crypto/hisilicon/zip/zip_crypto.c create mode 100644 drivers/crypto/hisilicon/zip/zip_crypto.h create mode 100644 drivers/crypto/hisilicon/zip/zip_main.c create mode 100644 drivers/vfio/spimdev/Kconfig create mode 100644 drivers/vfio/spimdev/Makefile create mode 100644 drivers/vfio/spimdev/vfio_spimdev.c create mode 100644 include/linux/vfio_spimdev.h create mode 100644 include/uapi/linux/vfio_spimdev.h create mode 100644 samples/warpdrive/AUTHORS create mode 100644 samples/warpdrive/ChangeLog create mode 100644 samples/warpdrive/Makefile.am create mode 100644 samples/warpdrive/NEWS create mode 100644 samples/warpdrive/README create mode 100755 samples/warpdrive/autogen.sh create mode 100755 samples/warpdrive/cleanup.sh create mode 100644 samples/warpdrive/configure.ac create mode 100644 samples/warpdrive/drv/hisi_qm_udrv.c create mode 100644 samples/warpdrive/drv/hisi_qm_udrv.h create mode 100644 samples/warpdrive/test/Makefile.am create mode 100644 samples/warpdrive/test/comp_hw.h create mode 100644 samples/warpdrive/test/test_hisi_zip.c create mode 100644 samples/warpdrive/wd.c create mode 100644 samples/warpdrive/wd.h create mode 100644 samples/warpdrive/wd_adapter.c create mode 100644 samples/warpdrive/wd_adapter.h -- 2.17.1