From patchwork Fri Apr 7 08:25:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 1766448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=DuyiTXMN; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PtBKv0MMqz1yZF for ; Fri, 7 Apr 2023 18:26:41 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkhPh-0006XX-LH; Fri, 07 Apr 2023 04:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pkhPg-0006XF-Jt; Fri, 07 Apr 2023 04:25:40 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkhPe-00023f-Pj; Fri, 07 Apr 2023 04:25:40 -0400 Received: by mail-pj1-x1031.google.com with SMTP id l9-20020a17090a3f0900b0023d32684e7fso7634560pjc.1; Fri, 07 Apr 2023 01:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680855936; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=f36nO7o88eBlIdNJ8rqi2y7Ot3HHYbfyYZb9EEBi1c4=; b=DuyiTXMN1YSli4ShQxDowGTPSDXXhEeUjycrQQ4cZOExpMv3FWXVjHWppdlB7vdGN1 ivA8dxwQGwdXz7oHav7cQt8MT1B9BEymlzSrfIdMUefOoIMtETdW6iZQ2dZ7CFM9hdza KPwakUhiPqzOdlo+sUHK5cUxqrvsybL9yvmUqrjfnXQz5R/c8wgbdAnhhKY8krukDz4V P/0r53FWyF2ekifauY4/atBvRgO5CHgE/DekqOrep7eJuhHwFIcxG2KTfFisAcJCrlAQ aeiFBqVC1S+uXgGCsRVcIPQD3mdLwBLZWwRhUQgjaTau4N5EBvCoTloX0ofzCn07DVXe kSRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680855936; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f36nO7o88eBlIdNJ8rqi2y7Ot3HHYbfyYZb9EEBi1c4=; b=nKMHeeE+61lYGYfx5QOsG/vfAarWW3naZ5SSSdbSK0k68EDdjmwId/s68OaBdaT3Ak 1KXw2g6YEj+MgwlAEssqRar00nE7LlFLhjvVCrSrFntcw+xZjEdep5zzxmsYEbQJK5yO Yu1BjT+XtVZHxGxMopA9nElKp5aoNPTwOaCN+nYPYCEj6RcuWWnegPPySa+6AHMhrt2m PjXgegcpc3Tc4OGnJAfYN1EZLCsyN8JAWCeWH3zcs2gdDGoaoWCu/gXLBR4tjXZLtvKj F+XEWK68GtMSmL/xcc69uejlNmPD2QSM/JnobtyIfqTdTS0o/pqSld6UGmNWfmqkYSfD 45DA== X-Gm-Message-State: AAQBX9c3HFL20kBB2+pBG4Mex6h4TAQRYlILasvVYodCUTHi15OBkSSo Ujsqna7PJxBoAdM6wnl0gelSYEc1zIDQEx6+ X-Google-Smtp-Source: AKy350ZfIpSMqKjKOdQHFM/BDzrSnk3gKnr/5XWjajhTwrjV2heIpwKCD9hXw0rUCVxLnIzytfNfBw== X-Received: by 2002:a05:6a20:9321:b0:d4:fd7e:c8b0 with SMTP id r33-20020a056a20932100b000d4fd7ec8b0mr1991535pzh.7.1680855936060; Fri, 07 Apr 2023 01:25:36 -0700 (PDT) Received: from fedlinux.. ([106.84.131.166]) by smtp.gmail.com with ESMTPSA id fe12-20020a056a002f0c00b0062dcaa50a9asm2521331pfb.58.2023.04.07.01.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 01:25:35 -0700 (PDT) From: Sam Li To: qemu-devel@nongnu.org Cc: Kevin Wolf , Cornelia Huck , Markus Armbruster , Stefan Hajnoczi , Raphael Norwitz , damien.lemoal@opensource.wdc.com, qemu-block@nongnu.org, Eric Blake , Hanna Reitz , Paolo Bonzini , hare@suse.de, "Michael S. Tsirkin" , dmitry.fomichev@wdc.com, kvm@vger.kernel.org, Sam Li Subject: [PATCH v10 0/5] Add zoned storage emulation to virtio-blk driver Date: Fri, 7 Apr 2023 16:25:23 +0800 Message-Id: <20230407082528.18841-1-faithilikerun@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=faithilikerun@gmail.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds zoned storage emulation to the virtio-blk driver. It implements the virtio-blk ZBD support standardization that is recently accepted by virtio-spec. The link to related commit is at https://github.com/oasis-tcs/virtio-spec/commit/b4e8efa0fa6c8d844328090ad15db65af8d7d981 The Linux zoned device code that implemented by Dmitry Fomichev has been released at the latest Linux version v6.3-rc1. Aside: adding zoned=on alike options to virtio-blk device will be considered in following-up plan. v10: - adapt to the latest zone-append patches: rename bs->bl.wps to bs->wps v9: - address review comments * add docs for zoned emulation use case [Matias] * add the zoned feature bit to qmp monitor [Matias] * add the version number for newly added configs of accounting [Markus] v8: - address Stefan's review comments * rm aio_context_acquire/release in handle_req * rename function return type * rename BLOCK_ACCT_APPEND to BLOCK_ACCT_ZONE_APPEND for clarity v7: - update headers to v6.3-rc1 v6: - address Stefan's review comments * add accounting for zone append operation * fix in_iov usage in handle_request, error handling and typos v5: - address Stefan's review comments * restore the way writing zone append result to buffer * fix error checking case and other errands v4: - change the way writing zone append request result to buffer - change zone state, zone type value of virtio_blk_zone_descriptor - add trace events for new zone APIs v3: - use qemuio_from_buffer to write status bit [Stefan] - avoid using req->elem directly [Stefan] - fix error checkings and memory leak [Stefan] v2: - change units of emulated zone op coresponding to block layer APIs - modify error checking cases [Stefan, Damien] v1: - add zoned storage emulation Sam Li (5): include: update virtio_blk headers to v6.3-rc1 virtio-blk: add zoned storage emulation for zoned devices block: add accounting for zone append operation virtio-blk: add some trace events for zoned emulation docs/zoned-storage:add zoned emulation use case block/qapi-sysemu.c | 11 + block/qapi.c | 18 + docs/devel/zoned-storage.rst | 17 + hw/block/trace-events | 7 + hw/block/virtio-blk-common.c | 2 + hw/block/virtio-blk.c | 405 +++++++++++++++++++ hw/virtio/virtio-qmp.c | 2 + include/block/accounting.h | 1 + include/standard-headers/drm/drm_fourcc.h | 12 + include/standard-headers/linux/ethtool.h | 48 ++- include/standard-headers/linux/fuse.h | 45 ++- include/standard-headers/linux/pci_regs.h | 1 + include/standard-headers/linux/vhost_types.h | 2 + include/standard-headers/linux/virtio_blk.h | 105 +++++ linux-headers/asm-arm64/kvm.h | 1 + linux-headers/asm-x86/kvm.h | 34 +- linux-headers/linux/kvm.h | 9 + linux-headers/linux/vfio.h | 15 +- linux-headers/linux/vhost.h | 8 + qapi/block-core.json | 68 +++- qapi/block.json | 4 + 21 files changed, 794 insertions(+), 21 deletions(-)