From patchwork Wed Apr 27 08:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pei, Andy" X-Patchwork-Id: 110306 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B519A0507; Wed, 27 Apr 2022 11:16:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 973A5410DC; Wed, 27 Apr 2022 11:16:43 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 163E940691 for ; Wed, 27 Apr 2022 11:16:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651051002; x=1682587002; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=9BdsOrHENod/XcQ+a7I9xUoVwuOad9rf1NY9kr+E42w=; b=jsICQsR6SAwTFlG4BcY5nqb2Ps4JpLXub95EPrMZ8VE9BWRs+Iz3+f9T truh6Om+du92jNrO+cF/SgLqLR4HUew4Uf2onP0q65WsvL5RL201KzsI6 q5ylwuRB7LuxClDz3nQjwwoS0j3niI+SS0249RagIWK0KRDPn9IeNKJKq HGZPWjazKIA5Xb/eZ5OuHP6Rlhv8BCJyKCKTKkvywPU6M/uN3MBguFlEE q5mCbDhdoSjLHhq93gEuuT2xQAgGqZ2oxKvH8oKhLCtl/QyMvWaLo+ILy xQcCLvZHedV5PBWT24+jFYNaorRzsYO60xGDgcTYnpzqRhIiwW6D6WK9x A==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="352308214" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="352308214" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2022 02:16:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="580488586" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by orsmga008.jf.intel.com with ESMTP; 27 Apr 2022 02:16:22 -0700 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com, changpeng.liu@intel.com Subject: [PATCH v7 00/18] add virtio_blk device support to vdpa/ifc Date: Wed, 27 Apr 2022 16:29:48 +0800 Message-Id: <1651048206-282372-1-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1643093258-47258-2-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch set add virtio_blk device support to vdpa/ifc driver. With a lot of similarities, I re-use part of vdpa/ifc driver. Distinguish the virtio net and blk device by device id, and implement specific features and ops. Add example to vdpa to support virtio_blk device. To support blk device live migration, some modification to vhost lib. Perform dev_conf op only under VHOST_USER_SET_VRING_CALL msg. v7: Check on expected fd num in new vhost msg handler. Sanity check on vhost msg size. Fix typo. Add commit log to help understand code. Remove duplicated code. Add new API to get vDPA device type. v6: Fix some commit log. Add vhost socket in log output to make it more user-friendly. When driver ops fail, just output some log, do not break message handler. Check vhost msg size in msg handler. v5: Fix some coding style issues. v4: Add args "isblk" to vdpa example to specify a block device, fix some Issue in example. Make sure code specify for block device does not affect net device. v3: Fix some compile issues. v2: Fix some coding style issues. Andy Pei (18): vdpa/ifc: add support for virtio blk device vhost: add vDPA ops for blk device vhost: add vhost msg support vdpa/ifc: add blk ops for ifc device vdpa/ifc: add vDPA interrupt for blk device vdpa/ifc: add block device SW live-migration vhost: add API to get vDPA device type vdpa/ifc: add get device type ops to ifc driver examples/vdpa: add vDPA blk support in example usertools: add support for virtio blk device vdpa/ifc: add set vring state for blk device vdpa/ifc: add some log at vDPA launch before qemu connect vdpa/ifc: read virtio max queues from hardware vdpa/ifc: add interrupt and handle for virtio blk vdpa/ifc: add is blk flag to ifcvf HW struct vdpa/ifc/base: access correct register for blk device vdpa/ifc: blk device pause without no inflight IO vhost: make sure each queue callfd is configured drivers/vdpa/ifc/base/ifcvf.c | 36 +++- drivers/vdpa/ifc/base/ifcvf.h | 20 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 392 +++++++++++++++++++++++++++++++++++++-- examples/vdpa/main.c | 57 ++++++ examples/vdpa/vdpa_blk_compact.h | 65 +++++++ lib/vhost/rte_vhost.h | 17 ++ lib/vhost/socket.c | 39 ++++ lib/vhost/vdpa_driver.h | 11 +- lib/vhost/version.map | 2 + lib/vhost/vhost_user.c | 97 ++++++++++ lib/vhost/vhost_user.h | 13 ++ usertools/dpdk-devbind.py | 5 +- 12 files changed, 730 insertions(+), 24 deletions(-) create mode 100644 examples/vdpa/vdpa_blk_compact.h