From patchwork Fri Mar 24 09:05:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 1760811 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=I4/ueIsb; 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 4Pjnkg0v13z1yYB for ; Sat, 25 Mar 2023 03:30:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfdO8-0002bE-LO; Fri, 24 Mar 2023 05:07:08 -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 1pfdO7-0002ay-38; Fri, 24 Mar 2023 05:07:07 -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 1pfdNw-0000Ca-PK; Fri, 24 Mar 2023 05:07:06 -0400 Received: by mail-pl1-x634.google.com with SMTP id kq3so1226311plb.13; Fri, 24 Mar 2023 02:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679648783; 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=n+CbpVSwBJxpxcUkdWiFrKKRvpiWwCBIOF3ETh/P8ow=; b=I4/ueIsbMc/1JXz1gU4xwKu+EidXSlFTI6jgE9c7E8bCMr3oWKYAZqJDZwCj0hEvIb Zn0el8uYZa2tBeCi5yEWkMnnuFS5DidLVQuLvI/Vwqdk2b4Y5JDDk7vWxylJRFeJNQT3 izcpNOl4V4LGSi6Pg8N9YNXcKv8wlxSsrhBJ5h+61z0Fp2DWU7JrZYIDSRM47qKCD8Mp 8k2jVmvOcf/x8oFBU5t4w/UtFpXTZQ+JPFco88ggx9ug0H9mbtk2ojQ5hFvofm+p9ey5 nmAyTW6PCY9t2BPXvYNL+t9rnEpTAcBJZ20LcBBc3wlXkrhq46fbIZOKighF3p4dPeaZ Vs3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679648783; 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=n+CbpVSwBJxpxcUkdWiFrKKRvpiWwCBIOF3ETh/P8ow=; b=NfpVN/O6AuzZWoyAIEAS6fxxwvpcZCeQkDbF0zG4zr/WGm2/URjm5NaPAwGzmTPsvv g4FlLFKBnxhJa1jsyLoJEmXS8xljRa63199TfduVbpSj+hqOKVDouApxnBeAUvVL24Me fM2FNW20Nsyc5U58ko0derTxRpoSBP0d04FJwt9dOFlywuWC4OglnZOAviJlqx0wLZCa /exlk83fzSpR0rqz5oIke+43GILTKvR7GDf7LagbiQtNAmCst8A/Jimabmzo8w/kPyWU gMPKe+RdsbnUU72xE1Nu86gpx7EPcd7QUwNiY9BXvvBBR1IX+D/D91yMEl4qlnuWBYqH fJeg== X-Gm-Message-State: AAQBX9d/HIwtLwO8LiOCs5xldQhuTrXyuHJz3tRej31SU2tr5urHjOOG QA4ACZkxaT8l7esARjnAc/uwAvNzDf3ZEXBF X-Google-Smtp-Source: AKy350bdlX5tXGQxl3vkPNLLVtAsAkiu2dOoed7a0zRXNpgMWydj3ug9XM0GM1g3qgDpQTsDR3kIJQ== X-Received: by 2002:a17:903:7cf:b0:1a1:c792:8e73 with SMTP id ko15-20020a17090307cf00b001a1c7928e73mr1605936plb.60.1679648782284; Fri, 24 Mar 2023 02:06:22 -0700 (PDT) Received: from fedlinux.. ([106.84.130.185]) by smtp.gmail.com with ESMTPSA id u4-20020a170902b28400b001a06b33923bsm13722350plr.164.2023.03.24.02.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 02:06:21 -0700 (PDT) From: Sam Li To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Fam Zheng , Hanna Reitz , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , hare@suse.de, damien.lemoal@opensource.wdc.com, dmitry.fomichev@wdc.com, qemu-block@nongnu.org, Sam Li Subject: [PATCH v18 1/8] include: add zoned device structs Date: Fri, 24 Mar 2023 17:05:58 +0800 Message-Id: <20230324090605.28361-2-faithilikerun@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230324090605.28361-1-faithilikerun@gmail.com> References: <20230324090605.28361-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: -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 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev --- 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;