From nobody Fri Apr 19 01:14:27 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.com; 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.com ARC-Seal: i=1; a=rsa-sha256; t=1601500338; cv=none; d=zohomail.com; s=zohoarc; b=ckPko1VEYDUK27Ia4hEcv4cz5p5p5VAGYNGIcc/VB0RG6f6QU3+B/KQ+tFxWtk/o6VryYoWh+N7ayS/L7OeBP9fSWlXhGI5qco3cCh2RgSFTmlajubjhejLsy1iu4brXq3FGFUhGCoUNTkEbPwat8jbOKJVxYQE4HQrmjE5ZtcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601500338; 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=toQ4Wwax6/9q862mAOev30C2oU9tq4dhlodw5gS+8+Q=; b=UYs/Kti2Mm02ZzSXDyvBbr5DdMAlqGpK87CyZGrntijgxxTMk5m/F8M4WzaoKQuW0OtKHibINSjw1WXdX5m3aIa7aiUPEMzI+umYaHDw17ZUAqY0aVHqxTiJZUBXOL73RtU35CfmlEIHWQppQoaq22xQz5z6cPQb11J0HQjNrIs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@amazon.com; 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 1601500338588669.9432690082726; Wed, 30 Sep 2020 14:12:18 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 8DF1710C00A4; Wed, 30 Sep 2020 21:12:14 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 6763510C0089 for ; Wed, 30 Sep 2020 21:11:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 30 Sep 2020 21:11:10 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id B08231A0D1D for ; Wed, 30 Sep 2020 21:11:09 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Sep 2020 21:11:09 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Sep 2020 21:11:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1601500290; x=1633036290; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F63TJ7mKpPGimYmibqZcA0p9+Jw3a6RIFzFH+XWuNPk=; b=UtaBKA/S9aW5YblFH6YVRC5rzl7tEcR9apbMmpS45iy9l+DuIhdEVPdh JZY0LbBynq0wrLAii6ude1UGxgZtE3k2nOge0Bq7y6ZYzww38ZieOxH2I y82YidU8F0xG7keFw9exN+RRk9pO4qcZplObsnm4sjguHoxitPHfUWuBA g=; X-IronPort-AV: E=Sophos;i="5.77,322,1596499200"; d="scan'208";a="57257604" From: Alexander Graf To: Date: Wed, 30 Sep 2020 23:10:56 +0200 Message-ID: <20200930211056.8478-5-graf@amazon.com> In-Reply-To: <20200930211056.8478-1-graf@amazon.com> References: <20200930211056.8478-1-graf@amazon.com> MIME-Version: 1.0 X-ClientProxiedBy: EX13D15UWA002.ant.amazon.com (10.43.160.218) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Message-ID-Hash: SU4X27X2L2LCFP3IETMMVBLY4HNPIRGI X-Message-ID-Hash: SU4X27X2L2LCFP3IETMMVBLY4HNPIRGI X-MailFrom: prvs=535b814ec=graf@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] [PATCH v3 4/4] nvme: Split requests by maximum allowed 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" Some NVMe controllers only support small maximum request sizes, such as the AWS EBS NVMe implementation which only supports NVMe requests of up to 32 pages (256kb) at once. BIOS callers can exceed those request sizes by defining sector counts above this threshold. Currently we fall back to the bounce buffer implementation for those. This is slow. This patch introduces splitting logic to the NVMe I/O request code so that every NVMe I/O request gets handled in a chunk size that is consumable by the NVMe adapter, while maintaining the fast path PRPL logic we just introduced. Signed-off-by: Alexander Graf --- src/hw/nvme.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/hw/nvme.c b/src/hw/nvme.c index b92ca52..cc37bca 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -727,6 +727,22 @@ nvme_cmd_readwrite(struct nvme_namespace *ns, struct d= isk_op_s *op, int write) u16 const max_blocks =3D NVME_PAGE_SIZE / ns->block_size; u16 i; =20 + /* Split up requests that are larger than the device can handle */ + if (op->count > ns->max_req_size) { + u16 count =3D op->count; + + /* Handle the first max_req_size elements */ + op->count =3D ns->max_req_size; + if (nvme_cmd_readwrite(ns, op, write)) + return res; + + /* Handle the remainder of the request */ + op->count =3D count - ns->max_req_size; + op->lba +=3D ns->max_req_size; + op->buf_fl +=3D (ns->max_req_size * ns->block_size); + return nvme_cmd_readwrite(ns, op, write); + } + if (!nvme_build_prpl(ns, op)) { /* Request goes via PRP List logic */ return nvme_io_readwrite(ns, op->lba, ns->prp1, op->count, write); --=20 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