From patchwork Fri Jan 15 12:05:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 1426942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=AWI5sRvc; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4DHKgc3k0gz9sVF for ; Fri, 15 Jan 2021 23:07:40 +1100 (AEDT) Received: from localhost ([::1]:43198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0NtC-0008Hn-Du for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2021 07:07:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0Nry-0007xm-M3; Fri, 15 Jan 2021 07:06:23 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:42818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0Nrv-0003Vu-HB; Fri, 15 Jan 2021 07:06:22 -0500 Received: by mail-pg1-x536.google.com with SMTP id g15so5862546pgu.9; Fri, 15 Jan 2021 04:06:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A9T6du9sxukvLBvTrDzzy9owmsrvi3lkb2vYV1QBYOY=; b=AWI5sRvcQbQyTqTh770Vf8hgBJFYkkPco6FegEpx3rWeCCk1TAkXgUC1Mw+RwL4h+m vl+wWuDToWT0DeZiu6wkmTL9x8cLAC3eYLy7QQqYq9KbLahtu5x7/GE3adsLnraHATNA xcXF9SHDP7IzLw5tEQ39f+lU3HZlnkcXOqSHOC/9Hp32Z1RS9UpoM7EXutZ+btyGVJ+d ss/p+FRKPfSrSmLtAx4s9RfgMk0uv5X31GBU/n+zTkxkyrkNegs4DwhxuT2sdLBx5Fvt PUVXAMlCjY05Z4npyKr14raA8XA94CN4/hb5KDyo4PPQ/FXDjAwgvWm3/kYMpoVy70FJ U9Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A9T6du9sxukvLBvTrDzzy9owmsrvi3lkb2vYV1QBYOY=; b=i0OGwTa4oI9+5K5q9E6NOMgCCpjTZesLudtRzvAVDrrIB7szZVFSl2VVrywGZuc8Wv RihuyOKKQ87gnYlh42Lw2gcBJdBSx9OtApaBZsu3cbEwL1F6t3xabN1r4dsi1bZaE83N h8Sj0smC8gIrW0ivBY/0bhzWQK0iw64sZSdjejtY3edQdBara1sL3XmtNOJrc9QqODUF 0XibAHpXVquFzVCpE4O4nZK0SPG4yA12BhkN80nBC2+Ps5yL7kF6J9KLcAP22SYQoxkv WHpog2ANdjQhHTO7ylHLurOWa0LsBz25h4A+6ULz/V+uB5X3p/2pp4AFQQgvPm4y20w9 vIvg== X-Gm-Message-State: AOAM532ToKkV3Be4rgbpykBjbdJHGEj4i9lPOiwJ2TCX5Jv0mmeHoe2y GdAl6kAuarbksdFNNHi4ljhWTRxMPwdv5w== X-Google-Smtp-Source: ABdhPJyBClL+QlSbZheygKXeh2SNz8CEus6Vc/7EUHKdQ3zChpIh+fkRnF8LHfafyU/Cd6K9kCpF8g== X-Received: by 2002:a63:3714:: with SMTP id e20mr12440910pga.410.1610712377348; Fri, 15 Jan 2021 04:06:17 -0800 (PST) Received: from localhost.localdomain ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id a4sm8338161pgn.40.2021.01.15.04.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:06:16 -0800 (PST) From: Minwoo Im To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [RFC PATCH 1/5] hw/block/nvme: add controller id parameter Date: Fri, 15 Jan 2021 21:05:54 +0900 Message-Id: <20210115120558.29313-2-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115120558.29313-1-minwoo.im.dev@gmail.com> References: <20210115120558.29313-1-minwoo.im.dev@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pg1-x536.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , Minwoo Im , Kevin Wolf , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There is Contrller ID field in Identify Controller data structure and nvme device has never set this field, 0 by default. Added a parameter for controller identifier in a NVM subsystem. This is reflected to Identify Controller data structrue of the controller. This parameter is helpful when a user wants to set up multi-controller in a NVM subsystem. Signed-off-by: Minwoo Im --- hw/block/nvme.c | 10 ++++++++++ hw/block/nvme.h | 1 + 2 files changed, 11 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index cf0fe28fe6eb..132e61c0ee7b 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -23,6 +23,7 @@ * max_ioqpairs=, \ * aerl=, aer_max_queued=, \ * mdts=,zoned.append_size_limit= \ + * cntlid= * -device nvme-ns,drive=,bus=,nsid=,\ * zoned= * @@ -50,6 +51,12 @@ * completion when there are no outstanding AERs. When the maximum number of * enqueued events are reached, subsequent events will be dropped. * + * - `cntlid` + * NVM subsystem unique controller identifier (default: 0). This property + * is used if a user wants to set up multi-controller in a NVM subsystem. + * This value will be reported through Identify Controller data structure + * with a field named CNTLID[79:78]. + * * - `zoned.append_size_limit` * The maximum I/O size in bytes that is allowed in Zone Append command. * The default is 128KiB. Since internally this this value is maintained as @@ -4275,6 +4282,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev) n->bar.vs = NVME_SPEC_VER; n->bar.intmc = n->bar.intms = 0; + + id->cntlid = n->params.cntlid; } static void nvme_realize(PCIDevice *pci_dev, Error **errp) @@ -4345,6 +4354,7 @@ static Property nvme_props[] = { DEFINE_BLOCK_PROPERTIES(NvmeCtrl, namespace.blkconf), DEFINE_PROP_LINK("pmrdev", NvmeCtrl, pmrdev, TYPE_MEMORY_BACKEND, HostMemoryBackend *), + DEFINE_PROP_UINT32("cntlid", NvmeCtrl, params.cntlid, 0), DEFINE_PROP_STRING("serial", NvmeCtrl, params.serial), DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, params.cmb_size_mb, 0), DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 0), diff --git a/hw/block/nvme.h b/hw/block/nvme.h index b7fbcca39d9f..6aa9e89ac5a8 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -11,6 +11,7 @@ typedef struct NvmeParams { char *serial; + uint32_t cntlid; uint32_t num_queues; /* deprecated since 5.1 */ uint32_t max_ioqpairs; uint16_t msix_qsize; From patchwork Fri Jan 15 12:05:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 1426944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Q5ryL0UD; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4DHKk71Gnfz9sVF for ; Fri, 15 Jan 2021 23:09:50 +1100 (AEDT) Received: from localhost ([::1]:49390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0NvI-0002R9-U4 for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2021 07:09:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0Ns5-0007z2-98; Fri, 15 Jan 2021 07:06:29 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:52981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0Nrx-0003Wy-E8; Fri, 15 Jan 2021 07:06:29 -0500 Received: by mail-pj1-x102c.google.com with SMTP id v1so4946356pjr.2; Fri, 15 Jan 2021 04:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z7ODT9lj0kxOdBE+83aVpPvzwDiEUWaBf6IRt28xomQ=; b=Q5ryL0UDo3P2AGIAUpr1YLGNR9AxWEK+AGuxvrf10/7UVK3FqFORLgteF0Tgd0SIPi 3yhRpWREvPxJYo5gdnw8aC6WPju9ErHVen/XovEZP8lUBg9Z+zlNawimyQ5UzoPQcgUJ 1eoIlNTxWr0lq9Y+Ep/ZRIEg3YUor4PVyHzgTdtWgasrnvxNl8nFDsNQfxPSiJMsXVpz FkmJZ5z1EgSGMNESc1xvHpYkNHf36p0ulXSo9oo410i6Nq6qIZWMsJKObehgrnYGCpor OvwokpenHd0RSO27zUNc+hrI0uAO1uWYEYicpJTXQvzjMMsLIhwoBv5UHqujaFmfbGaV MRdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z7ODT9lj0kxOdBE+83aVpPvzwDiEUWaBf6IRt28xomQ=; b=Kk7QecQD6K5y+G/z9lLqhrMsc0NUSNpx8AztH8g87upEtBJxuRbizLIxxaVv2r85Hw xa67xYlMhSXnIzIMZWJXXB0CHcproMh5c5uaJodYfEGtKkl8wykqdX8pYq8us1IeWacT WUjHWAytPu4M3VtTYoNWTgtD+JZsaAWcyTcTZWwaYH/WT9BO6gWIsXUjAe35ry0/P3hI zuWgKT8eXdl/7lfIxMy5I/Ovf5RUuOm7300iPNN/RjGlrCSpwnEidJQFt8zkHQWyjC3I xUYM9LYgXVMmN8E5sr5Og3mUHY2RarbS/nEJYP1dhIvWsFNA0vy74C9IsktXXtZYuoCZ VkXQ== X-Gm-Message-State: AOAM532l605Pc0AX6/0sfecbQOc0xVS6l22lTljSNgyKaeYqNtPYUAD8 NmzOY6/0L2C2qRblGG9sEDtoA63he0Emqw== X-Google-Smtp-Source: ABdhPJwo7eG0BzHYf9sZqNSt5fnNIAZ7XQXoegZlcajueApTmyduYSFWlGkeOXYjIz6+C0bzckH0NQ== X-Received: by 2002:a17:90b:34f:: with SMTP id fh15mr10138464pjb.80.1610712379747; Fri, 15 Jan 2021 04:06:19 -0800 (PST) Received: from localhost.localdomain ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id a4sm8338161pgn.40.2021.01.15.04.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:06:19 -0800 (PST) From: Minwoo Im To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [RFC PATCH 2/5] nvme: add CMIC enum value for Identify Controller Date: Fri, 15 Jan 2021 21:05:55 +0900 Message-Id: <20210115120558.29313-3-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115120558.29313-1-minwoo.im.dev@gmail.com> References: <20210115120558.29313-1-minwoo.im.dev@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pj1-x102c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , Minwoo Im , Kevin Wolf , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Added Controller Multi-path I/O and Namespace Sharing Capabilities (CMIC) field to support multi-controller in the following patches. This field is in Identify Controller data structure in [76]. Signed-off-by: Minwoo Im --- include/block/nvme.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/block/nvme.h b/include/block/nvme.h index 9494246f1f59..e83ec1e124c6 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -941,6 +941,10 @@ enum NvmeIdCtrlLpa { NVME_LPA_EXTENDED = 1 << 2, }; +enum NvmeIdCtrlCmic { + NVME_CMIC_MULTI_CTRL = 1 << 1, +}; + #define NVME_CTRL_SQES_MIN(sqes) ((sqes) & 0xf) #define NVME_CTRL_SQES_MAX(sqes) (((sqes) >> 4) & 0xf) #define NVME_CTRL_CQES_MIN(cqes) ((cqes) & 0xf) From patchwork Fri Jan 15 12:05:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 1426947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jChKcvJw; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4DHKp3401Yz9sVF for ; Fri, 15 Jan 2021 23:13:12 +1100 (AEDT) Received: from localhost ([::1]:54318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0NyW-0004ch-TU for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2021 07:13:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0Ns5-0007zc-I8; Fri, 15 Jan 2021 07:06:31 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:33712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0Nrz-0003XI-Ru; Fri, 15 Jan 2021 07:06:29 -0500 Received: by mail-pf1-x432.google.com with SMTP id h186so5367187pfe.0; Fri, 15 Jan 2021 04:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9k+hERDWCB/gTAlWmWagbmZXp7Dw4NAcOtduFW8W68Q=; b=jChKcvJw06CZK6u7mJrp08I0BQgqIgooSRgevX2KOpShLHrG2Z0Wsu1li6AKgtjb9D GO95JrJesHhrWSqqum7y26UfxhprTzdnFUTKITzi8u9bl1F3KR6kH64uMpLROYpg6b/4 1NzEicVxPT9X1vt45N5c7I3619FA0e8zUilFuu8P1zbpL7Duph/XXvSR5QZWZ/Qu4FyQ FaSBm3qLpOZ/m7vGx5zfASnip/+pJ2FsRKQFpsiBfHwIKqEXS7Lw29rltpq26b2771UE RohVnNS4ho9TX7gpI56xn/kJh+ska+owiLMLRyT4BzoI7PajPvpczHu3p3G/ZtlTWF+8 6/SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9k+hERDWCB/gTAlWmWagbmZXp7Dw4NAcOtduFW8W68Q=; b=TFsvw/jOl17xZL/yQaww7Vc4pegzBpnArPl75zUFqBMCU65mDxgdR9pFGB+xOoYgp/ Sz/+nEkz1tQ+RbtgswpOo0WGLC6Yjz6y74oQ6bC1x/f4uFYqZVIYFYnnQcR/PSWXKoQ/ a11+fTTPhPjz0rga9QBCjQe03WG38e1EhnivrN5Wi89EnEDZwjMCB2b2XxGpZiZy43ye 7WCpXc95kyvoermau+cOMLUyd8sJl1G4qL6sOWK7k9NsCzcL/Lpofa1pEy8aGTq+xE+N sOYm3VdhWhdWbKt1Pwjg6IyjmH83g4bhv4RpcdlDmaOXC0qTnaafna6sO1kzgfy1Oh5R MVJw== X-Gm-Message-State: AOAM530yt43cl+z2/OKh1T6QsfKyrfYglKxmBlKKSAPExW8l/xV526mM ZIRj6nNFfWMsyBMhEKDafiGOD+mTqbV97w== X-Google-Smtp-Source: ABdhPJwXRhTMitWMmgcRq9X1g31SeQaLs2xl+AQ1FTt6Pr5GXExGhoOzJZoqJdSTbFYJ0PBhSQsd8A== X-Received: by 2002:a62:7ad5:0:b029:1a3:d0a2:e49 with SMTP id v204-20020a627ad50000b02901a3d0a20e49mr12309685pfc.31.1610712382130; Fri, 15 Jan 2021 04:06:22 -0800 (PST) Received: from localhost.localdomain ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id a4sm8338161pgn.40.2021.01.15.04.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:06:21 -0800 (PST) From: Minwoo Im To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [RFC PATCH 3/5] hw/block/nvme: add multi-controller param for mpath Date: Fri, 15 Jan 2021 21:05:56 +0900 Message-Id: <20210115120558.29313-4-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115120558.29313-1-minwoo.im.dev@gmail.com> References: <20210115120558.29313-1-minwoo.im.dev@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pf1-x432.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , Minwoo Im , Kevin Wolf , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Added mpath.ctrl parameter to set multi-controller bit[1] in CMIC field in Identify Controller data structure. It will indicate that a NVM subsystem can have two or more controllers in the subsystem. To set up multi-controller in a NVM subsystem, user needs to give same serial parameter to the controllers (-device), but different cntlid parameter to each controllers (-device). Example: -device nvme,ctrlid=0,serial=foo,... -device nvme,ctrlid=1,serial=foo,... The example above prepares two different controllers in a NVM subsystem with the same serial which leads to same subsystem NQN. Signed-off-by: Minwoo Im --- hw/block/nvme.c | 10 ++++++++++ hw/block/nvme.h | 1 + 2 files changed, 11 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 132e61c0ee7b..50b349cf9ea3 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -57,6 +57,11 @@ * This value will be reported through Identify Controller data structure * with a field named CNTLID[79:78]. * + * - `mpath.ctrl` + * Multi-path I/O with multi-controller (default: false). A NVM subsystem + * can hold two or more controllers. This will be reflected to Identify + * Controller data structure CMIC[76] field. + * * - `zoned.append_size_limit` * The maximum I/O size in bytes that is allowed in Zone Append command. * The default is 128KiB. Since internally this this value is maintained as @@ -4284,6 +4289,10 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev) n->bar.intmc = n->bar.intms = 0; id->cntlid = n->params.cntlid; + + if (n->params.mpath_ctrl) { + id->cmic |= NVME_CMIC_MULTI_CTRL; + } } static void nvme_realize(PCIDevice *pci_dev, Error **errp) @@ -4364,6 +4373,7 @@ static Property nvme_props[] = { DEFINE_PROP_UINT32("aer_max_queued", NvmeCtrl, params.aer_max_queued, 64), DEFINE_PROP_UINT8("mdts", NvmeCtrl, params.mdts, 7), DEFINE_PROP_BOOL("use-intel-id", NvmeCtrl, params.use_intel_id, false), + DEFINE_PROP_BOOL("mpath.ctrl", NvmeCtrl, params.mpath_ctrl, false), DEFINE_PROP_SIZE32("zoned.append_size_limit", NvmeCtrl, params.zasl_bs, NVME_DEFAULT_MAX_ZA_SIZE), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 6aa9e89ac5a8..73c9c2cff247 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -21,6 +21,7 @@ typedef struct NvmeParams { uint8_t mdts; bool use_intel_id; uint32_t zasl_bs; + bool mpath_ctrl; } NvmeParams; typedef struct NvmeAsyncEvent { From patchwork Fri Jan 15 12:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 1426943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lsbwl/cT; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4DHKgn0Mtnz9sVS for ; Fri, 15 Jan 2021 23:07:49 +1100 (AEDT) Received: from localhost ([::1]:43370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0NtK-0008Mp-7B for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2021 07:07:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0NsB-00080R-DY; Fri, 15 Jan 2021 07:06:37 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:36275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0Ns3-0003Zq-Ft; Fri, 15 Jan 2021 07:06:35 -0500 Received: by mail-pg1-x535.google.com with SMTP id c132so5892649pga.3; Fri, 15 Jan 2021 04:06:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZuENl38Uj1XXvlGTRP6SwNgsA5uXW6rACpRQwgn9cKc=; b=lsbwl/cTld+UbAleKu2VmTLNUmw57TkqgfrWpDSgdYeE2+JS9mSxxm1XqqbtujNeFD xW247lFgWhkDQThmFvuYv2H2bDn+W0yhRfruBt5QshO24ybb1yftnkDEZK56soIH1B9t r2xbajQfhOeQyPeHxOlIJdOLqBQhS9fDgQFKBbGSykHeGNofYPzo+i1QInrh8L25ClyZ Vm/1qzGpfx48bFNo5Wy2spxiyxLx4bny2y+MHE38n5sv409iAcOzUQ8X+AAy/b70q3OA OYYi17aZ3636gAZni7m+jM75++4FXQO7IC42qWjD1JaC86rjMGNAH08G6oxgyDosfI+E JNHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZuENl38Uj1XXvlGTRP6SwNgsA5uXW6rACpRQwgn9cKc=; b=MGXHddtbIzz+sxV6msXsBVgP/+Y5I1+LMjPQPP2iZbP+ef4AY3N9H3rknPLY9kR0J8 u/7Snz6NYBfMxkuExXO1DdZSPHI+hSD/KAUAxezYb04tm+KIxzqTG/g8CtcNBbt3zpbd Rl2J1ev8yPoaCvzefp8QGAmjyj3oUAxn6TtIV2zetgEmJDN6DJDMXoMNveqv9J2s4/5H OG0T8vSp0Uw13EPjOl/47PnA1z/SOK6ZR+5QmTeAco4OmtJ6ZYLa/NSy4+4fq97nCbu5 B/vOu2I0tYzfEQji0LBF0T7uelQ7lqW0MpDJ/jkFhzM/V6aRoRzePS65ZJjGAePUW6hi vObw== X-Gm-Message-State: AOAM533c6woTA/Bae/IlkxIZOYyYQMHUT45nYwJAka6ucXzs2jzSp0HC WXSzjN6nYNTwMDTlTRPMedUN2MTdvtoRXQ== X-Google-Smtp-Source: ABdhPJxmK71ZeA3icGlEqVgME2L9p6S7lt58ka3TejsbSEfwAc6gZUzqn8hHyNNBp5ApZfsG3houOA== X-Received: by 2002:a62:8205:0:b029:19e:717c:d647 with SMTP id w5-20020a6282050000b029019e717cd647mr12381611pfd.50.1610712384535; Fri, 15 Jan 2021 04:06:24 -0800 (PST) Received: from localhost.localdomain ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id a4sm8338161pgn.40.2021.01.15.04.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:06:24 -0800 (PST) From: Minwoo Im To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [RFC PATCH 4/5] nvme: add NMIC enum value for Identify Namespace Date: Fri, 15 Jan 2021 21:05:57 +0900 Message-Id: <20210115120558.29313-5-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115120558.29313-1-minwoo.im.dev@gmail.com> References: <20210115120558.29313-1-minwoo.im.dev@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pg1-x535.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , Minwoo Im , Kevin Wolf , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Added Namespace Multi-path I/O and Namespace Sharing Capabilities (NMIC) field to support shared namespace from controller(s). This field is in Identify Namespace data structure in [30]. Signed-off-by: Minwoo Im --- include/block/nvme.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/block/nvme.h b/include/block/nvme.h index e83ec1e124c6..dd7b5ba9ef4c 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -1110,6 +1110,10 @@ enum NvmeNsIdentifierType { NVME_NIDT_CSI = 0x04, }; +enum NvmeNsNmic { + NVME_NMIC_NS_SHARED = 1 << 0, +}; + enum NvmeCsi { NVME_CSI_NVM = 0x00, NVME_CSI_ZONED = 0x02, From patchwork Fri Jan 15 12:05:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 1426949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qpQnegoq; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4DHKsQ2qkqz9sf9 for ; Fri, 15 Jan 2021 23:16:10 +1100 (AEDT) Received: from localhost ([::1]:59562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0O1P-0006pH-QU for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2021 07:16:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0NsF-00082x-IT; Fri, 15 Jan 2021 07:06:39 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:54439) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0Ns5-0003c8-Au; Fri, 15 Jan 2021 07:06:39 -0500 Received: by mail-pj1-x1034.google.com with SMTP id cq1so4938673pjb.4; Fri, 15 Jan 2021 04:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2TVgfY2rY0wUNOpq9wxeGS8UtroQZj3M0PEyecec2c8=; b=qpQnegoqGAwaMot1ezEOcPl3ypc3yyPWyt9+0hnIKFszuUcjj3TRrv1hiYggNTjVl4 mCvcOtTbhxfZYvilJ8zhtq/G/kwbpmVoKJ2XO/t3xThFW5HR4fs0So+5ywVRHm9/C0Bl VZrVH9OOcI9Zvfz5FEFa/rb8S4SyzCDQ3P4cFdprK9hgJX5o51742hWDoK39bQwHs7Rs MXkwtWwrihgtO03vZfk9N9gWbJvkq6ZQePFpjLnuFrRW2/JZ1MtZaBQJrBALAoihIzU5 kNN0p3uqWVgIQatC7+1agum0MdMNDQjjH4w5EZhCzaT1Q825rvcu7s8UZ4w9o8bzCxlK zW7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2TVgfY2rY0wUNOpq9wxeGS8UtroQZj3M0PEyecec2c8=; b=Tqv6/M6JGOqdcvu4LhZBgLA0Q3RgeLaqt1zKI9UzJMwwUUi78iQbQTuVEtF3WE46nv ygMn2tF98ko4qsKuLm2DstGoYiW+ucZ5iHYdw9kc5hp4YjpxsqycoxKzs8Dnk+sZ2pWs GMUBL2t/azqQOE8UD15xH0zTxgfcwx/oSHvKMzaLjZPtedQYyN5TVJmtZBBsbx7cnrva wXorX5qVUsEARQqdBoO5d/ZRPBbs1F4H82bptZNdYpWG6yUR5jXDbaSSdhiHPhWmFDrr CBkraGUP+/Y/qZ0PRNuvi2Dqwl+wfyOVcknPxXRj0KfBD7pAWx69WyNiPUUwBastAqKb nmhA== X-Gm-Message-State: AOAM530v/Xfn//DK3wvcCKEh8E6pyWOAa2cxV/dRirGq1n0bZ29kE7vZ +vDKyfLZjxXeRDmOzVTphsJvL8e5fCXbqA== X-Google-Smtp-Source: ABdhPJwQtD4JSpPDfP2g3pokv9pA+dygMvm6E89ZK5eFdljwVY+Ul1PI5zkpdHxvKbDOmgFfioeCSQ== X-Received: by 2002:a17:902:a512:b029:db:cf4c:336b with SMTP id s18-20020a170902a512b02900dbcf4c336bmr12507220plq.17.1610712386929; Fri, 15 Jan 2021 04:06:26 -0800 (PST) Received: from localhost.localdomain ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id a4sm8338161pgn.40.2021.01.15.04.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:06:26 -0800 (PST) From: Minwoo Im To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [RFC PATCH 5/5] hw/block/nvme: add namespace sharing param for mpath Date: Fri, 15 Jan 2021 21:05:58 +0900 Message-Id: <20210115120558.29313-6-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115120558.29313-1-minwoo.im.dev@gmail.com> References: <20210115120558.29313-1-minwoo.im.dev@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pj1-x1034.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , Minwoo Im , Kevin Wolf , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Added mpath.ns parameter to set multi-namespace bit[0] in NMIC field in Identify Namespace data structure. It will indicate that the namespace can be shared by two or more controllers. Example: To share the namespace between two controllers in a NVM subsystem, first multi-controllers should be prepared with the same serial: -device nvme,id=nvme0,ctrlid=0,serial=foo,... -device nvme,id=nvme1,ctrlid=1,serial=foo,... Then, we can prepare namespace device with mpath.ns enabled. Also, we must give the same UUID for those two devices with the same Namespace ID. -device nvme-ns,uuid=,bus=nvme0,nsid=1,... -device nvme-ns,uuid=,bus=nvme1,nsid=1,... Signed-off-by: Minwoo Im --- hw/block/nvme-ns.c | 14 ++++++++++++-- hw/block/nvme-ns.h | 2 ++ hw/block/nvme.c | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 274eaf61b721..cedacda9ebab 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block/nvme-ns.c @@ -32,13 +32,18 @@ #define MIN_DISCARD_GRANULARITY (4 * KiB) -static int nvme_ns_init(NvmeNamespace *ns, Error **errp) +static int nvme_ns_init(NvmeCtrl *n, NvmeNamespace *ns, Error **errp) { BlockDriverInfo bdi; NvmeIdNs *id_ns = &ns->id_ns; int lba_index = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); int npdg; + if (!n->params.mpath_ctrl && ns->params.mpath_ns) { + error_setg(errp, "mpath.ctrl must be enabled for ns sharing"); + return -1; + } + ns->id_ns.dlfeat = 0x9; id_ns->lbaf[lba_index].ds = 31 - clz32(ns->blkconf.logical_block_size); @@ -63,6 +68,10 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp) id_ns->npda = id_ns->npdg = npdg - 1; + if (ns->params.mpath_ns) { + id_ns->nmic |= NVME_NMIC_NS_SHARED; + } + return 0; } @@ -314,7 +323,7 @@ int nvme_ns_setup(NvmeCtrl *n, NvmeNamespace *ns, Error **errp) return -1; } - if (nvme_ns_init(ns, errp)) { + if (nvme_ns_init(n, ns, errp)) { return -1; } if (ns->params.zoned) { @@ -371,6 +380,7 @@ static Property nvme_ns_props[] = { DEFINE_BLOCK_PROPERTIES(NvmeNamespace, blkconf), DEFINE_PROP_UINT32("nsid", NvmeNamespace, params.nsid, 0), DEFINE_PROP_UUID("uuid", NvmeNamespace, params.uuid), + DEFINE_PROP_BOOL("mpath.ns", NvmeNamespace, params.mpath_ns, false), DEFINE_PROP_BOOL("zoned", NvmeNamespace, params.zoned, false), DEFINE_PROP_SIZE("zoned.zone_size", NvmeNamespace, params.zone_size_bs, NVME_DEFAULT_ZONE_SIZE), diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h index f8f3c28c360b..d1f2518f7210 100644 --- a/hw/block/nvme-ns.h +++ b/hw/block/nvme-ns.h @@ -29,6 +29,8 @@ typedef struct NvmeNamespaceParams { uint32_t nsid; QemuUUID uuid; + bool mpath_ns; + bool zoned; bool cross_zone_read; uint64_t zone_size_bs; diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 50b349cf9ea3..e4aa15345c12 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -62,6 +62,12 @@ * can hold two or more controllers. This will be reflected to Identify * Controller data structure CMIC[76] field. * + * Setting `mpath.ctrl` to true enables the following properties to configure + * multi-path for a namespace: + * mpath.ns= + * If set to true, namespace sharing in a NVM subsystem is enabled. + * This will be reflected to Identify Namespace data structure. + * * - `zoned.append_size_limit` * The maximum I/O size in bytes that is allowed in Zone Append command. * The default is 128KiB. Since internally this this value is maintained as