From patchwork Fri Jun 11 23:46:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 12316757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70C83C48BE6 for ; Sat, 12 Jun 2021 00:15:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F1E19611C9 for ; Sat, 12 Jun 2021 00:15:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1E19611C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrrJ7-0001xi-1a for qemu-devel@archiver.kernel.org; Fri, 11 Jun 2021 20:15:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqsB-0006Vq-2E; Fri, 11 Jun 2021 19:47:35 -0400 Received: from mout.gmx.net ([212.227.15.15]:52571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqs6-0006Ay-Qv; Fri, 11 Jun 2021 19:47:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623455241; bh=QbhSxLeKcFBz1aqno/rerDdcDjyI9405VKqcoSqOeig=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=AwJ2Wb2j25TZUfY1sLmpzxjcXEMP/4wLzS8NE3tmgJhTQZ9fai/S2MgIRR5+XVv7n Unjn6h+xMbOAzRCAzAWYcjPj+RWvlbmFiGlbv3DfHdV3A08niDwM59e3GunZnlha4k x9qJrLjDrRSl8P0syb9de401gxXEI4xcmo4D85Qk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([62.143.247.63]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N33Il-1lCe3Q047h-013Lfi; Sat, 12 Jun 2021 01:47:21 +0200 From: Heinrich Schuchardt To: Keith Busch , Klaus Jensen , Peter Maydell Subject: [PATCH v2 1/3] hw: virt: consider hw_compat_6_0 Date: Sat, 12 Jun 2021 01:46:29 +0200 Message-Id: <20210611234631.81314-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210611234631.81314-1-xypron.glpk@gmx.de> References: <20210611234631.81314-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:znDoEkAvZdWcOR+gBVBQRClwj++qILoM1PS4XZ3m6wwJRYoDPfC YaNsU+nJocCSrI7TfjbBvvsLf8ryTBHCfU8ovW+PFj4bNMmxfhMni8H0CThIvGE1n1Q31oc U++9nrpCaxSKlwew5ZTKEgDrquc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tWO5fZin9GLx5 ojaGiG6D7sHR/9GjFpyqMCJ+gxmmvY8tAnSEmrP+YGwKi7ZfizOS8UjZHJbZ9BvY1AUxjdSCV GAVyT68DpSsl9F3/IQNkdZGYpbHZBpPnFyKW2nsBukuOI210GzO65Ug98zrijq9IHxBB7Qerm 79Qv4scTEi7kmTHNWGYvVnm7Vl18s7o5Qf1 Received-SPF: pass client-ip=212.227.15.15; envelope-from=xypron.glpk@gmx.de; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: Eduardo Habkost , qemu-block@nongnu.org, Heinrich Schuchardt , Cornelia Huck , qemu-devel@nongnu.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" virt-6.0 must consider hw_compat_6_0. Fixes: da7e13c00b59 ("hw: add compat machines for 6.1") Signed-off-by: Heinrich Schuchardt Reviewed-by: Cornelia Huck --- v2: add missing Fixes: tag --- hw/arm/virt.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.30.2 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 840758666d..8bc3b408fe 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2764,6 +2764,8 @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 1) static void virt_machine_6_0_options(MachineClass *mc) { + virt_machine_6_1_options(mc); + compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); } DEFINE_VIRT_MACHINE(6, 0) From patchwork Fri Jun 11 23:46:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 12316761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92FFBC48BE5 for ; Sat, 12 Jun 2021 00:18:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0E1BA611C9 for ; Sat, 12 Jun 2021 00:18:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E1BA611C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrrMK-0005r3-8y for qemu-devel@archiver.kernel.org; Fri, 11 Jun 2021 20:18:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqsG-0006mx-2I; Fri, 11 Jun 2021 19:47:40 -0400 Received: from mout.gmx.net ([212.227.15.19]:52221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqsC-0006Gr-Rg; Fri, 11 Jun 2021 19:47:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623455242; bh=TckBcnluvGI0xnHFdWf6WQQJZQLaxHvdBufay4UL8j0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=U4rjtr7bFPK6xg0W3bjNrrKgLnmXmfejP+bdNluJBbdy6jNsDblYUXEfy5nBuYxaT PvR4RowNnL95oSQVndpBvGr1LFH/9T1diJVajP4BnbH8SJzzxybYFmOVKFQmvT/ceh N/uiPp+FQAhOghYY3YxAUx2zY29vucQ4ILKA7ir8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([62.143.247.63]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1M7sDg-1lvgMK0bUw-0052qX; Sat, 12 Jun 2021 01:47:22 +0200 From: Heinrich Schuchardt To: Keith Busch , Klaus Jensen , Peter Maydell Subject: [PATCH v2 2/3] hw/nvme: namespace parameter for EUI-64 Date: Sat, 12 Jun 2021 01:46:30 +0200 Message-Id: <20210611234631.81314-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210611234631.81314-1-xypron.glpk@gmx.de> References: <20210611234631.81314-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ikaJTrTbwerfsh1W0TiLvneShuKJ+um29MmJDJ0X95a2Gl432a3 CPMnBzi+I8Glb2KKbCEE6tcgMo8+sXHClq6ttapLixwBYz3PC5RYhgE4jxVQshmLWZNryHL eXSs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FCmo5VhElJ+feiyq82HJf+i8opI+iE/RvU2+Hxp58fioEr o3R3hcJQyMaWq727oPpWiw2aeBa6qtHYZ3NZPlVHBdikzOOt4oR2gm5BK50hFojDCSwLcBCLW GVkVRmj3KxSURw3dhfvWicGZxWO1209FzGnRE7hPoJgXJoQYS4sWHZKjWkJ6n4zHMuH1w5nyZ Eyar9XD7Hsh95kgy/F78dwNFznhlOTz5U3e Received-SPF: pass client-ip=212.227.15.19; envelope-from=xypron.glpk@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Eduardo Habkost , qemu-block@nongnu.org, Heinrich Schuchardt , Cornelia Huck , qemu-devel@nongnu.org, qemu-arm@nongnu.org, Klaus Jensen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The EUI-64 field is the only identifier for NVMe namespaces in UEFI device paths. Add a new namespace property "eui64", that provides the user the option to specify the EUI-64. Signed-off-by: Heinrich Schuchardt Acked-by: Klaus Jensen --- v2: fix typo %s/EUI64/EUI-64/ --- docs/system/nvme.rst | 4 +++ hw/nvme/ctrl.c | 58 ++++++++++++++++++++++++++------------------ hw/nvme/ns.c | 2 ++ hw/nvme/nvme.h | 1 + 4 files changed, 42 insertions(+), 23 deletions(-) -- 2.30.2 diff --git a/docs/system/nvme.rst b/docs/system/nvme.rst index f7f63d6bf6..b5f8288d7c 100644 --- a/docs/system/nvme.rst +++ b/docs/system/nvme.rst @@ -81,6 +81,10 @@ There are a number of parameters available: Set the UUID of the namespace. This will be reported as a "Namespace UUID" descriptor in the Namespace Identification Descriptor List. +``eui64`` + Set the EUI-64 of the namespace. This will be reported as a "IEEE Extended + Unique Identifier" descriptor in the Namespace Identification Descriptor List. + ``bus`` If there are more ``nvme`` devices defined, this parameter may be used to attach the namespace to a specific ``nvme`` device (identified by an ``id`` diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 8dd9cb2ccb..f37c4fd635 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -4436,19 +4436,19 @@ static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req) NvmeIdentify *c = (NvmeIdentify *)&req->cmd; uint32_t nsid = le32_to_cpu(c->nsid); uint8_t list[NVME_IDENTIFY_DATA_SIZE] = {}; - - struct data { - struct { - NvmeIdNsDescr hdr; - uint8_t v[NVME_NIDL_UUID]; - } uuid; - struct { - NvmeIdNsDescr hdr; - uint8_t v; - } csi; - }; - - struct data *ns_descrs = (struct data *)list; + uint8_t *pos = list; + struct { + NvmeIdNsDescr hdr; + uint8_t v[NVME_NIDL_UUID]; + } QEMU_PACKED uuid; + struct { + NvmeIdNsDescr hdr; + uint64_t v; + } QEMU_PACKED eui64; + struct { + NvmeIdNsDescr hdr; + uint8_t v; + } QEMU_PACKED csi; trace_pci_nvme_identify_ns_descr_list(nsid); @@ -4462,17 +4462,29 @@ static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req) } /* - * Because the NGUID and EUI64 fields are 0 in the Identify Namespace data - * structure, a Namespace UUID (nidt = 3h) must be reported in the - * Namespace Identification Descriptor. Add the namespace UUID here. + * If the EUI-64 field is 0 and the NGUID field is 0, the namespace must + * provide a valid Namespace UUID in the Namespace Identification Descriptor + * data structure. QEMU does not yet support setting NGUID. */ - ns_descrs->uuid.hdr.nidt = NVME_NIDT_UUID; - ns_descrs->uuid.hdr.nidl = NVME_NIDL_UUID; - memcpy(&ns_descrs->uuid.v, ns->params.uuid.data, NVME_NIDL_UUID); - - ns_descrs->csi.hdr.nidt = NVME_NIDT_CSI; - ns_descrs->csi.hdr.nidl = NVME_NIDL_CSI; - ns_descrs->csi.v = ns->csi; + uuid.hdr.nidt = NVME_NIDT_UUID; + uuid.hdr.nidl = NVME_NIDL_UUID; + memcpy(uuid.v, ns->params.uuid.data, NVME_NIDL_UUID); + memcpy(pos, &uuid, sizeof(uuid)); + pos += sizeof(uuid); + + if (ns->params.eui64) { + eui64.hdr.nidt = NVME_NIDT_EUI64; + eui64.hdr.nidl = NVME_NIDL_EUI64; + eui64.v = cpu_to_be64(ns->params.eui64); + memcpy(pos, &eui64, sizeof(eui64)); + pos += sizeof(eui64); + } + + csi.hdr.nidt = NVME_NIDT_CSI; + csi.hdr.nidl = NVME_NIDL_CSI; + csi.v = ns->csi; + memcpy(pos, &csi, sizeof(csi)); + pos += sizeof(csi); return nvme_c2h(n, list, sizeof(list), req); } diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 3fec9c6273..45e457de6a 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -77,6 +77,7 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp) id_ns->mssrl = cpu_to_le16(ns->params.mssrl); id_ns->mcl = cpu_to_le32(ns->params.mcl); id_ns->msrc = ns->params.msrc; + id_ns->eui64 = cpu_to_be64(ns->params.eui64); ds = 31 - clz32(ns->blkconf.logical_block_size); ms = ns->params.ms; @@ -511,6 +512,7 @@ static Property nvme_ns_props[] = { DEFINE_PROP_BOOL("shared", NvmeNamespace, params.shared, false), DEFINE_PROP_UINT32("nsid", NvmeNamespace, params.nsid, 0), DEFINE_PROP_UUID("uuid", NvmeNamespace, params.uuid), + DEFINE_PROP_UINT64("eui64", NvmeNamespace, params.eui64, 0), DEFINE_PROP_UINT16("ms", NvmeNamespace, params.ms, 0), DEFINE_PROP_UINT8("mset", NvmeNamespace, params.mset, 0), DEFINE_PROP_UINT8("pi", NvmeNamespace, params.pi, 0), diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 93a7e0e538..ac90e13d7b 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -83,6 +83,7 @@ typedef struct NvmeNamespaceParams { bool shared; uint32_t nsid; QemuUUID uuid; + uint64_t eui64; uint16_t ms; uint8_t mset; From patchwork Fri Jun 11 23:46:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 12316753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 304F6C48BE6 for ; Sat, 12 Jun 2021 00:12:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A6D26613CA for ; Sat, 12 Jun 2021 00:12:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6D26613CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrrGL-00065D-MY for qemu-devel@archiver.kernel.org; Fri, 11 Jun 2021 20:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqs8-0006Nc-H6; Fri, 11 Jun 2021 19:47:32 -0400 Received: from mout.gmx.net ([212.227.15.15]:36841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqs6-0006Bw-Bo; Fri, 11 Jun 2021 19:47:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623455242; bh=rQLqPvBxinQQ7gY8t/jGS2z0+EcN0fbFMhSnOnmLkLc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=P8yrqf64kZXd5FgM39RhJWG8RAiTAmAEWVzqpIFI/xd1nPayy/fPhFvPj2hxvV5OI fqgez+eeAtKbtFMWhv72kRC2I7ftI7OnUOIDwZVVOw/DwS+J2hzX/wEdL0SZG08Xn1 ZDcd8FoObFJA2Vt9HWyHH/IvJ1bE7nRtRNT4XyQ4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([62.143.247.63]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1Mo6v3-1lX2zR2HhT-00pg8m; Sat, 12 Jun 2021 01:47:22 +0200 From: Heinrich Schuchardt To: Keith Busch , Klaus Jensen , Peter Maydell Subject: [PATCH v2 3/3] hw/nvme: default for namespace EUI-64 Date: Sat, 12 Jun 2021 01:46:31 +0200 Message-Id: <20210611234631.81314-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210611234631.81314-1-xypron.glpk@gmx.de> References: <20210611234631.81314-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:xCmmQqQ4SCV0f4VeAYxd95DoCiP1DKkif+ZljC2UtqfkRENvfAV qDlKMxYv/vQ/9LdZrHBC0IuzqpJqeLlS2SDim1BUbnnRRyijXssSVDB2yrTmHAyvZ2K0sr0 pYlFEPIwGqZjIGS+tvCROHUzAwfV5X65B1Fs00aXy+pY8lAJlJ3a60ZebsC7W/GTf0S/1JK 4Vhmocc18oV9jTHOMkREQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:SfQOjQMYD88=:yEmXqyPUHVyCGWUMBK/3Cb HgFXn+3Jsoo4aIKF6PaS+n2f66L2eXupwcfcbYUVXbVyEtAZruwSZkImDUenjFmddhD859dG/ EBbEbThxS1Rg+tB7OIWsDZIFcbHrMOoSNeQIwQHs3lX98v+y7LPlU93VxCte1OSohExtQ9L1w w47EARvZSPH5pDI5FdJR08gZmddMYeG7K8kHJ0dQipCmVzsYfuEgCoVJVLVFkCOdH8dB+AjoY kxSpgufM3RVdTfEjZ9mjkxaJALuwbduiO6x3QoHdCMdDLg/Z+elkeSIp+Uuoq2qUXVaMrigAo a3UQzWx/v5ls5YxLZSlKqo4EgoJDC3AJO9Z9msAobHEvb2lHYNjhNOnoCLaw3/GCq6ZvpZWUw rohg9KPAyyNbFek+vSVPrk8qt0qi6O1IbAN3opo036SVElJmT0uH5ootkRNL9gaSRz/ksCphG kkLc7ridRWoZNWFOeliSC9wNMWPmoGDQcNZ1FnLVvbg5a1190hPMQ5m2pwExDodb/7g5Axtrv uShmfySMAuCDaIoqqpujDtB/XfALtZ9pT1YYQTxjhZQhCX7MS+PK7t+Wc27iGwTy3fFTXb4+I v9mc1WTOEVe03U/N8Mexdpy9csD4HuXkLLI6bg6FQpWAguUUA1x07Oq53b+yJUgTOyY56R2+s gVhWvNfuCp+86JiJg09bbpqA/cFvJS9rj8y+TOq3CBpu4XDn8D5Xiz54kUolrv9R0k2+w9aAr PO3Q03Ymmfv3CM1zjRKAClbvPqmKIX8eQ0bXfVC2svTNemXMcADizZIgILfIkrvkDA1dDYVc/ lz5irRYF5RSQvSPt2V5/4PrKSVWqGW9tPEwg2AjF8oID6O/4H/E6XmPpAwqMDqy/5T7r11SKl 2pMFvhsmrbJ2X94CxkV7RoZANysoDoPTA6WoUOUpNSLPwFiU+9Q+z3Jp3OSOm/Sto7R/hHBdd 7E8NzgHfWgOZTAT0R9/xOFCl2vo4zOYU2hGQ/vNkQCJpT9lTOgaJZpP2BEFcEhs01pIzRBNjA 2gcnEvHoc6Y09PzLO6eXHaOruJD9rijoOesbzifjtI47ZUIWJy0vjjR6kxS2tamzrLgy5E9WD /G4n2cTCc8bCZjp5BERpCwMR7WczcGHW0tN Received-SPF: pass client-ip=212.227.15.15; envelope-from=xypron.glpk@gmx.de; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: Eduardo Habkost , qemu-block@nongnu.org, Heinrich Schuchardt , Cornelia Huck , qemu-devel@nongnu.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On machines with version > 6.0 replace a missing EUI-64 by a generated value. Signed-off-by: Heinrich Schuchardt --- v2: new patch --- docs/system/nvme.rst | 2 ++ hw/core/machine.c | 1 + hw/nvme/ns.c | 9 +++++++++ hw/nvme/nvme.h | 2 ++ 4 files changed, 14 insertions(+) -- 2.30.2 diff --git a/docs/system/nvme.rst b/docs/system/nvme.rst index b5f8288d7c..33a15c7dbc 100644 --- a/docs/system/nvme.rst +++ b/docs/system/nvme.rst @@ -84,6 +84,8 @@ There are a number of parameters available: ``eui64`` Set the EUI-64 of the namespace. This will be reported as a "IEEE Extended Unique Identifier" descriptor in the Namespace Identification Descriptor List. + Since machine type 6.1 a non-zero default value is used if the parameter + is not provided. For earlier machine types the field defaults to 0. ``bus`` If there are more ``nvme`` devices defined, this parameter may be used to diff --git a/hw/core/machine.c b/hw/core/machine.c index 55b9bc7817..d0e9348888 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -39,6 +39,7 @@ GlobalProperty hw_compat_6_0[] = { { "gpex-pcihost", "allow-unmapped-accesses", "false" }, { "i8042", "extended-state", "false"}, + { "nvme-ns", "eui64-default", "off"}, }; const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0); diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 45e457de6a..4275c3db63 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -56,6 +56,7 @@ void nvme_ns_init_format(NvmeNamespace *ns) static int nvme_ns_init(NvmeNamespace *ns, Error **errp) { + static uint64_t ns_count; NvmeIdNs *id_ns = &ns->id_ns; uint8_t ds; uint16_t ms; @@ -73,6 +74,12 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp) id_ns->nmic |= NVME_NMIC_NS_SHARED; } + /* Substitute a missing EUI-64 by an autogenerated one */ + ++ns_count; + if (!ns->params.eui64 && ns->params.eui64_default) { + ns->params.eui64 = ns_count + NVME_EUI64_DEFAULT; + } + /* simple copy */ id_ns->mssrl = cpu_to_le16(ns->params.mssrl); id_ns->mcl = cpu_to_le32(ns->params.mcl); @@ -533,6 +540,8 @@ static Property nvme_ns_props[] = { params.max_open_zones, 0), DEFINE_PROP_UINT32("zoned.descr_ext_size", NvmeNamespace, params.zd_extension_size, 0), + DEFINE_PROP_BOOL("eui64-default", NvmeNamespace, params.eui64_default, + true), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index ac90e13d7b..3fb869731d 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -26,6 +26,7 @@ #define NVME_MAX_CONTROLLERS 32 #define NVME_MAX_NAMESPACES 256 +#define NVME_EUI64_DEFAULT 0x27fed9272381cbd0UL typedef struct NvmeCtrl NvmeCtrl; typedef struct NvmeNamespace NvmeNamespace; @@ -84,6 +85,7 @@ typedef struct NvmeNamespaceParams { uint32_t nsid; QemuUUID uuid; uint64_t eui64; + bool eui64_default; uint16_t ms; uint8_t mset;