From nobody Sun Nov 24 22:37:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1720177082; cv=none; d=zohomail.com; s=zohoarc; b=KOECFBwAROI6Ec3Yn92nnoFs/XqqnN8415oyvS/qGjgGWg26ivezx9A2IXSS5VRusbYUnPaEgbjNcMw8AMmIS7touj570giJnVfVyOqP7SCQjHhzJsoIsmtghgfVaU5C/c6B/IJ0MiOv2dsAEx3xxzb3uCk+iDID17NECor4J/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720177082; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=alm7vM+qKN2FyJ/IuJ+5ag0uczfU/rBggLkQnuq48Wg=; b=L12u0Lz1g4SeDEteWIXO4B7OUmwljN6PQJLnQsYYocDxbf6ELsiEare7rBvvh//cv/0adDY8tvYIvDln7jLosfQrWp9tJDSPwg7RLPI4Cr1A53oSagqzirOOCl4YybnfOeHHdyyLxsiqEViDzfIJgke4IxSWg44wVDYi58fKvUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1720177082737494.23563848578647; Fri, 5 Jul 2024 03:58:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPgcV-0002Os-5S; Fri, 05 Jul 2024 06:56:51 -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 1sPgcS-0002NO-UJ for qemu-devel@nongnu.org; Fri, 05 Jul 2024 06:56:48 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPgcR-0006d2-BQ for qemu-devel@nongnu.org; Fri, 05 Jul 2024 06:56:48 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-75c3acf90f0so889860a12.2 for ; Fri, 05 Jul 2024 03:56:46 -0700 (PDT) Received: from n37-006-243.byted.org ([180.184.84.173]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac0ba60a2sm141292125ad.0.2024.07.05.03.56.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1720177006; x=1720781806; darn=nongnu.org; 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=alm7vM+qKN2FyJ/IuJ+5ag0uczfU/rBggLkQnuq48Wg=; b=NuloFEx7Ed0A+giYZ5wGEIIC/+PyElXOpM4GauqDMytzdQqdvgAnSa2PkiQ9hGeDog gUpsZe6CpcQOQm5mlUH58oSDh4d6aYjccVOUjL6pEyGJQmyUsJ3lMqIRomT25KYl0oTk DQNBuq7YoZe1b9EbXFiteddLk02Dr73EwEaV4DDWJpW2wLTCkctT2uF14Dv5MRLeAYVq 15QrD8I+v6GqCHCfBmOmd+dof52OSOatW/rjHQSXEoYm+V/0AUbqS+5CUzSsAieT/llw SOj2rNF/qRlAZ6y6iLYVVXbghd0IWwcpq4kReGPNM7iyvXC8BvQF7wKVtg3BoNdoGwO0 lSWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720177006; x=1720781806; 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=alm7vM+qKN2FyJ/IuJ+5ag0uczfU/rBggLkQnuq48Wg=; b=da50ozUDCb8cu01HTwHMPwZMELi8n59u8288Ia6bCMTfvdWURO3SFscZ0Ix9bGbU7i qr2OW8QwS6B8oQH0vz2t6zC+WBXvpvjCpHrUx2BbObTnJZIpH31PyHb90rX8MFc//Nwp QIbB+qkK91MhyGHrAt6L3+A3Kk/zLYgTz1lSP5vcVvxDUlZpTeo4se+QgEotmC5NAojQ CTyhvCVxKxF2zwmNgA6Ufbjw4uPCp+bLICr4xH4tnuGPQ+1o1zDs3OxB4Jn3E/0w73zf x/rKbYYy74SNfOFw311Lk6crSzqvMClRFCm01HLD9zpaASYhQ+iBmGWvbMQ+gd33qCFX h7HA== X-Forwarded-Encrypted: i=1; AJvYcCWj9cVW5V6qrgYAi/RCyIJoambdd2lWKJk7ycgCj80E3aKxRhopDYtSSFz8SynnWIUgeqovlJt1zSYw7fe8FKOXwvi+JgI= X-Gm-Message-State: AOJu0YwyliOnLZ+Lqdr1XnESAwysZKNaknZKt9aynKEFm/hP8zX2Btbc 2KmMhnPqDkPoJKyB4vAd8erNLzKpB3p8yYKeh9CkuyqfK/n7hnkitHFU8w6tKhY= X-Google-Smtp-Source: AGHT+IHZHU2D67aVq86uxb9tl4LyYd8FTnSYGNxQj7GstHopxRvXn9+7IB4jUJ6nFkBgTt8v4ueinA== X-Received: by 2002:a05:6a20:840b:b0:1bd:1e06:9dba with SMTP id adf61e73a8af0-1c0cc75b3a6mr4361105637.27.1720177005942; Fri, 05 Jul 2024 03:56:45 -0700 (PDT) From: Changqi Lu To: qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, hreitz@redhat.com, stefanha@redhat.com, fam@euphon.net, ronniesahlberg@gmail.com, pbonzini@redhat.com, pl@dlhnet.de, kbusch@kernel.org, its@irrelevant.dk, foss@defmacro.it, philmd@linaro.org, pizhenwei@bytedance.com, Changqi Lu Subject: [PATCH v7 06/10] block/nvme: add reservation command protocol constants Date: Fri, 5 Jul 2024 18:56:10 +0800 Message-Id: <20240705105614.3377694-7-luchangqi.123@bytedance.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240705105614.3377694-1-luchangqi.123@bytedance.com> References: <20240705105614.3377694-1-luchangqi.123@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=luchangqi.123@bytedance.com; helo=mail-pg1-x52c.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bytedance.com) X-ZM-MESSAGEID: 1720177083403100003 Content-Type: text/plain; charset="utf-8" Add constants for the NVMe persistent command protocol. The constants include the reservation command opcode and reservation type values defined in section 7 of the NVMe 2.0 specification. Signed-off-by: Changqi Lu Signed-off-by: zhenwei pi Reviewed-by: Stefan Hajnoczi --- include/block/nvme.h | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/include/block/nvme.h b/include/block/nvme.h index bb231d0b9a..8b125f7769 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -633,7 +633,11 @@ enum NvmeIoCommands { NVME_CMD_WRITE_ZEROES =3D 0x08, NVME_CMD_DSM =3D 0x09, NVME_CMD_VERIFY =3D 0x0c, + NVME_CMD_RESV_REGISTER =3D 0x0d, + NVME_CMD_RESV_REPORT =3D 0x0e, + NVME_CMD_RESV_ACQUIRE =3D 0x11, NVME_CMD_IO_MGMT_RECV =3D 0x12, + NVME_CMD_RESV_RELEASE =3D 0x15, NVME_CMD_COPY =3D 0x19, NVME_CMD_IO_MGMT_SEND =3D 0x1d, NVME_CMD_ZONE_MGMT_SEND =3D 0x79, @@ -641,6 +645,63 @@ enum NvmeIoCommands { NVME_CMD_ZONE_APPEND =3D 0x7d, }; =20 +typedef enum { + NVME_RESV_REGISTER_ACTION_REGISTER =3D 0x00, + NVME_RESV_REGISTER_ACTION_UNREGISTER =3D 0x01, + NVME_RESV_REGISTER_ACTION_REPLACE =3D 0x02, +} NvmeReservationRegisterAction; + +typedef enum { + NVME_RESV_RELEASE_ACTION_RELEASE =3D 0x00, + NVME_RESV_RELEASE_ACTION_CLEAR =3D 0x01, +} NvmeReservationReleaseAction; + +typedef enum { + NVME_RESV_ACQUIRE_ACTION_ACQUIRE =3D 0x00, + NVME_RESV_ACQUIRE_ACTION_PREEMPT =3D 0x01, + NVME_RESV_ACQUIRE_ACTION_PREEMPT_AND_ABORT =3D 0x02, +} NvmeReservationAcquireAction; + +typedef enum { + NVME_RESV_WRITE_EXCLUSIVE =3D 0x01, + NVME_RESV_EXCLUSIVE_ACCESS =3D 0x02, + NVME_RESV_WRITE_EXCLUSIVE_REGS_ONLY =3D 0x03, + NVME_RESV_EXCLUSIVE_ACCESS_REGS_ONLY =3D 0x04, + NVME_RESV_WRITE_EXCLUSIVE_ALL_REGS =3D 0x05, + NVME_RESV_EXCLUSIVE_ACCESS_ALL_REGS =3D 0x06, +} NvmeResvType; + +typedef enum { + NVME_RESV_PTPL_NO_CHANGE =3D 0x00, + NVME_RESV_PTPL_DISABLE =3D 0x02, + NVME_RESV_PTPL_ENABLE =3D 0x03, +} NvmeResvPTPL; + +typedef enum NVMEPrCap { + /* Persist Through Power Loss */ + NVME_PR_CAP_PTPL =3D 1 << 0, + /* Write Exclusive reservation type */ + NVME_PR_CAP_WR_EX =3D 1 << 1, + /* Exclusive Access reservation type */ + NVME_PR_CAP_EX_AC =3D 1 << 2, + /* Write Exclusive Registrants Only reservation type */ + NVME_PR_CAP_WR_EX_RO =3D 1 << 3, + /* Exclusive Access Registrants Only reservation type */ + NVME_PR_CAP_EX_AC_RO =3D 1 << 4, + /* Write Exclusive All Registrants reservation type */ + NVME_PR_CAP_WR_EX_AR =3D 1 << 5, + /* Exclusive Access All Registrants reservation type */ + NVME_PR_CAP_EX_AC_AR =3D 1 << 6, + + NVME_PR_CAP_ALL =3D (NVME_PR_CAP_PTPL | + NVME_PR_CAP_WR_EX | + NVME_PR_CAP_EX_AC | + NVME_PR_CAP_WR_EX_RO | + NVME_PR_CAP_EX_AC_RO | + NVME_PR_CAP_WR_EX_AR | + NVME_PR_CAP_EX_AC_AR), +} NvmePrCap; + typedef struct QEMU_PACKED NvmeDeleteQ { uint8_t opcode; uint8_t flags; --=20 2.20.1