From nobody Wed Oct 23 01:30:18 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=1728667583; cv=none; d=zohomail.com; s=zohoarc; b=Iic55T8WXcBgSxgIxVrUESd7Iz4Sscaa86Uqeqgel8a0FzY6qp/VGXrrcK32ioLClN/YIajC/ifkHeQvBI2EXG9QJj8tP8tQb3ltC963D9p9anSpylm0JLzdklCL57XainzHjYgIqG1sOPLHVyaoUhvIEdwo/fdYLpOHwf002xM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728667583; 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=USEpHR6NMIBW3vxaZJ60aZgKZIewwnVEOQkR5GTNazo=; b=b2Y9+pMtLJ8qE0lgizm5py10i5jWgIR2ussqidT2CP3hyc8fDy+3z6E0hwl3cISqvYnPwSBWbUxmPKfQmjfa6+Xom9XjAwX8mKX702LvhBWfDOE910Vuy2VOaN1jgSyvAb4D0PYa1m4OrT4cVs2ULVhjeKBI6wf1pAvDy5v1uDw= 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 1728667583757904.7890568529174; Fri, 11 Oct 2024 10:26:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1szJHA-0008MG-LY; Fri, 11 Oct 2024 13:18:06 -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 1szJ7j-0000hu-52 for qemu-devel@nongnu.org; Fri, 11 Oct 2024 13:08:24 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1szEW1-0004sM-GA for qemu-devel@nongnu.org; Fri, 11 Oct 2024 08:13:06 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20c544d34bcso18509605ad.1 for ; Fri, 11 Oct 2024 05:13:04 -0700 (PDT) Received: from TF4D9JK212.bytedance.net ([139.177.225.232]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8bc13551sm22569305ad.88.2024.10.11.05.12.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 11 Oct 2024 05:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1728648784; x=1729253584; 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=USEpHR6NMIBW3vxaZJ60aZgKZIewwnVEOQkR5GTNazo=; b=FE3u4rtFbMrqESaeb6WRRpCWSvfR9fQtN8hYuhN2wj/AeIuLeqCd50Czbp1a6wVGOj kfcKLKNYK0oxC5XW4RBYwNNjH1vmXWZhCgevTHEkL1XxRf8Mgg95ZrXKBTHUw7oStL9U 3DqA6k25akezh6pTHZ5z+YAdvDmiIMtBVJVcCMHNI8HBQVdMGwoSNYNPeZrY8+efKwHI IN49uP04ShjqHuRdT42ByUIXTQV0stJf/BcetzBD48P2IHZdQ/DCWcn6NLqsInl4VhqR ZRazXGjuhdciqNaoc+3bbPDQq4PA5DjpH65dR40Xhh8lFJT8L4J2LSaeYiJj4PTGovHq 6sfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728648784; x=1729253584; 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=USEpHR6NMIBW3vxaZJ60aZgKZIewwnVEOQkR5GTNazo=; b=lxR+3TBQSCsTvsy7UrBPKXPnaMSe1sj5JRCc6B0UYnH/S/weu4+8kdf4GlvqrQd5Yn 2cMzEx1TS+MuAgAafMZekPYWIjQHl5ajduc674D4bpoIr6tkCYsY80ufX3fVW8Eahvq0 rcP4cUoj+o+K7dgHz3W3n9YzMqbSSW98M+XyQDpA72GkrwffUWVeDXttt0Z0veLgKRTy agvgrVdsl/eJGOO9ykCW61xH+LMR6gBW9Jkzpgc4F2y+XZtR9q548gYz7DN/aael9PWQ RYhhQ31RDS2kTsRKO0NXPNuzwanuN9qwfL0wyOYXvkSEY2VHa5y0wtJSkN9lwrywSgPu i6ug== X-Forwarded-Encrypted: i=1; AJvYcCXkbaZsGfEvhl/ABSn4AEKEhVDhgQVUYHpg4l56CitaOxkHOP84d96f8NX2IxF0BO/g2u/reKLnf+Ow@nongnu.org X-Gm-Message-State: AOJu0YxKM79lA7/3j+HnTk5TNc+KpjHJyVXBUvW+C10dM70Nx6pO+Qa1 YlIsw4Kz+Cp41ggvG8k1r4zsWz57RDN0wMl+7hD+Hc/Rj+leXhD4IKWA5epfLZo= X-Google-Smtp-Source: AGHT+IHOeP+ieKVDOb9YqNP2fONackQXfHki2UBcSG+w/1oKwCN2ixu6UYkdVJrj4/dxb6g1yJULNg== X-Received: by 2002:a17:902:e845:b0:20c:5c52:5184 with SMTP id d9443c01a7336-20ca1431aa1mr40422045ad.17.1728648783717; Fri, 11 Oct 2024 05:13:03 -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, k.jensen@samsung.com, Changqi Lu Subject: [PATCH v14 03/10] scsi/constant: add persistent reservation in/out protocol constants Date: Fri, 11 Oct 2024 20:12:24 +0800 Message-Id: <20241011121231.18333-4-luchangqi.123@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20241011121231.18333-1-luchangqi.123@bytedance.com> References: <20241011121231.18333-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::62f; envelope-from=luchangqi.123@bytedance.com; helo=mail-pl1-x62f.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: 1728667584534116600 Content-Type: text/plain; charset="utf-8" Add constants for the persistent reservation in/out protocol in the scsi/constant module. The constants include the persistent reservation command, type, and scope values defined in sections 6.13 and 6.14 of the SCSI Primary Commands-4 (SPC-4) specification. Signed-off-by: Changqi Lu Signed-off-by: zhenwei pi Reviewed-by: Stefan Hajnoczi --- include/scsi/constants.h | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/include/scsi/constants.h b/include/scsi/constants.h index 9b98451912..922a314535 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -319,4 +319,56 @@ #define IDENT_DESCR_TGT_DESCR_SIZE 32 #define XCOPY_BLK2BLK_SEG_DESC_SIZE 28 =20 +typedef enum { + SCSI_PR_WRITE_EXCLUSIVE =3D 0x01, + SCSI_PR_EXCLUSIVE_ACCESS =3D 0x03, + SCSI_PR_WRITE_EXCLUSIVE_REGS_ONLY =3D 0x05, + SCSI_PR_EXCLUSIVE_ACCESS_REGS_ONLY =3D 0x06, + SCSI_PR_WRITE_EXCLUSIVE_ALL_REGS =3D 0x07, + SCSI_PR_EXCLUSIVE_ACCESS_ALL_REGS =3D 0x08, +} SCSIPrType; + +typedef enum { + SCSI_PR_LU_SCOPE =3D 0x00, +} SCSIPrScope; + +typedef enum { + SCSI_PR_OUT_REGISTER =3D 0x0, + SCSI_PR_OUT_RESERVE =3D 0x1, + SCSI_PR_OUT_RELEASE =3D 0x2, + SCSI_PR_OUT_CLEAR =3D 0x3, + SCSI_PR_OUT_PREEMPT =3D 0x4, + SCSI_PR_OUT_PREEMPT_AND_ABORT =3D 0x5, + SCSI_PR_OUT_REG_AND_IGNORE_KEY =3D 0x6, + SCSI_PR_OUT_REG_AND_MOVE =3D 0x7, +} SCSIPrOutAction; + +typedef enum { + SCSI_PR_IN_READ_KEYS =3D 0x0, + SCSI_PR_IN_READ_RESERVATION =3D 0x1, + SCSI_PR_IN_REPORT_CAPABILITIES =3D 0x2, +} SCSIPrInAction; + +typedef enum { + /* Exclusive Access All Registrants reservation type */ + SCSI_PR_CAP_EX_AC_AR =3D 1 << 0, + /* Write Exclusive reservation type */ + SCSI_PR_CAP_WR_EX =3D 1 << 9, + /* Exclusive Access reservation type */ + SCSI_PR_CAP_EX_AC =3D 1 << 11, + /* Write Exclusive Registrants Only reservation type */ + SCSI_PR_CAP_WR_EX_RO =3D 1 << 13, + /* Exclusive Access Registrants Only reservation type */ + SCSI_PR_CAP_EX_AC_RO =3D 1 << 14, + /* Write Exclusive All Registrants reservation type */ + SCSI_PR_CAP_WR_EX_AR =3D 1 << 15, + + SCSI_PR_CAP_ALL =3D (SCSI_PR_CAP_EX_AC_AR | + SCSI_PR_CAP_WR_EX | + SCSI_PR_CAP_EX_AC | + SCSI_PR_CAP_WR_EX_RO | + SCSI_PR_CAP_EX_AC_RO | + SCSI_PR_CAP_WR_EX_AR), +} SCSIPrCap; + #endif --=20 2.20.1