From nobody Fri May 17 03:39:35 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@amazon.de; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=quarantine dis=quarantine) header.from=amazon.de ARC-Seal: i=1; a=rsa-sha256; t=1601461349; cv=none; d=zohomail.com; s=zohoarc; b=IszrqQdzKlgwoyslfjmE/oPP4huv6XDEPbs4/wZ8PcX4hXM7MlrSQli1Tw6YknfhkGwdMkVGtz1v29ivZH2kSfzFObsErQ9YFHM47utvPFf9r79pCJ/aqxBYhXBea09otg68DGREZXFNLUdFGeTy1dgmpzlDQiZaZ+afEU91Llw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601461349; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=awrVON4xSF/zhwZUs69LWGY4wixibJs99koS+Yu3k2E=; b=hAg3/6HoS01XppNdWhpFtZxrgQCTT84cK1I7Fq+Zaif1A+KKhnvcQIPIHA5k08z7mOc8/Yio8mmLOzuHP6oPZxD9jdk5tpM6NzHhoOt2+XL+uDm4GpT6S5X4S2FukcbdX6gv7P6FhyOP0xvQqgX8HW4C6U8vh1x08I/rP/VgWxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@amazon.de; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1601461349092471.50011547254246; Wed, 30 Sep 2020 03:22:29 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id DE99C10C0077; Wed, 30 Sep 2020 10:22:23 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 8499310C0074 for ; Wed, 30 Sep 2020 10:22:06 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 30 Sep 2020 10:22:04 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by email-inbound-relay-2b-5bdc5131.us-west-2.amazon.com (Postfix) with ESMTPS id 32B77A1DE3 for ; Wed, 30 Sep 2020 10:22:04 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Sep 2020 10:22:03 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) EX13D20UWC004.ant.amazon.com (10.43.162.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Sep 2020 10:22:02 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) EX13D02EUC001.ant.amazon.com ([10.43.164.92]) with mapi id 15.00.1497.006; Wed, 30 Sep 2020 10:22:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1601461326; x=1632997326; h=from:to:subject:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding; bh=acEiyZfJgp4rpfO4wyxNJ3Kger7cUHAiSR0yZmMTnBk=; b=AflXvI8VAIE5FN632Hr/gwzUKj1B4ZrLKXqq0ncxgAGBAqySt7vF2H+4 5oLjQgSUL77dcwAbhHCG2WKM7O1F8HPkbRQQ0ZGmqQKVZ4HxI3xf/DvUW 60OcNHPYfd+GAN0N33CRUISg54Wk7YPZanwR6YfqGWiOjifVpYRdVV5ar o=; X-IronPort-AV: E=Sophos;i="5.77,322,1596499200"; d="scan'208";a="56912940" From: "Sironi, Filippo" To: "Graf (AWS), Alexander" , "seabios@seabios.org" Thread-Topic: [UNVERIFIED SENDER] [SeaBIOS] [PATCH 1/3] nvme: Record maximum allowed request size Thread-Index: AQHWlqaV3a0KOZErQU69zv+3soYnw6mA9WQL Date: Wed, 30 Sep 2020 10:22:01 +0000 Message-ID: <1601461320073.3870@amazon.de> References: <20200929183653.4717-1-graf@amazon.com>,<20200929183653.4717-2-graf@amazon.com> In-Reply-To: <20200929183653.4717-2-graf@amazon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted MIME-Version: 1.0 Message-ID-Hash: OE4FV7HJJQHBWIAZE3CJ47O7UJ6QOKWB X-Message-ID-Hash: OE4FV7HJJQHBWIAZE3CJ47O7UJ6QOKWB X-MailFrom: prvs=5351b6f17=sironi@amazon.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] Re: [UNVERIFIED SENDER] [PATCH 1/3] nvme: Record maximum allowed request size List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------- X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" ________________________________________ From: Alexander Graf Sent: Tuesday, September 29, 2020 20:36 To: seabios@seabios.org Subject: [UNVERIFIED SENDER] [SeaBIOS] [PATCH 1/3] nvme: Record maximum all= owed request size NVMe has a limit on how many sectors it can handle at most within a single request. Remember that number, so that in a follow-up patch, we can verify that we don't exceed it. Signed-off-by: Alexander Graf --- src/hw/nvme-int.h | 8 +++++++- src/hw/nvme.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/hw/nvme-int.h b/src/hw/nvme-int.h index 9f95dd8..674008a 100644 --- a/src/hw/nvme-int.h +++ b/src/hw/nvme-int.h @@ -117,6 +117,7 @@ struct nvme_namespace { u32 block_size; u32 metadata_size; + u32 max_req_size; /* Page aligned buffer of size NVME_PAGE_SIZE. */ char *dma_buffer; @@ -131,7 +132,12 @@ struct nvme_identify_ctrl { char mn[40]; char fr[8]; - char _boring[516 - 72]; + u8 rab; + u8 ieee[3]; + u8 cmic; + u8 mdts; + + char _boring[516 - 78]; u32 nn; /* number of namespaces */ }; diff --git a/src/hw/nvme.c b/src/hw/nvme.c index 6a01204..2cde6a7 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -238,7 +238,8 @@ nvme_admin_identify_ns(struct nvme_ctrl *ctrl, u32 ns_i= d) } static void -nvme_probe_ns(struct nvme_ctrl *ctrl, struct nvme_namespace *ns, u32 ns_id) +nvme_probe_ns(struct nvme_ctrl *ctrl, struct nvme_namespace *ns, u32 ns_id, + u8 mdts) { ns->ctrl =3D ctrl; ns->ns_id =3D ns_id; @@ -281,6 +282,14 @@ nvme_probe_ns(struct nvme_ctrl *ctrl, struct nvme_name= space *ns, u32 ns_id) ns->drive.blksize =3D ns->block_size; ns->drive.sectors =3D ns->lba_count; + if (mdts) { + ns->max_req_size =3D 1U << mdts; + dprintf(3, "NVME NS %u max request size: %d sectors\n", + ns->max_req_size); The use of dprintf is incorrect, you're only providing one variable to prin= t instead of two. You're missing the number of sectors. + } else { + ns->max_req_size =3D -1U; + } + ns->dma_buffer =3D zalloc_page_aligned(&ZoneHigh, NVME_PAGE_SIZE); char *desc =3D znprintf(MAXDESCSIZE, "NVMe NS %u: %llu MiB (%llu %u-by= te " @@ -567,7 +576,7 @@ nvme_controller_enable(struct nvme_ctrl *ctrl) /* Populate namespace IDs */ int ns_idx; for (ns_idx =3D 0; ns_idx < ctrl->ns_count; ns_idx++) { - nvme_probe_ns(ctrl, &ctrl->ns[ns_idx], ns_idx + 1); + nvme_probe_ns(ctrl, &ctrl->ns[ns_idx], ns_idx + 1, identify->mdts); } dprintf(3, "NVMe initialization complete!\n"); -- 2.16.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org