From patchwork Tue Jan 16 06:08:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 861279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zLKZc0qZzz9sBd for ; Tue, 16 Jan 2018 17:10:16 +1100 (AEDT) Received: from localhost ([::1]:40105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebKRp-000771-GF for incoming@patchwork.ozlabs.org; Tue, 16 Jan 2018 01:10:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebKR3-0006ym-Bl for qemu-devel@nongnu.org; Tue, 16 Jan 2018 01:09:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebKR2-0000z1-AT for qemu-devel@nongnu.org; Tue, 16 Jan 2018 01:09:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44322) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ebKQv-0000vr-QD; Tue, 16 Jan 2018 01:09:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24C62356CA; Tue, 16 Jan 2018 06:09:16 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9818A5D96E; Tue, 16 Jan 2018 06:09:05 +0000 (UTC) From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 14:08:52 +0800 Message-Id: <20180116060901.17413-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 16 Jan 2018 06:09:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v6 0/9] block: Add VFIO based driver for NVMe device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , Keith Busch , alex.williamson@redhat.com, Stefan Hajnoczi , Paolo Bonzini , Karl Rister Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" v6: Fix the cleaning up around nvme_init() and write cache setup in nvme_file_open(). [Stefan] Add Stefan's rev-by to the doc patch. Rebase on to Paolo's coroutine series for q->free_req_queue: Based-on: 20180115220822.10156-1-pbonzini@redhat.com ([PATCH 0/4] coroutine-lock: polymorphic CoQueue) v5: Add Stefan's rev-bys. Add Paolo's sob line. Address Stefan's, Alex's and Eric's comments, including: - Add PCI Bar MMIO offset/size parameter to VFIO utility API. [Alex] - Fix various lock and memory leakings. [Stefan] - Improve documentation. [Stefan] - Add one missing "Since 2.12" in QAPI schema. [Eric] - Fix locking of BDRVNVMeState->inflight. [Stefan] - Add one missing endianness conversion for cmd.nsid. [Stefan] - Use bdrv_get_aio_context() instead of qemu_get_current_aio_context(). - When init, issue "Set Features" command to enable/disable volatile write cache according to "flags & BDRV_O_NOCACHE". v4: - Rebase, address Stefan's comments. - Add QAPI and doc patches. v3: Rebase, small tweaks/fixes and add locks to provide basic thread safety (basic because it is not really tested). v2: - Implement "split vfio addr space" appraoch. [Paolo] - Add back 'device reset' in nvme_close(). [Paolo] - Better variable namings. [Stefan] - "Reuse" macro definitions from NVMe emulation code. - Rebase onto current master which has polling by default and update performance results accordingly. - Update MAINTAINERS. - Specify namespace in URI. - The sporadical I/O error from v1 "disappeared" in this version. - Tests one: qemu-img bench, fio, bonnie++ and installation of ubuntu/fedora/rhel on QEMU emulated nvme and a Intel P3700 card. Fam Zheng (9): stubs: Add stubs for ram block API util: Introduce vfio helpers block: Add VFIO based NVMe driver block: Introduce buf register API block/nvme: Implement .bdrv_(un)register_buf qemu-img: Map bench buffer block: Move NVMe constants to a separate header docs: Add section for NVMe VFIO driver qapi: Add NVMe driver options to the schema MAINTAINERS | 6 + block/Makefile.objs | 1 + block/block-backend.c | 10 + block/io.c | 24 + block/nvme.c | 1199 ++++++++++++++++++++++++++++++++++++++++ block/trace-events | 21 + docs/qemu-block-drivers.texi | 37 ++ hw/block/nvme.h | 698 +---------------------- include/block/block.h | 11 +- include/block/block_int.h | 9 + include/block/nvme.h | 700 +++++++++++++++++++++++ include/qemu/vfio-helpers.h | 33 ++ include/sysemu/block-backend.h | 3 + qapi/block-core.json | 17 +- qemu-img.c | 9 +- stubs/Makefile.objs | 1 + stubs/ram-block.c | 16 + util/Makefile.objs | 1 + util/trace-events | 11 + util/vfio-helpers.c | 726 ++++++++++++++++++++++++ 20 files changed, 2833 insertions(+), 700 deletions(-) create mode 100644 block/nvme.c create mode 100644 include/block/nvme.h create mode 100644 include/qemu/vfio-helpers.h create mode 100644 stubs/ram-block.c create mode 100644 util/vfio-helpers.c Reviewed-by: Stefan Hajnoczi