From nobody Mon Nov 25 12:53:56 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=1715572512; cv=none; d=zohomail.com; s=zohoarc; b=fDo/XEoQ6CbcCbYUDdqBq9HWJI9HXeUVqIBNaWGXsCbTyjSa2A6KRtikKRy/ojxzMErDycK/bX0IJ/1aJXsPunXdEK5LEJRbUls/4H8Jyudi8bTR7UtR77H9Z8J+n5eYtNvN0Hsc1Y6VVM6i51lBNispGg6Yyx/4NKQvUHdDqiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715572512; 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=6HqjfLbdxMaAm2Kc6kgGY9B3YsreiqnlUzVf4xDnoFw=; b=nHaofMzBZAd4WR9bZnjRYg6ejxjeWWcijLRvwMd6C22Bz7ptTJ7j/5zSnzykbqMD8MlNvfuQbgVntIurgbBsGVJbZKu+2pESsBp6KoxzRyu7fr84GsbKIfBOV+NGYvVxxkhxZdntYHtw+qauVQdqAHGakzV6nZIOAIrhRLldqeQ= 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 1715572512713147.19033886124578; Sun, 12 May 2024 20:55:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6Mkn-0001Of-EU; Sun, 12 May 2024 23:53:33 -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 1s6MkZ-0001MG-W3 for qemu-devel@nongnu.org; Sun, 12 May 2024 23:53:23 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6MkY-0008M0-Ay for qemu-devel@nongnu.org; Sun, 12 May 2024 23:53:19 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6f4603237e0so2637613b3a.0 for ; Sun, 12 May 2024 20:53:16 -0700 (PDT) Received: from n37-006-243.byted.org ([180.184.51.40]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a8137asm6407947b3a.45.2024.05.12.20.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 20:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1715572395; x=1716177195; 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=6HqjfLbdxMaAm2Kc6kgGY9B3YsreiqnlUzVf4xDnoFw=; b=GQwZumdB8NLl9aIU0/UHh/UgUnBfbgO6z6JqPWHWkX0uYkYK/4EYjparhBcYhb1AeY 14hGya2cPHEeFLq0C36/ynPxFM4SJqWUd43YUouWNn2ThX2jteMI64jCAt3tK5IR727f G9jzDZn3sxyaUea1rfLBuoQjiM6z9i76X0CwfetB2Jj5mtHNEAcBF0w2rziyX/pdiI9I VSO7nnBcmqc+y/UWPN5Wn+cRa+k0ueQcSlCggVjtoWvX1hUrSS0udrqJfkrJHhVGEamK +OLbt6GY/yonki7z4MvVN68h87uFaaYWBhbbd2wEIa8TjSr74k7K5SyUBYD9UzNC8gAg i8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715572395; x=1716177195; 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=6HqjfLbdxMaAm2Kc6kgGY9B3YsreiqnlUzVf4xDnoFw=; b=tL9CpTTf09u5r7YMWKdHsogA6ba/k9JIyVTkk757GCnK20ey94e4u2gzjU8wPlOcSf NEYknHX8NgvLjI2uhoGLDgqPceTNpLOYnK3xVUDd06driXNGwmogxJpSEYRBCZ07JM/9 ep+UgxLexrPY9/9+k36mIBjTsWGG3DPUoHOBt8uyAQn+Ppc9R/JXpWypYw34AtX3fkJ0 2zbWfvh8fPH0//lqgtRSsZrAPj1erG20d89rshjQCBjxsAt9vSJ9RCXIY0zZNyj/ft44 jl3PS9ZukKQhKWyL8k24y9OzPnX+peCgKVDkxZj1RVJa2t1CyeFcbAg+nrCFw2eGS35G G3Jw== X-Forwarded-Encrypted: i=1; AJvYcCUOiaqS/lKYgu7BtpuUtWiEFSvJtFAyjKq+5YF0/3NsF/RtzQM70sqldP8n5d0kDwaPXQNLDnz2FXrjYTWrVYAFDhr/Zog= X-Gm-Message-State: AOJu0YximUfdiUtOuVwAqpso+KMbKFNwT5kTmXjCda+YZyQC21+IazYY O+wcbLCnRENaJmZ4wFVniVmSCw+kzCVAEFhKiwpSCHu/V+qvsi8PdNSwf8Hq5rs= X-Google-Smtp-Source: AGHT+IF+6QK2UMCytKPLngLJySnjzawj1JAR3X7rQAdzPrhyH33AyUpyaf4ms23gdoyW95hfqwtEvA== X-Received: by 2002:a05:6a00:3d15:b0:6f3:eb71:af90 with SMTP id d2e1a72fcca58-6f4df3ba92amr14867225b3a.4.1715572395246; Sun, 12 May 2024 20:53:15 -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 v2 09/11] hw/nvme: enable namespace rescap function Date: Mon, 13 May 2024 11:52:28 +0800 Message-Id: <20240513035230.60162-10-luchangqi.123@bytedance.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240513035230.60162-1-luchangqi.123@bytedance.com> References: <20240513035230.60162-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::42a; envelope-from=luchangqi.123@bytedance.com; helo=mail-pf1-x42a.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: 1715572514215100003 Content-Type: text/plain; charset="utf-8" This commit enables the rescap function in the namespace by detecting the supported reservation function in the backend driver. Signed-off-by: Changqi Lu Signed-off-by: zhenwei pi --- hw/nvme/ns.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index ea8db175db..68a18636fb 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -20,6 +20,7 @@ #include "qemu/bitops.h" #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" +#include "block/block_int.h" =20 #include "nvme.h" #include "trace.h" @@ -55,6 +56,12 @@ void nvme_ns_init_format(NvmeNamespace *ns) } =20 id_ns->npda =3D id_ns->npdg =3D npdg - 1; + + /* The persistent reservation capacities of block + * and nvme are currently defined the same. + * If there are subsequent changes, this part needs to be changed. + */ + id_ns->rescap =3D blk_bs(ns->blkconf.blk)->file->bs->bl.pr_cap; } =20 static int nvme_ns_init(NvmeNamespace *ns, Error **errp) --=20 2.20.1