From patchwork Fri Aug 26 16:03:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 12956262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E131ECAAA3 for ; Fri, 26 Aug 2022 16:13:33 +0000 (UTC) Received: from localhost ([::1]:39904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRbxc-00027C-Dj for qemu-devel@archiver.kernel.org; Fri, 26 Aug 2022 12:13:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRbor-0002cb-No; Fri, 26 Aug 2022 12:04:30 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:43703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRbom-0005NG-2t; Fri, 26 Aug 2022 12:04:25 -0400 Received: by mail-pf1-x435.google.com with SMTP id 142so1940302pfu.10; Fri, 26 Aug 2022 09:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=M+DatxmpZVPjexrzp79M4RQhH3Af/G9By4KEv/QeAgQ=; b=jio+ySrN6XLqf6846aO2H8jV0NhUTwqr/2z28yw0RvwS4ZsjdgbRovsquYdoLfDLef iEHTl8TkULVsdPLsFdmVWcCYmkhfY8Pz0way8W9CzkEZnkEZ4OsrgYfcTxMpgycCXtBo gagasZ4xY5q+NXUvu/CyeMyqvMEwqq77thDsr25Yoy88yVJh2BqxQCnJz3TvqzROb83c 21SKFykOmMSNiLLxG7U3dqwPoKFwSkWmimF4OMLhd/VFQSGONKpxn3okaRDQayq9/sMF 08Ud5UzTi8PnTxnFc+zi+eu85+hI/YE3Tt2qkWpjA5SuxFL69l5ZPGQ/EoDjFUxL27lY YyOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=M+DatxmpZVPjexrzp79M4RQhH3Af/G9By4KEv/QeAgQ=; b=vChH5iwYMXiwt0GqqmnOJ/3Co6RKdvjx5gAZnaBdZ/r0Je3jd4IUfTjzBWdYGOAiFC MwWK2ZREtvwag34fkTN0OTpbirWVI1C74PeJDNL3Stk4sr5+U1zn7TAEACDMgwLnwBCa TY2Okk6EJDufZjlcj4kMARgrKdukWHJa0iYF5HEmPLYwsBJDJZZnVcrijCQQDVeS1HGV SiM13H3dl6ei4WQYD7EAaHPZee1GS7nZNNXEcruJ7zy+LgiyWtuQfO0gBuRFun6A1DbX U5NCOfO7Xc3YpaZQy3qx3xlkwhay20cNoTGc/zXxntjQP33gc18vvGZi2s4/p7CpHQww CfhA== X-Gm-Message-State: ACgBeo0EjRXjS++9rM6ISLHcauBZYRBmtj2n+iThxcMy8jYiBwmlpntA 726Or3NSlz+4FsuwJa5Aktn7xIOdR/LWLw== X-Google-Smtp-Source: AA6agR7whGm5/vY30eibA3wApwlTKYJBb5c+r0TIJrqEw2wf/R7yvEZ9CZFlBx0X+tPUmvz6OFNOqg== X-Received: by 2002:a63:b03:0:b0:429:c549:d1f1 with SMTP id 3-20020a630b03000000b00429c549d1f1mr3823298pgl.131.1661529861268; Fri, 26 Aug 2022 09:04:21 -0700 (PDT) Received: from roots.. ([106.84.135.2]) by smtp.gmail.com with ESMTPSA id z14-20020a1709027e8e00b00172f0184b54sm1732002pla.156.2022.08.26.09.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 09:04:20 -0700 (PDT) From: Sam Li To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, damien.lemoal@opensource.wdc.com, Dmitry.Fomichev@wdc.com, hare@suse.de, qemu-block@nongnu.org, hreitz@redhat.com, eblake@redhat.com, armbru@redhat.com, fam@euphon.net, kwolf@redhat.com, Sam Li Subject: [PATCH v8 1/7] include: add zoned device structs Date: Sat, 27 Aug 2022 00:03:56 +0800 Message-Id: <20220826160356.6437-1-faithilikerun@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=faithilikerun@gmail.com; helo=mail-pf1-x435.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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal --- include/block/block-common.h | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/include/block/block-common.h b/include/block/block-common.h index fdb7306e78..36bd0e480e 100644 --- a/include/block/block-common.h +++ b/include/block/block-common.h @@ -49,6 +49,49 @@ typedef struct BlockDriver BlockDriver; typedef struct BdrvChild BdrvChild; typedef struct BdrvChildClass BdrvChildClass; +typedef enum BlockZoneOp { + BLK_ZO_OPEN, + BLK_ZO_CLOSE, + BLK_ZO_FINISH, + BLK_ZO_RESET, +} BlockZoneOp; + +typedef enum BlockZoneModel { + BLK_Z_NONE = 0x0, /* Regular block device */ + BLK_Z_HM = 0x1, /* Host-managed zoned block device */ + BLK_Z_HA = 0x2, /* Host-aware zoned block device */ +} BlockZoneModel; + +typedef enum BlockZoneCondition { + BLK_ZS_NOT_WP = 0x0, + BLK_ZS_EMPTY = 0x1, + BLK_ZS_IOPEN = 0x2, + BLK_ZS_EOPEN = 0x3, + BLK_ZS_CLOSED = 0x4, + BLK_ZS_RDONLY = 0xD, + BLK_ZS_FULL = 0xE, + BLK_ZS_OFFLINE = 0xF, +} BlockZoneCondition; + +typedef enum BlockZoneType { + BLK_ZT_CONV = 0x1, /* Conventional random writes supported */ + BLK_ZT_SWR = 0x2, /* Sequential writes required */ + BLK_ZT_SWP = 0x3, /* Sequential writes preferred */ +} BlockZoneType; + +/* + * Zone descriptor data structure. + * Provides information on a zone with all position and size values in bytes. + */ +typedef struct BlockZoneDescriptor { + uint64_t start; + uint64_t length; + uint64_t cap; + uint64_t wp; + BlockZoneType type; + BlockZoneCondition cond; +} BlockZoneDescriptor; + typedef struct BlockDriverInfo { /* in bytes, 0 if irrelevant */ int cluster_size;