From patchwork Mon May 8 04:55:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 13234038 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 E673AC77B73 for ; Mon, 8 May 2023 04:57:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvsue-00017k-DL; Mon, 08 May 2023 00:55:52 -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 1pvsuc-00015D-PG; Mon, 08 May 2023 00:55:50 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pvsub-0005Sh-5n; Mon, 08 May 2023 00:55:50 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1aaed87d8bdso27665675ad.3; Sun, 07 May 2023 21:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683521747; x=1686113747; 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=N3I+a2J9v2mbzObGHYJbJ17RnQpzUA997dNUvxRv4Uo6bb1Jy1vv4BpyqF2+tGcN9K 37NQmHCNmjKeQT917wg8K2qfsp0KRXfVQ13FaAfL8joakpuyAKQsPFRLqxS9Qs4awMv1 NgUagzypDAlcArbM/qm4cz1kMv+qE7WG45n65++ZfjVkv4bbv+EjIMIdo1FbhVlHd0wg uZbkvt/+ENItukcB0F/mzkSSKwYdt1Dv1kl38AxK1D29ANoRDCH7mLBtYwHz/4ZOLAe0 mv4pqGwgo1BNd6nhxmVXy+X4TRWAkwkP47ZbldlAUHDzlyR2XVzjksKiCVpbCY8aCMG4 Kkig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683521747; x=1686113747; 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=jFcXCiCmyuA9z9KPivOWssu8uMHNiflFOiqt9oUiQ7+yHah6nUmlsWiDB/G9+0hnQP iNA4URbrOl0QXEgpcgwXjN/LGIR5Bv2GNCYI8NuZpz3UWn0zgNrJhmW0codilSJw1kFA l8QOXH3/BC7FyDTyUGbPro/wuU51uz2D9Ury1Ana7njvK0N95ZBF8a2vvtTDCzk2gszA aV59pJVycK0WIK7wI/uCb0QEmI8gLnhWnwKSJ2AthPf49a3alkWH9FS+7v+KXWQyJfMq ghuId0Pnif7QX5/B60q+IEsKTyirzi9ZNjPJlWr8vgUyVv/HCSr+/wv8ZzM57u6Wl7cE uKZw== X-Gm-Message-State: AC+VfDwa6+pcKJrlmhN63pKo6KpV1jQbPBJsb9v9JkwM5upMsdvmhBcU +FJ5tfj5ibgXiNby/cH2j7jjwfp060ZrYPM+ X-Google-Smtp-Source: ACHHUZ7ULhghDvE7TxeiWyxPo98We1NtsknussT6AUWnVBjlu27ZOlu5rYEDg0v3YtmuzWfWxb2a2A== X-Received: by 2002:a17:902:c115:b0:1a0:4ebd:15d5 with SMTP id 21-20020a170902c11500b001a04ebd15d5mr8862789pli.67.1683521746659; Sun, 07 May 2023 21:55:46 -0700 (PDT) Received: from fedlinux.. ([106.84.128.239]) by smtp.gmail.com with ESMTPSA id bg12-20020a1709028e8c00b0019ef86c2574sm6007112plb.270.2023.05.07.21.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 May 2023 21:55:46 -0700 (PDT) From: Sam Li To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , qemu-block@nongnu.org, Hanna Reitz , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , dmitry.fomichev@wdc.com, Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Kevin Wolf , Thomas Huth , dlemoal@kernel.org, hare@suse.de, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Sam Li , Damien Le Moal Subject: [PATCH v20 1/8] block/block-common: add zoned device structs Date: Mon, 8 May 2023 12:55:26 +0800 Message-Id: <20230508045533.175575-2-faithilikerun@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230508045533.175575-1-faithilikerun@gmail.com> References: <20230508045533.175575-1-faithilikerun@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=faithilikerun@gmail.com; helo=mail-pl1-x630.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;