From patchwork Sun Jan 29 10:28:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 1733534 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=cn4fM91M; 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 4P4SJF0g3tz23gY for ; Sun, 29 Jan 2023 21:30:37 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pM4wE-0005Ji-Le; Sun, 29 Jan 2023 05:29:30 -0500 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 1pM4vv-0005Hc-Ue; Sun, 29 Jan 2023 05:29:17 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pM4vu-0007Ag-8Y; Sun, 29 Jan 2023 05:29:11 -0500 Received: by mail-pl1-x635.google.com with SMTP id be8so8892301plb.7; Sun, 29 Jan 2023 02:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=YqDn66EjQd4XlWrdM2GVsx0GNeNoXLpdBxKQzaRYzMY=; b=cn4fM91MTDXWKoft/t+y0OnX3dclfSljTqcR2zTqe/ApFN6/lFcna/nBYvZjavIlxI +0P5t8EUdeH4HbTPY2xuuuFVdATV//TwjVO1GCoClE2kDWav8i/8oEPgoWTWiiHrY0lY wcCbSxqu+PeuYop3j8Su58+d5RfwfyHicns6H1QKaiyKU02I3bsi1NsuBKyVGerx7CIm 4il/C9fdgzdk3Fm7cb9F2pKA0Jcmuoptoc7267o6EF9p+pObBw5FyhYcF7bocozUjrjs s3yrcKrY2xL3pccIh4Q7wm2iu1qgbqZMgN/G3RA3b3GliyRNF5syU9zrvoTCTYlLCY9o PL7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=YqDn66EjQd4XlWrdM2GVsx0GNeNoXLpdBxKQzaRYzMY=; b=tHTsF1qcjtYEHZwqUVG7tPZUrcwzQLMvdy3//bcjXA6iQUkj1Z6Rs4EZ6gfXn2FT7x uINKylmw/vbo0lt8mcb7zPwHBRLOaFC27UO04uodfkO0YASLak5FK8TX+yLQf92Q4svu eHle3AFtaeeI011ZIC9cvjUuWO/2Kcjs3mTSv+nEBU4vvfdO8KgWY610/pyFHI1KAS+1 oo/cvr5bvvieZgXtSL0uesuWj9HaxHnU/lAHS1g7768m52WGRGTGBub+CuRVuN38pity 7Vl0P7q3o31NJJabLOeha5TG+s/FHnArA8mJe9AEKpskqtJuX0q+9uQ8uzDau8MVG8Ej AO5Q== X-Gm-Message-State: AFqh2kpOLOorBo1fOX5DYw0CE2VYcgMiReQ7oIN3ONH7mvF4x8G7i4qB Cz7MRVMQ3Oerdq7YC91TzSgQGExBF4kLXgxFiTU= X-Google-Smtp-Source: AMrXdXsDz7mwfotFfuAMF1mM4Scdh29BPdGT+nSLTvg2m+Hzk7k7K6r3dDDKKN2QrBhkVfGCfKeTPQ== X-Received: by 2002:a05:6a20:4295:b0:b8:9c66:cd64 with SMTP id o21-20020a056a20429500b000b89c66cd64mr60701740pzj.14.1674988147442; Sun, 29 Jan 2023 02:29:07 -0800 (PST) Received: from fedlinux.. ([106.84.129.237]) by smtp.gmail.com with ESMTPSA id jl1-20020a170903134100b0019644d4242dsm5439416plb.82.2023.01.29.02.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Jan 2023 02:29:06 -0800 (PST) From: Sam Li To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Paolo Bonzini , Hanna Reitz , dmitry.fomichev@wdc.com, hare@suse.de, damien.lemoal@opensource.wdc.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fam Zheng , Thomas Huth , =?utf-8?q?Danie?= =?utf-8?q?l_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Sam Li Subject: [PATCH v15 1/8] include: add zoned device structs Date: Sun, 29 Jan 2023 18:28:43 +0800 Message-Id: <20230129102850.84731-2-faithilikerun@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230129102850.84731-1-faithilikerun@gmail.com> References: <20230129102850.84731-1-faithilikerun@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=faithilikerun@gmail.com; helo=mail-pl1-x635.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 --- 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 41686810de..211fbc0847 100644 --- a/include/block/block-common.h +++ b/include/block/block-common.h @@ -58,6 +58,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;