From patchwork Thu Apr 27 17:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 13225626 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 1F7BFC77B73 for ; Thu, 27 Apr 2023 17:21:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps5IV-0006KR-8P; Thu, 27 Apr 2023 13:20:47 -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 1ps5IU-0006Jg-9O; Thu, 27 Apr 2023 13:20:46 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ps5IO-0007KZ-W4; Thu, 27 Apr 2023 13:20:46 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1a66888cb89so68086665ad.3; Thu, 27 Apr 2023 10:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682616039; x=1685208039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w9iJ0TtvzUwBpKUP/uL1GmcFj9lAgNDwrL1rkCpsmvw=; b=BorAWrGyFZwg3ZkHNq9yphJxFyqdPuDGLQQpGPeNCqhsv021WcMJIdUs3d4JolFuqE rn2P55zxrSnXvrlkJv2aq8ZI2A1jKrNAqs7h40zezJ9eg2TgesUaIu3p8Az/I9Lc3gC0 ARSRHdYAzvERbY1AfRjZ5vPFx6Eo/B3iJFmWj9uF20nVHAXs10OjFANNReANnMj7ucj0 1eCD00y8bq20TlW0RKDdS/SySDPb/lvs2IN3mP/6SnRLRTdix3U6PM1G3QN4IENxBCAs zIyRaMRDSOE3wwEfQEogOhcSqmH5xY2SrXKEfKTSIlW/1z3CEvCImcbvGeq3eTOWzIql 5vSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682616039; x=1685208039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w9iJ0TtvzUwBpKUP/uL1GmcFj9lAgNDwrL1rkCpsmvw=; b=crNJtl8ET7znWanrrsG2RYNEXZfc4IA2hhal2eJ5wbfW+MGNiiaIV0KAWaPjvu1Wi4 Pfq7EXeRlcrPrTV3x3cJy9/uPGFwdbPK+EsbT+/1D5mhdiy5ZzkZwRSey/aGWHak1doZ QdYEskxdlySTVZ0WRQUnVOHCGLGV613Te4GkbDp01DTGfboOk53lubsRRqaRjrqqg1VV VjipIVH9C18Uhsr3bDM8xSkVCVy31qDk1/bzg8P+A7TN+YnumD6I3rvlf0CL8d+G9iIp dqSgASI0a1vZC1JZYz4mfG+dUZArXkbSplQAz79rPV3cxQdln9EcPfLcACMXs7ZPNVr7 Eq/A== X-Gm-Message-State: AC+VfDy478b4cbgkvED3xByRjTQ8qZYWMF5ZJFmTHUiOgat8CuuU9iaS wQl/3VhYOFGtXraJFvsSqCHvRZLTK6QuGzPmqoI= X-Google-Smtp-Source: ACHHUZ4/sru7bLllRSwbw8pQxC82u8dxzVH8DGbUScmVq/yh41AeAP3ntYTkHBbUpUFGYqre5wYntQ== X-Received: by 2002:a17:902:f20a:b0:1a6:c110:9029 with SMTP id m10-20020a170902f20a00b001a6c1109029mr2149932plc.59.1682616038504; Thu, 27 Apr 2023 10:20:38 -0700 (PDT) Received: from fedlinux.. ([106.84.128.101]) by smtp.gmail.com with ESMTPSA id p1-20020a170902a40100b001a95c7742bbsm8878578plq.9.2023.04.27.10.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 10:20:38 -0700 (PDT) From: Sam Li To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Kevin Wolf , Fam Zheng , Paolo Bonzini , dlemoal@kernel.org, hare@suse.de, Hanna Reitz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , stefanha@redhat.com, dmitry.fomichev@wdc.com, qemu-block@nongnu.org, Sam Li , Damien Le Moal Subject: [PATCH v19 1/8] block/block-common: add zoned device structs Date: Fri, 28 Apr 2023 01:20:12 +0800 Message-Id: <20230427172019.3345-2-faithilikerun@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427172019.3345-1-faithilikerun@gmail.com> References: <20230427172019.3345-1-faithilikerun@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=faithilikerun@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-2-faithilikerun@gmail.com [Adjust commit message prefix as suggested by Philippe Mathieu-Daudé . --Stefan] Signed-off-by: Stefan Hajnoczi --- 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 b5122ef8ab..1576fcf2ed 100644 --- a/include/block/block-common.h +++ b/include/block/block-common.h @@ -75,6 +75,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 BlockZoneState { + 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, +} BlockZoneState; + +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; + BlockZoneState state; +} BlockZoneDescriptor; + typedef struct BlockDriverInfo { /* in bytes, 0 if irrelevant */ int cluster_size;