From patchwork Wed Feb 14 22:23:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 13557116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 281F4C48BC3 for ; Wed, 14 Feb 2024 22:24:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raNfT-0002yt-Iv; Wed, 14 Feb 2024 17:23:51 -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 1raNfP-0002yC-DP; Wed, 14 Feb 2024 17:23:47 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raNfN-0004LC-Sl; Wed, 14 Feb 2024 17:23:47 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e104a8e3f7so284070b3a.1; Wed, 14 Feb 2024 14:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707949424; x=1708554224; 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=js9MPuxE6HDFGb/bm1Qi8CQe6wvYU0HraTNqQ6YK0o4=; b=Ay9qMNrYgER2xOMZL+vJZOksnwalFAA73ji2cdpZxtz3CZ6RtJTUJT+PtaysKdWct5 qYpe4gwK22ceeV8LygmGRMQNmZnW/vP2xgnp8vWkiDGEXhYVSQJsUqD9EsMke/OM8/eP 4amCbDb2PSevNR75kMgUz4W1gsdLU3VFYgoxYF0VrRxktTR0TBK8on3AkiIKC4LLy4UD bNN3Xy83zAL/NtA2HDgS2OzoPRaPDIba9J6E9QbuY7KZ8qNCuQLFFwttiYraxkgpkPU3 AhjeH5cW7/znayBMhu5QuoFQiXbx8r4P4yQnNbmjLzC/o1tcOcji11PArpLatMbIujWr 3G1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707949424; x=1708554224; 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=js9MPuxE6HDFGb/bm1Qi8CQe6wvYU0HraTNqQ6YK0o4=; b=UtpqusBnWVV8zFbNKCwLixLwU2uObMb+5hBbR1m2TTC2ufgzNKzWHiDbKYdge3tmdx DBeuClTrFZ/UQH4D3xYD3Ij6c1N+kQEyD59CJ4dIQiv/dgqZQwiqgoaQsqCkrOKHzM6Y YEGyQR4zhas+gEGK1ZsQr6KgQfUNPFIP2l4F3I6h5tx33OAu9Zz33xQKRvrYceb6ePe4 yIBwF8FcQhf/YMqPN4HNIpAMuSNuqMUez/Tvhyt5qx5KT8bDEy1jHTrM+lcf9tmlmfgk EQk5SmlyX4Tn4q8hCYWH1hzyRT+0s2wClUgeehQNNqqO3pV+Edj0ysV0CsR9Nqu4sECM r/Sw== X-Forwarded-Encrypted: i=1; AJvYcCWbajInvIaiOT7FD5/B7axHErBEbFK+R25OZ4EoAi4XI/h0dt6eQHQ1MPxXXGuoIZpKKxGjaKnwKWoS3r9A16dLQVfudmQ= X-Gm-Message-State: AOJu0YwcDFfMRYkiFZK3j3/yTYRXXngWqvaEfE2i1dKMDxaxfwVhIWuX 2mkwNnBgawb0FkgG1XcyDc5UmgbnsKAa5uVd3zP1rK0gEryngJXOiF8lRFHYGM8= X-Google-Smtp-Source: AGHT+IGjqh0+2tP17eVBq7c1nX/+GlZ5zdJ4IsNWQw8zJ16xuLByBCHpRakHmYfe5OdE8oaCDFVYEw== X-Received: by 2002:a05:6a00:1995:b0:6e0:e618:7eb0 with SMTP id d21-20020a056a00199500b006e0e6187eb0mr216238pfl.8.1707949424231; Wed, 14 Feb 2024 14:23:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWuNLFg88Ex74oHJDi16aHb3teNa0ZVrj9kTmQXtICY886iND3h/U0xWUcMqM9HfV1wvLtnXEwT04jMa9/tEd61efPHSwHKfIQ3v12Yrn3QFNVAD5wEnw+uJylTvhW+SW5TQZ/8rMJjXZJi3i6/L7GfTPgldZ+r84thnqHrJka1F9YdLbJS Received: from localhost ([116.121.76.56]) by smtp.gmail.com with ESMTPSA id t27-20020a62d15b000000b006e03a640007sm10215269pfl.71.2024.02.14.14.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 14:23:43 -0800 (PST) From: Minwoo Im To: Keith Busch , Klaus Jensen Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Minwoo Im , Klaus Jensen Subject: [PATCH 1/3] hw/nvme: add Identify Endurance Group List Date: Thu, 15 Feb 2024 07:23:35 +0900 Message-Id: <20240214222337.5699-2-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214222337.5699-1-minwoo.im.dev@gmail.com> References: <20240214222337.5699-1-minwoo.im.dev@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pf1-x42e.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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Minwoo Im Commit 73064edfb864 ("hw/nvme: flexible data placement emulation") intorudced NVMe FDP feature to nvme-subsys and nvme-ctrl with a single endurance group #1 supported. This means that controller should return proper identify data to host with Identify Endurance Group List (CNS 19h). But, yes, only just for the endurance group #1. This patch allows host applications to ask for which endurance group is available and utilize FDP through that endurance group. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 22 ++++++++++++++++++++++ include/block/nvme.h | 1 + 2 files changed, 23 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f026245d1e9e..cfe53a358871 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -5629,6 +5629,26 @@ static uint16_t nvme_identify_nslist_csi(NvmeCtrl *n, NvmeRequest *req, return nvme_c2h(n, list, data_len, req); } +static uint16_t nvme_endurance_group_list(NvmeCtrl *n, NvmeRequest *req) +{ + uint16_t list[NVME_CONTROLLER_LIST_SIZE] = {}; + uint16_t *nr_ids = &list[0]; + uint16_t *ids = &list[1]; + uint16_t endgid = le32_to_cpu(req->cmd.cdw11) & 0xffff; + + /* + * The current nvme-subsys only supports Endurance Group #1. + */ + if (!endgid) { + *nr_ids = 1; + ids[0] = 1; + } else { + *nr_ids = 0; + } + + return nvme_c2h(n, list, sizeof(list), req); +} + static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req) { NvmeNamespace *ns; @@ -5732,6 +5752,8 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeRequest *req) return nvme_identify_nslist(n, req, false); case NVME_ID_CNS_CS_NS_ACTIVE_LIST: return nvme_identify_nslist_csi(n, req, true); + case NVME_ID_CNS_ENDURANCE_GROUP_LIST: + return nvme_endurance_group_list(n, req); case NVME_ID_CNS_CS_NS_PRESENT_LIST: return nvme_identify_nslist_csi(n, req, false); case NVME_ID_CNS_NS_DESCR_LIST: diff --git a/include/block/nvme.h b/include/block/nvme.h index bb231d0b9ad0..7c77d38174a7 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1074,6 +1074,7 @@ enum NvmeIdCns { NVME_ID_CNS_CTRL_LIST = 0x13, NVME_ID_CNS_PRIMARY_CTRL_CAP = 0x14, NVME_ID_CNS_SECONDARY_CTRL_LIST = 0x15, + NVME_ID_CNS_ENDURANCE_GROUP_LIST = 0x19, NVME_ID_CNS_CS_NS_PRESENT_LIST = 0x1a, NVME_ID_CNS_CS_NS_PRESENT = 0x1b, NVME_ID_CNS_IO_COMMAND_SET = 0x1c, From patchwork Wed Feb 14 22:23:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 13557117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F33E2C48BEB for ; Wed, 14 Feb 2024 22:24:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raNfZ-00030J-5R; Wed, 14 Feb 2024 17:23:57 -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 1raNfS-0002z3-SG; Wed, 14 Feb 2024 17:23:51 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raNfR-0004M8-Bf; Wed, 14 Feb 2024 17:23:50 -0500 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-296e22f85abso240789a91.3; Wed, 14 Feb 2024 14:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707949428; x=1708554228; 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=jIzhi0zXwyxAcxfW0vbAAZ1pHXKlkaBvG4gA8eFEa9A=; b=bfgfKYEB2JF346wzQX8PKzH8YUx5Jlq/M7WKUp+huptRp29FEEpcx7Eg/8WjdcWVHR DCqU6bZbjELamn+5P2LAU7oLFaFP2a+E0wdHlgqGf588CeZ71SaFym9NsDjWedsmRsax spyzWhl+TTh2eXsmkwyyrhJjbGzo8J4k6LS3Ce6YmBZ/P/UWegiUx7vZX7RaO7r7fre/ JnSm2S7aYsN8yQZGvD1jmlhkZsYandb2rLMbe8gnIfv2x7vmU1vi+KtRAuA2WIZE9XRV V7emOgzAa7h/Om2Ef1U2t3v98UVVSEux49a3FQ4w2+N5YmxiEEIjXGI5hDKd5ziKGzJM lgMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707949428; x=1708554228; 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=jIzhi0zXwyxAcxfW0vbAAZ1pHXKlkaBvG4gA8eFEa9A=; b=BfTmjOJni6gflIOSBb943BQh53I31peRRuojsrFi6TuAynkVqCmnPAkSUdxnQEyUUe y03ReEhyyl3163POS/3uGG1Co4JDctgWxrx/3fvs9bbWMW3HSRixVeKhUTvB/ek4htXs lNnXZDsLHcF6gh9xCD8YDZACQx+xgQ4UXQWbFIkZUj3kKEB9D0ku/MXQrp3OqSJ7tNOl ENKL/Tsi5wU2u4PjXvUPf3ujODNri3U8gqfKXjAST9JUGlK07rZXUnTt+lV+QHRxCqAF TEorLIMcKihIVJgrJnsJaPyesHbh/mNu/4ltLEY4RYhvtL22OCm15No63pDol+zBBd93 Ctjw== X-Forwarded-Encrypted: i=1; AJvYcCXYKpnZ6eKJ14CANQGDsSVOvkcLhxeIv1Pgh42OU3LUpFIWOL+PaYKolYdPFK/TzDaCfTekAsy/Mf8fSUgvBpXRowE3FDU= X-Gm-Message-State: AOJu0YwOTk4BDngVZMhXE1g1GKnwx+2gatHlBUb6kps1c+TO7d26WhjV oVsiYIkhbwalWPh5PLoJyhMB5ppLtC6NmbLyT9yd9O8XPWULb0uK X-Google-Smtp-Source: AGHT+IFCcGGaUMNsTMtX8M4MYlCwspn1uju5fI/ghhBvOu/AM5bKGm1dGIExa9dWdn2BkWlMAZg7JQ== X-Received: by 2002:a17:90b:3708:b0:297:17ad:52a3 with SMTP id mg8-20020a17090b370800b0029717ad52a3mr79092pjb.1.1707949427758; Wed, 14 Feb 2024 14:23:47 -0800 (PST) Received: from localhost ([116.121.76.56]) by smtp.gmail.com with ESMTPSA id nd13-20020a17090b4ccd00b00298f4341feesm591063pjb.28.2024.02.14.14.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 14:23:47 -0800 (PST) From: Minwoo Im To: Keith Busch , Klaus Jensen Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Minwoo Im , Klaus Jensen Subject: [PATCH 2/3] hw/nvme: Support SR-IOV VFs more than 127 Date: Thu, 15 Feb 2024 07:23:36 +0900 Message-Id: <20240214222337.5699-3-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214222337.5699-1-minwoo.im.dev@gmail.com> References: <20240214222337.5699-1-minwoo.im.dev@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pj1-x1036.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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Minwoo Im The number of virtual functions(VFs) supported in SR-IOV is 64k as per spec. To test a large number of MSI-X vectors mapping to CPU matrix in the QEMU system, we need much more than 127 VFs. This patch made support for 256 VFs per a physical function(PF). Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 4 ++-- hw/nvme/nvme.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index cfe53a358871..8198fd2d8e46 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -219,7 +219,7 @@ #define NVME_TEMPERATURE_CRITICAL 0x175 #define NVME_NUM_FW_SLOTS 1 #define NVME_DEFAULT_MAX_ZA_SIZE (128 * KiB) -#define NVME_MAX_VFS 127 +#define NVME_MAX_VFS 256 #define NVME_VF_RES_GRANULARITY 1 #define NVME_VF_OFFSET 0x1 #define NVME_VF_STRIDE 1 @@ -8425,7 +8425,7 @@ static Property nvme_props[] = { DEFINE_PROP_UINT8("zoned.zasl", NvmeCtrl, params.zasl, 0), DEFINE_PROP_BOOL("zoned.auto_transition", NvmeCtrl, params.auto_transition_zones, true), - DEFINE_PROP_UINT8("sriov_max_vfs", NvmeCtrl, params.sriov_max_vfs, 0), + DEFINE_PROP_UINT16("sriov_max_vfs", NvmeCtrl, params.sriov_max_vfs, 0), DEFINE_PROP_UINT16("sriov_vq_flexible", NvmeCtrl, params.sriov_vq_flexible, 0), DEFINE_PROP_UINT16("sriov_vi_flexible", NvmeCtrl, diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 5f2ae7b28b9c..db2cda098ebd 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -517,7 +517,7 @@ typedef struct NvmeParams { bool auto_transition_zones; bool legacy_cmb; bool ioeventfd; - uint8_t sriov_max_vfs; + uint16_t sriov_max_vfs; uint16_t sriov_vq_flexible; uint16_t sriov_vi_flexible; uint8_t sriov_max_vq_per_vf; From patchwork Wed Feb 14 22:23:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 13557118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58C7BC48BEB for ; Wed, 14 Feb 2024 22:24:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raNfb-000317-1M; Wed, 14 Feb 2024 17:23:59 -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 1raNfX-0002zf-Eg; Wed, 14 Feb 2024 17:23:55 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raNfV-0004Mn-1d; Wed, 14 Feb 2024 17:23:54 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e08dd0fa0bso257536b3a.1; Wed, 14 Feb 2024 14:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707949431; x=1708554231; 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=fkuI8eX5TD1s1j3VvJ6QWefmEmgPFSztzD62i65A9U0=; b=XbOPC/o48W4+gKvCbb5SXbwdDivRYY4VIojnZMkAeEJkI5z08Mr+6V4wBOZxVX7OGm YNEKyrivKzaAXA0cgx8k3BEJkWw/3RPwoqpnjs4Q1kQs0m7clscDRdrF6SHdaK2vwq5f BeL21uUo4FqhUjDQ9pytHV9zGd2PaVsX941TyPoyfO8CdCC3TdVthLP/fdsSfk8l8B1q NPZEE9AZvY78+36938IyccxvId1n55Nk1TVWkGRcvfqkjfPQUEWphfOom4qQd3nvsRdV AszVaKihPaNJPFFTs+mTPX23oe8r9PD2yGIkdG0DqfeDHulnt0mAc8W/fORkVBo0U+yN GVJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707949431; x=1708554231; 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=fkuI8eX5TD1s1j3VvJ6QWefmEmgPFSztzD62i65A9U0=; b=J7Yicz0WFFuyzmJ265roVv8HcT4K8QW3627mvhUlZVSKWe1MczCRtqojK32Q2tzs6s scPZCak4jN70oehbW2hZ5UVD98OF9nfw3lca6tWlqhgvzErmKcRA/PAaku9zGJfaNwvM IoJctCIWY6j/uud+HP/hTI2JW1yeoeS7vG/wLOx64XgKK2qsi6rPcYeljrLrmlScRRZ0 Qm75wpmwXMQ5ct8TdI4WTSM/kQmjLlSA+PQLnr/hacfUV8ZKLQavGoFnF/4OajLW16iq /UbiLd5iofN+RXSl+QalPbDVRDwgy+uOIu04jnPvYy9mBru7bCZLxvzOq6GdLh9UeVcL uKOQ== X-Forwarded-Encrypted: i=1; AJvYcCUyPn5kZgBF8j95DdXFWgAAmCV3zwIKmfLciZuneiJ/h2aXQ56GaE5f8H4poVSfVRM8MU8b5rXGZbILm24B1xOeil+Bm+g= X-Gm-Message-State: AOJu0YznIdiJqw7BPErlrTKquigQI0ENHEP9jMvzlJIY4AsaHspBRLIg qXKl5Gwgf27VwaT1VEhGdfnTkuaWOX4/QVT2VfuNNDGNTrDatPgS X-Google-Smtp-Source: AGHT+IEt9YGylY1X3+V/PQnQOznmIF0upJUu2HBf2qNI6cej9h9exfO8Ag4FeF+fJJi5y64HQqdsJw== X-Received: by 2002:a05:6a00:3d0c:b0:6e0:8a23:65c with SMTP id lo12-20020a056a003d0c00b006e08a23065cmr4852772pfb.13.1707949431201; Wed, 14 Feb 2024 14:23:51 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXoxNa8pTwbEiOTBvYkfoF+r1E/Y5S9gLVmEQ4QrIx6FFzf5D4gdPK/3MXAQPPdzeO2NP5egA7DxQBWyQE2Pak+2D5SSMt0sARIKzdvzMBT5sg4K9VOhLUe9SgEyrl/IKDRXbswE+M2qrFl0uNeqRvlQnSYncxW1BhZYGDikgF+U5QJWI9p Received: from localhost ([116.121.76.56]) by smtp.gmail.com with ESMTPSA id q2-20020aa79822000000b006e118ff3564sm658035pfl.133.2024.02.14.14.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 14:23:50 -0800 (PST) From: Minwoo Im To: Keith Busch , Klaus Jensen Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Minwoo Im , Klaus Jensen Subject: [PATCH 3/3] hw/nvme: Expand VI/VQ resource to uint32 Date: Thu, 15 Feb 2024 07:23:37 +0900 Message-Id: <20240214222337.5699-4-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214222337.5699-1-minwoo.im.dev@gmail.com> References: <20240214222337.5699-1-minwoo.im.dev@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pf1-x42e.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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Minwoo Im VI and VQ resources cover queue resources in each VFs in SR-IOV. Current maximum I/O queue pair size is 0xffff, we can expand them to cover the full number of I/O queue pairs. This patch also fixed Identify Secondary Controller List overflow due to expand of number of secondary controllers. Signed-off-by: Minwoo Im Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 10 +++++----- hw/nvme/nvme.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 8198fd2d8e46..6f3fd96f7572 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -5486,7 +5486,7 @@ static uint16_t nvme_identify_sec_ctrl_list(NvmeCtrl *n, NvmeRequest *req) for (i = 0; i < num_sec_ctrl; i++) { if (n->sec_ctrl_list.sec[i].scid >= min_id) { - list.numcntl = num_sec_ctrl - i; + list.numcntl = (num_sec_ctrl - i > 127) ? 127 : num_sec_ctrl - i; memcpy(&list.sec, n->sec_ctrl_list.sec + i, list.numcntl * sizeof(NvmeSecCtrlEntry)); break; @@ -8430,10 +8430,10 @@ static Property nvme_props[] = { params.sriov_vq_flexible, 0), DEFINE_PROP_UINT16("sriov_vi_flexible", NvmeCtrl, params.sriov_vi_flexible, 0), - DEFINE_PROP_UINT8("sriov_max_vi_per_vf", NvmeCtrl, - params.sriov_max_vi_per_vf, 0), - DEFINE_PROP_UINT8("sriov_max_vq_per_vf", NvmeCtrl, - params.sriov_max_vq_per_vf, 0), + DEFINE_PROP_UINT32("sriov_max_vi_per_vf", NvmeCtrl, + params.sriov_max_vi_per_vf, 0), + DEFINE_PROP_UINT32("sriov_max_vq_per_vf", NvmeCtrl, + params.sriov_max_vq_per_vf, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index db2cda098ebd..d0f4c6c9b7af 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -520,8 +520,8 @@ typedef struct NvmeParams { uint16_t sriov_max_vfs; uint16_t sriov_vq_flexible; uint16_t sriov_vi_flexible; - uint8_t sriov_max_vq_per_vf; - uint8_t sriov_max_vi_per_vf; + uint32_t sriov_max_vq_per_vf; + uint32_t sriov_max_vi_per_vf; } NvmeParams; typedef struct NvmeCtrl {