From nobody Fri Apr 19 04:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1642617951564154.23228888716994; Wed, 19 Jan 2022 10:45:51 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id A917916E3F8C; Wed, 19 Jan 2022 18:45:47 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 2732D16E36D3 for ; Wed, 19 Jan 2022 18:45:22 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Wed, 19 Jan 2022 10:45:21 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id h21sm188289qth.16.2022.01.19.10.45.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 10:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=s5ccvKtIo8BNaxWm83/EuJ4Egqkl3WJMxhnuuoFPDAk=; b=EAHtH3QN85B139ES24NQjjz+UMdIChfWDHGrnEcT7fgWkHbEqL5kCQ78wtrZdcdd82 wyN9h0iEG9OJ0JbAQagU9e7M6Wo3kUyV60lTAKmp7fC3K71K7FXuNSZR5yCIN03lITD+ +kYsttR9T3V9DdzBzekuFUmlYWa+12gWW7pm0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s5ccvKtIo8BNaxWm83/EuJ4Egqkl3WJMxhnuuoFPDAk=; b=EbprigWucw6qsWnmk2+p1n79mdPb+FuSRAHltl1Kuxkpz+IcODAZ1WGfVlrOC3F+in kGOdHQ/qnGus4TuY1K4h3NIQ/cKJ2VrEy6oaSDWIiU0TWVhQCjd2BCvmNq1tiLu02571 y5y4E9z4CHX2LIgjU9zeIh9zMz//Cqg1K4kBrkDLWP54ALJ8BY2l+/zV4YT8gnMr2mRB ZYu8Q2bO8AN6VwvqJohnJXsMJB58htgZ0iJjMn5tx4EreFUp8OgUOjFP+ekqfTiijT5d S3xV4nkILX/LPj3oM31yMy5f78eURadBmv2CSQelUP/HLojWu1A3nAvB1U7oymu6azRF wQzg== X-Gm-Message-State: AOAM532CUS/AsEHscmoRDJr1UG6AjFbK31EhuXAbse+nwOplMmqX+FXl I+oGQHFYIthuf/TeX9etJJQliCY+IcuvCw== X-Google-Smtp-Source: ABdhPJzxsaHyOI0kD+ygu2IGy2d9wxyt8RXxCpbj9YZFAcJxiUTGu7ODr7+RzYKMoM8kffgoFl/zvA== X-Received: by 2002:a05:6214:5288:: with SMTP id kj8mr28930181qvb.101.1642617920927; Wed, 19 Jan 2022 10:45:20 -0800 (PST) From: Kevin O'Connor To: seabios@seabios.org Date: Wed, 19 Jan 2022 13:45:09 -0500 Message-Id: <20220119184513.1828156-2-kevin@koconnor.net> In-Reply-To: <20220119184513.1828156-1-kevin@koconnor.net> References: <20220119184513.1828156-1-kevin@koconnor.net> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: ERRL7PLGQVGGBGUFC33UDMJXRYWXHQ5K X-Message-ID-Hash: ERRL7PLGQVGGBGUFC33UDMJXRYWXHQ5K X-MailFrom: kevin@koconnor.net 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; digests; suspicious-header X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 1/5] nvme: Rework nvme_io_readwrite() to return -1 on error List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1642617952598100001 Content-Type: text/plain; charset="utf-8" Rename nvme_io_readwrite() to nvme_io_xfer() and change it so it implements the debugging dprintf() and it returns -1 on an error. Signed-off-by: Kevin O'Connor Reviewed-by: Alexander Graf --- src/hw/nvme.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hw/nvme.c b/src/hw/nvme.c index f035fa2..a97501b 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -417,8 +417,8 @@ err: /* Reads count sectors into buf. Returns DISK_RET_*. The buffer cannot cro= ss page boundaries. */ static int -nvme_io_readwrite(struct nvme_namespace *ns, u64 lba, char *buf, u16 count, - int write) +nvme_io_xfer(struct nvme_namespace *ns, u64 lba, void *buf, u16 count, + int write) { u32 buf_addr =3D (u32)buf; void *prp2; @@ -426,7 +426,7 @@ nvme_io_readwrite(struct nvme_namespace *ns, u64 lba, c= har *buf, u16 count, if (buf_addr & 0x3) { /* Buffer is misaligned */ warn_internalerror(); - return DISK_RET_EBADTRACK; + return -1; } =20 if ((ns->block_size * count) > (NVME_PAGE_SIZE * 2)) { @@ -457,10 +457,12 @@ nvme_io_readwrite(struct nvme_namespace *ns, u64 lba,= char *buf, u16 count, dprintf(2, "read io: %08x %08x %08x %08x\n", cqe.dword[0], cqe.dword[1], cqe.dword[2], cqe.dword[3]); =20 - return DISK_RET_EBADTRACK; + return -1; } =20 - return DISK_RET_SUCCESS; + dprintf(5, "ns %u %s lba %llu+%u\n", ns->ns_id, write ? "write" : "rea= d", + lba, count); + return count; } =20 static void nvme_reset_prpl(struct nvme_namespace *ns) @@ -716,20 +718,18 @@ nvme_scan(void) static int nvme_cmd_readwrite(struct nvme_namespace *ns, struct disk_op_s *op, int wr= ite) { - int res =3D DISK_RET_SUCCESS; u16 const max_blocks =3D NVME_PAGE_SIZE / ns->block_size; u16 i, blocks; =20 - for (i =3D 0; i < op->count && res =3D=3D DISK_RET_SUCCESS;) { + for (i =3D 0; i < op->count;) { u16 blocks_remaining =3D op->count - i; char *op_buf =3D op->buf_fl + i * ns->block_size; =20 blocks =3D nvme_build_prpl(ns, op_buf, blocks_remaining); if (blocks) { - res =3D nvme_io_readwrite(ns, op->lba + i, ns->prp1, blocks, w= rite); - dprintf(5, "ns %u %s lba %llu+%u: %d\n", ns->ns_id, write ? "w= rite" - : "r= ead", - op->lba, blocks, res); + int res =3D nvme_io_xfer(ns, op->lba + i, ns->prp1, blocks, wr= ite); + if (res < 0) + return DISK_RET_EBADTRACK; } else { blocks =3D blocks_remaining < max_blocks ? blocks_remaining : max_blocks; @@ -738,12 +738,12 @@ nvme_cmd_readwrite(struct nvme_namespace *ns, struct = disk_op_s *op, int write) memcpy(ns->dma_buffer, op_buf, blocks * ns->block_size); } =20 - res =3D nvme_io_readwrite(ns, op->lba + i, ns->dma_buffer, blo= cks, write); - dprintf(5, "ns %u %s lba %llu+%u: %d\n", ns->ns_id, write ? "w= rite" - : "r= ead", - op->lba + i, blocks, res); + int res =3D nvme_io_xfer(ns, op->lba + i, ns->dma_buffer, + blocks, write); + if (res < 0) + return DISK_RET_EBADTRACK; =20 - if (!write && res =3D=3D DISK_RET_SUCCESS) { + if (!write) { memcpy(op_buf, ns->dma_buffer, blocks * ns->block_size); } } @@ -751,7 +751,7 @@ nvme_cmd_readwrite(struct nvme_namespace *ns, struct di= sk_op_s *op, int write) i +=3D blocks; } =20 - return res; + return DISK_RET_SUCCESS; } =20 int --=20 2.31.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 04:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1642617962875167.74273774473977; Wed, 19 Jan 2022 10:46:02 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id E020916E3F89; Wed, 19 Jan 2022 18:45:58 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id CB54516E36D3 for ; Wed, 19 Jan 2022 18:45:22 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Wed, 19 Jan 2022 10:45:22 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id j11sm124388qtj.90.2022.01.19.10.45.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 10:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iRXZAeeE8Xrmw2/97NMqAk9/OYKXF/Cb1IwPmQn9IcU=; b=LbtKH7Ky8OtINuXCCEj9bVkRDhWduphWqqeAKJJnY96vQR2G6iU7j/BGP2YZJF4H3G ocHBvRhggfZx8Ryp4n2D5/SjPeEoyNB0GuU9lMi/2+2nNhlemoH0LKS+WDDNTLKDSEA1 tvPnR6NXGP7G598El2hBQdGKmn21VVh58zk2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iRXZAeeE8Xrmw2/97NMqAk9/OYKXF/Cb1IwPmQn9IcU=; b=DaytfxsFZ1kaplvpyn/Ku/sbFoiyifWRmA+zVrIocSgxeWe7X+GA3y3vjhlKL7hCrc 46FhQgGpZglMbHWwrh7uviyoThqXCZndDSNSkxaDSy63dW8sa0oXLjNEdKGt/2arvd4Y cS11hvA0ze82zRfOjjw3g+v8g5BXvWQDFpyavEudTdJvr7YxQigRRi1Y8fUnIaQsGZPF Z1OmdOeGm0jU4gYtV0O9/+jAyQhYxN4bZGDkbywXUYBEgDBcFiTasv1X6SfydaQSZmS6 fCwcyZfte6wiyMhuY+wBNPE08TPyVWZarfRb4WnF1KV/19R86ln0/aRVjXMb0uGJv5o2 ghvQ== X-Gm-Message-State: AOAM532VtyZnk7Iv8PVYNpmoJLCtFRFXQ2V65WPDjgd5Qzd7ZhFjp/wS bM1OcNK19Ashg806heN0S1P8nvLbrSKgzQ== X-Google-Smtp-Source: ABdhPJx8prP+qpwwDvonMZoZX9zVuDyeRWY0OEdZmb4cjG0HKk4WUnjIXWaGdC9PFubwl88SL1kOOw== X-Received: by 2002:ac8:4e50:: with SMTP id e16mr16894799qtw.211.1642617921655; Wed, 19 Jan 2022 10:45:21 -0800 (PST) From: Kevin O'Connor To: seabios@seabios.org Date: Wed, 19 Jan 2022 13:45:10 -0500 Message-Id: <20220119184513.1828156-3-kevin@koconnor.net> In-Reply-To: <20220119184513.1828156-1-kevin@koconnor.net> References: <20220119184513.1828156-1-kevin@koconnor.net> MIME-Version: 1.0 X-Spam-Level: * Message-ID-Hash: CNEKUHAUNGIYVEARMYSJ7CJAXQZ4U6IR X-Message-ID-Hash: CNEKUHAUNGIYVEARMYSJ7CJAXQZ4U6IR X-MailFrom: kevin@koconnor.net 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; digests; suspicious-header X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 2/5] nvme: Add nvme_bounce_xfer() helper function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1642617964791100001 Content-Type: text/plain; charset="utf-8" Move bounce buffer processing to a new helper function. Signed-off-by: Kevin O'Connor Reviewed-by: Alexander Graf --- src/hw/nvme.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/hw/nvme.c b/src/hw/nvme.c index a97501b..fd7c1d0 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -465,6 +465,25 @@ nvme_io_xfer(struct nvme_namespace *ns, u64 lba, void = *buf, u16 count, return count; } =20 +// Transfer up to one page of data using the internal dma bounce buffer +static int +nvme_bounce_xfer(struct nvme_namespace *ns, u64 lba, void *buf, u16 count, + int write) +{ + u16 const max_blocks =3D NVME_PAGE_SIZE / ns->block_size; + u16 blocks =3D count < max_blocks ? count : max_blocks; + + if (write) + memcpy(ns->dma_buffer, buf, blocks * ns->block_size); + + int res =3D nvme_io_xfer(ns, lba, ns->dma_buffer, blocks, write); + + if (!write && res >=3D 0) + memcpy(buf, ns->dma_buffer, res * ns->block_size); + + return res; +} + static void nvme_reset_prpl(struct nvme_namespace *ns) { ns->prpl_len =3D 0; @@ -718,7 +737,6 @@ nvme_scan(void) static int nvme_cmd_readwrite(struct nvme_namespace *ns, struct disk_op_s *op, int wr= ite) { - u16 const max_blocks =3D NVME_PAGE_SIZE / ns->block_size; u16 i, blocks; =20 for (i =3D 0; i < op->count;) { @@ -731,21 +749,10 @@ nvme_cmd_readwrite(struct nvme_namespace *ns, struct = disk_op_s *op, int write) if (res < 0) return DISK_RET_EBADTRACK; } else { - blocks =3D blocks_remaining < max_blocks ? blocks_remaining - : max_blocks; - - if (write) { - memcpy(ns->dma_buffer, op_buf, blocks * ns->block_size); - } - - int res =3D nvme_io_xfer(ns, op->lba + i, ns->dma_buffer, - blocks, write); + int res =3D nvme_bounce_xfer(ns, op->lba + i, op_buf, blocks, = write); if (res < 0) return DISK_RET_EBADTRACK; - - if (!write) { - memcpy(op_buf, ns->dma_buffer, blocks * ns->block_size); - } + blocks =3D res; } =20 i +=3D blocks; --=20 2.31.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 04:35:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1642617974831197.05680726000844; Wed, 19 Jan 2022 10:46:14 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 2027916E3F90; Wed, 19 Jan 2022 18:46:11 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 890FD16E36D3 for ; Wed, 19 Jan 2022 18:45:23 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Wed, 19 Jan 2022 10:45:23 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id s126sm245250qke.135.2022.01.19.10.45.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 10:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hoG29dW98WNHLfPSddiy8h/kCG/PcL4XfsZJYjN8p6A=; b=RZ30ZzqfLx5yvKAXvSI0h7r9eUlfxkkyCtuMBoNS+V/Ert2d4tR78Xwoj9uFNvjOY0 O8W4+42OwYYCfdid9dbhslOTXm1e03JplN8tfb+LqZtmGUQOvx7XTYE2IBOGOCoyV09y 7DRjjLKEL3bb0tdRo4gwfS8v9kFT0BAMzdj/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hoG29dW98WNHLfPSddiy8h/kCG/PcL4XfsZJYjN8p6A=; b=iZbiRUuQzW9xw2WfSbhAU8wCj4stkxm/0PR3TPw8cA/dTEWxyBcjyNgWkzFZL2ZygS ebXeJJoWIls4aqiBHOE0g7dxqTmGXUejUwOd6I7QmwFd/eKBhxgBNebtMfD8lYVmeRqY L5saq00Z6MDMy5+Xkhv8fww7nAhYqYUaCtUsCSpOOvodk7jEaUB6AOZrQQAxtuiqTYkM ha0HxGAiFcEyXQtTYTMcq6oHmI1+gtkBKCSnABdwSyfjJ5xtm9JwvZDLavqn9oHSAcro PCkEMpoQlrSP/AnnALJ84RE8kosiahY3nVPTjZytM+2hZcie8sBd0h8zk3a5NNox5NDU 78QA== X-Gm-Message-State: AOAM530tcIYe8BUn8feWPgGN+WKLmFmEu85GPwqCAkYPGVCCZovMtKSO Hq6MLB67MMXiEhhQziNLVdBFwKP+897Evw== X-Google-Smtp-Source: ABdhPJzb15+8kfD0DtWCk6g9fRt/rOOhDFaNO4n9agyT3q9srZfvXjjOTCYG+9G9lYNL5I0fjlv5pA== X-Received: by 2002:a05:620a:1987:: with SMTP id bm7mr18676737qkb.450.1642617922407; Wed, 19 Jan 2022 10:45:22 -0800 (PST) From: Kevin O'Connor To: seabios@seabios.org Date: Wed, 19 Jan 2022 13:45:11 -0500 Message-Id: <20220119184513.1828156-4-kevin@koconnor.net> In-Reply-To: <20220119184513.1828156-1-kevin@koconnor.net> References: <20220119184513.1828156-1-kevin@koconnor.net> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: TG3JPZNYE62RXKZ6TI2JXZWVYR6PXUKC X-Message-ID-Hash: TG3JPZNYE62RXKZ6TI2JXZWVYR6PXUKC X-MailFrom: kevin@koconnor.net 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; digests; suspicious-header X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 3/5] nvme: Convert nvme_build_prpl() to nvme_prpl_xfer() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1642617976900100001 Content-Type: text/plain; charset="utf-8" Rename nvme_build_prpl() to nvme_prpl_xfer() and directly invoke nvme_io_xfer() or nvme_bounce_xfer() from that function. Signed-off-by: Kevin O'Connor --- src/hw/nvme-int.h | 1 - src/hw/nvme.c | 42 ++++++++++++++++-------------------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/hw/nvme-int.h b/src/hw/nvme-int.h index a4c1555..9564c17 100644 --- a/src/hw/nvme-int.h +++ b/src/hw/nvme-int.h @@ -125,7 +125,6 @@ struct nvme_namespace { =20 /* Page List */ u32 prpl_len; - void *prp1; u64 prpl[NVME_MAX_PRPL_ENTRIES]; }; =20 diff --git a/src/hw/nvme.c b/src/hw/nvme.c index fd7c1d0..bafe8bf 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -499,10 +499,13 @@ static int nvme_add_prpl(struct nvme_namespace *ns, u= 64 base) return 0; } =20 -static int nvme_build_prpl(struct nvme_namespace *ns, void *op_buf, u16 co= unt) +// Transfer data using page list (if applicable) +static int +nvme_prpl_xfer(struct nvme_namespace *ns, u64 lba, void *buf, u16 count, + int write) { int first_page =3D 1; - u32 base =3D (long)op_buf; + u32 base =3D (long)buf; s32 size; =20 if (count > ns->max_req_size) @@ -512,31 +515,28 @@ static int nvme_build_prpl(struct nvme_namespace *ns,= void *op_buf, u16 count) =20 size =3D count * ns->block_size; /* Special case for transfers that fit into PRP1, but are unaligned */ - if (((size + (base & ~NVME_PAGE_MASK)) <=3D NVME_PAGE_SIZE)) { - ns->prp1 =3D op_buf; - return count; - } + if (((size + (base & ~NVME_PAGE_MASK)) <=3D NVME_PAGE_SIZE)) + return nvme_io_xfer(ns, lba, buf, count, write); =20 /* Every request has to be page aligned */ if (base & ~NVME_PAGE_MASK) - return 0; + return nvme_bounce_xfer(ns, lba, buf, count, write); =20 /* Make sure a full block fits into the last chunk */ if (size & (ns->block_size - 1ULL)) - return 0; + return nvme_bounce_xfer(ns, lba, buf, count, write); =20 for (; size > 0; base +=3D NVME_PAGE_SIZE, size -=3D NVME_PAGE_SIZE) { if (first_page) { /* First page is special */ - ns->prp1 =3D (void*)base; first_page =3D 0; continue; } if (nvme_add_prpl(ns, base)) - return 0; + return nvme_bounce_xfer(ns, lba, buf, count, write); } =20 - return count; + return nvme_io_xfer(ns, lba, buf, count, write); } =20 static int @@ -737,24 +737,14 @@ nvme_scan(void) static int nvme_cmd_readwrite(struct nvme_namespace *ns, struct disk_op_s *op, int wr= ite) { - u16 i, blocks; - + int i; for (i =3D 0; i < op->count;) { u16 blocks_remaining =3D op->count - i; char *op_buf =3D op->buf_fl + i * ns->block_size; - - blocks =3D nvme_build_prpl(ns, op_buf, blocks_remaining); - if (blocks) { - int res =3D nvme_io_xfer(ns, op->lba + i, ns->prp1, blocks, wr= ite); - if (res < 0) - return DISK_RET_EBADTRACK; - } else { - int res =3D nvme_bounce_xfer(ns, op->lba + i, op_buf, blocks, = write); - if (res < 0) - return DISK_RET_EBADTRACK; - blocks =3D res; - } - + int blocks =3D nvme_prpl_xfer(ns, op->lba + i, op_buf, + blocks_remaining, write); + if (blocks < 0) + return DISK_RET_EBADTRACK; i +=3D blocks; } =20 --=20 2.31.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 04:35:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1642617985879276.4995642846741; Wed, 19 Jan 2022 10:46:25 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 127B116E3F92; Wed, 19 Jan 2022 18:46:22 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 66F0116E36D3 for ; Wed, 19 Jan 2022 18:45:24 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Wed, 19 Jan 2022 10:45:24 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id h6sm257648qkk.125.2022.01.19.10.45.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 10:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=s9+vsAP1a0yZ0ahfaU2tc1IwmGvUXfNxwW8QUlZ+0DE=; b=FuiPmj0dSt+d1dTavXAbjl2knZVyCYofzlftvEiq+5bYJS0COzuFeMvpVqW9rOpomn P0SPLsuddYvM9LYDFEmCDgaF/OaLt3B4JRMOzm3g+inM5Mk5c7RInPv7ReMOFnwJnr25 a4ahRAnCyHpPqN2OKsMCMHufT2pdy/LEbNPKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s9+vsAP1a0yZ0ahfaU2tc1IwmGvUXfNxwW8QUlZ+0DE=; b=3plS/fJrYrn7WF2c5Ym7teyft10XVI4AgDTAM0zTyl3Fpc9y2nhbdS6el9+yssB6d4 x1xXpg3hVmJwp9j/AGVgethj8UVJRZHJI/VtmHhg4aCuVN5tCLZAmYyDfirlqHyb5XOi XV2mP0I+O2GnKRTn6hZi1RGZMeoj+JWLT5sg+ESJroUtqPwfK0PF9ZH4TKP8mF0EVLUn 7ZMq1NvpF4aeJbjiSqTdNG7/V8pk5sUJKnXvIYPiztCf31LbYbHzgGEenl71ZcmkT+/o Mu6Mszsec5HGL39oxmRBjCCLol9GPW7frmSrX3zADHML255EQe4baPZcsWVOv722T5ai Fyqw== X-Gm-Message-State: AOAM533zNYfp9Pj/UoXwa2Y+gH83UQlmN+EQ6lDohuUykp3Gk6Enqz95 v0Y5lwYwv/5EcaaYEEorK9GCCBafJvwtSg== X-Google-Smtp-Source: ABdhPJxzau6sshmEg+l8cALOlOLJkTcXgYDTMgao9WD7mzsNo8JgGV0ehLoBXheFZWDk1m545lFC0g== X-Received: by 2002:a05:620a:178d:: with SMTP id ay13mr5411816qkb.150.1642617923296; Wed, 19 Jan 2022 10:45:23 -0800 (PST) From: Kevin O'Connor To: seabios@seabios.org Date: Wed, 19 Jan 2022 13:45:12 -0500 Message-Id: <20220119184513.1828156-5-kevin@koconnor.net> In-Reply-To: <20220119184513.1828156-1-kevin@koconnor.net> References: <20220119184513.1828156-1-kevin@koconnor.net> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: 5KEIHTYTMBVKTKYGTE634DG5RUHJOCUQ X-Message-ID-Hash: 5KEIHTYTMBVKTKYGTE634DG5RUHJOCUQ X-MailFrom: kevin@koconnor.net 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; digests; suspicious-header X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 4/5] nvme: Pass prp1 and prp2 directly to nvme_io_xfer() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1642617987413100001 Content-Type: text/plain; charset="utf-8" When using a prp2 parameter, build it in nvme_prpl_xfer() and pass it directly to nvme_io_xfer(). Signed-off-by: Kevin O'Connor Reviewed-by: Alexander Graf --- src/hw/nvme.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/hw/nvme.c b/src/hw/nvme.c index bafe8bf..3a73784 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -417,33 +417,19 @@ err: /* Reads count sectors into buf. Returns DISK_RET_*. The buffer cannot cro= ss page boundaries. */ static int -nvme_io_xfer(struct nvme_namespace *ns, u64 lba, void *buf, u16 count, - int write) +nvme_io_xfer(struct nvme_namespace *ns, u64 lba, void *prp1, void *prp2, + u16 count, int write) { - u32 buf_addr =3D (u32)buf; - void *prp2; - - if (buf_addr & 0x3) { + if (((u32)prp1 & 0x3) || ((u32)prp2 & 0x3)) { /* Buffer is misaligned */ warn_internalerror(); return -1; } =20 - if ((ns->block_size * count) > (NVME_PAGE_SIZE * 2)) { - /* We need to describe more than 2 pages, rely on PRP List */ - prp2 =3D ns->prpl; - } else if ((ns->block_size * count) > NVME_PAGE_SIZE) { - /* Directly embed the 2nd page if we only need 2 pages */ - prp2 =3D (void *)(long)ns->prpl[0]; - } else { - /* One page is enough, don't expose anything else */ - prp2 =3D NULL; - } - struct nvme_sqe *io_read =3D nvme_get_next_sqe(&ns->ctrl->io_sq, write ? NVME_SQE_OPC_IO_W= RITE : NVME_SQE_OPC_IO_R= EAD, - NULL, buf, prp2); + NULL, prp1, prp2); io_read->nsid =3D ns->ns_id; io_read->dword[10] =3D (u32)lba; io_read->dword[11] =3D (u32)(lba >> 32); @@ -476,7 +462,7 @@ nvme_bounce_xfer(struct nvme_namespace *ns, u64 lba, vo= id *buf, u16 count, if (write) memcpy(ns->dma_buffer, buf, blocks * ns->block_size); =20 - int res =3D nvme_io_xfer(ns, lba, ns->dma_buffer, blocks, write); + int res =3D nvme_io_xfer(ns, lba, ns->dma_buffer, NULL, blocks, write); =20 if (!write && res >=3D 0) memcpy(buf, ns->dma_buffer, res * ns->block_size); @@ -516,7 +502,7 @@ nvme_prpl_xfer(struct nvme_namespace *ns, u64 lba, void= *buf, u16 count, size =3D count * ns->block_size; /* Special case for transfers that fit into PRP1, but are unaligned */ if (((size + (base & ~NVME_PAGE_MASK)) <=3D NVME_PAGE_SIZE)) - return nvme_io_xfer(ns, lba, buf, count, write); + return nvme_io_xfer(ns, lba, buf, NULL, count, write); =20 /* Every request has to be page aligned */ if (base & ~NVME_PAGE_MASK) @@ -536,7 +522,18 @@ nvme_prpl_xfer(struct nvme_namespace *ns, u64 lba, voi= d *buf, u16 count, return nvme_bounce_xfer(ns, lba, buf, count, write); } =20 - return nvme_io_xfer(ns, lba, buf, count, write); + void *prp2; + if ((ns->block_size * count) > (NVME_PAGE_SIZE * 2)) { + /* We need to describe more than 2 pages, rely on PRP List */ + prp2 =3D ns->prpl; + } else if ((ns->block_size * count) > NVME_PAGE_SIZE) { + /* Directly embed the 2nd page if we only need 2 pages */ + prp2 =3D (void *)(long)ns->prpl[0]; + } else { + /* One page is enough, don't expose anything else */ + prp2 =3D NULL; + } + return nvme_io_xfer(ns, lba, buf, prp2, count, write); } =20 static int --=20 2.31.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 04:35:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1642617998849130.8858821537682; Wed, 19 Jan 2022 10:46:38 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 0E27B16E3F9B; Wed, 19 Jan 2022 18:46:35 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 31B0016E36D3 for ; Wed, 19 Jan 2022 18:45:25 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Wed, 19 Jan 2022 10:45:25 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id z5sm295438qkj.41.2022.01.19.10.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 10:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9LZgXWV9NR50kP8COPzYTBoOTBdFxsoZV52iAwEyydY=; b=MWgjZaOM/Y5PMBWV3tITHRy0o4fuEagjKe2Uxfu/sOqHy2Xs4/xYZkLodZE/nh5Hei QS1lx02k+Xmb1r/2c7JP33oFBN34EJvXX+lLKMe5l6tj6RYbfZh5wxIa1L2qN5r6MJ6i 4cw3f8Fn61VV4RmEVQbKVK7P0nv+/bOyrdkzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9LZgXWV9NR50kP8COPzYTBoOTBdFxsoZV52iAwEyydY=; b=GZel+VZySV+d0scJlJGiW6/dvOXN7zpkcNY1sQXI5mbpdja76zDgKCHEYbB0qVa8GW T8a1ohQykl4ObfCIT7uoQ3T6FnKeQjRejiO/6jQLxRD1N9famk+IytlcTo73hIpOqWkP BlWXEyL1KrPp53uuN8+a0N2hxKNMiewOia6gWNsSN8WwV+NNFlV1SdnFdfZXWzYWwK6x AdszaanBPyQIaSUtozhtqzTP4O0gbRj6LrgIZutJz9yW/ScqW4rcVOxkda3ljSpJelxR b7MJU9k7y6EuiwkCnZHKBqeG9rvqpikN8VJt8d6QXrZ0Vtnmlp+F09lq5DNOC1EUgBkh ZWPA== X-Gm-Message-State: AOAM533lvGVjxHN8A3smaAIa7FMTo2rkd7X6HCxv95FwAOV0eKxVa/qs ZBTCkIpQl6+rHR92ZpG6vYMeiwpk7ghKXQ== X-Google-Smtp-Source: ABdhPJzg71yTgFQ8vev+qLplgeyYfzxBeIoMilGV/rn4/UX1wC1idQhtaRIJxn/Pl7ThwVpInEg3xA== X-Received: by 2002:a05:6214:252e:: with SMTP id gg14mr2969829qvb.89.1642617924061; Wed, 19 Jan 2022 10:45:24 -0800 (PST) From: Kevin O'Connor To: seabios@seabios.org Date: Wed, 19 Jan 2022 13:45:13 -0500 Message-Id: <20220119184513.1828156-6-kevin@koconnor.net> In-Reply-To: <20220119184513.1828156-1-kevin@koconnor.net> References: <20220119184513.1828156-1-kevin@koconnor.net> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: PHMYDBEXIDSMYSRAGZQWPYZ6J2GKT6QT X-Message-ID-Hash: PHMYDBEXIDSMYSRAGZQWPYZ6J2GKT6QT X-MailFrom: kevin@koconnor.net 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; digests; suspicious-header CC: Alexander Graf X-Mailman-Version: 3.3.5rc1 Precedence: list Subject: [SeaBIOS] [PATCH 5/5] nvme: Build the page list in the existing dma buffer List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1642617999999100001 Content-Type: text/plain; charset="utf-8" Commit 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists") introduced multi-page requests using the NVMe PRP mechanism. To store the list and "first page to write to" hints, it added fields to the NVMe namespace struct. Unfortunately, that struct resides in fseg which is read-only at runtime. While KVM ignores the read-only part and allows writes, real hardware and TCG adhere to the semantics and ignore writes to the fseg region. The net effect of that is that reads and writes were always happening on address 0, unless they went through the bounce buffer logic. This patch builds the PRP maintenance data in the existing "dma bounce buffer" and only builds it when needed. Fixes: 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists") Reported-by: Matt DeVillier Signed-off-by: Alexander Graf Signed-off-by: Kevin O'Connor --- src/hw/nvme-int.h | 6 ------ src/hw/nvme.c | 51 +++++++++++++++++------------------------------ 2 files changed, 18 insertions(+), 39 deletions(-) diff --git a/src/hw/nvme-int.h b/src/hw/nvme-int.h index 9564c17..f0d717d 100644 --- a/src/hw/nvme-int.h +++ b/src/hw/nvme-int.h @@ -10,8 +10,6 @@ #include "types.h" // u32 #include "pcidevice.h" // struct pci_device =20 -#define NVME_MAX_PRPL_ENTRIES 15 /* Allows requests up to 64kb */ - /* Data structures */ =20 /* The register file of a NVMe host controller. This struct follows the na= ming @@ -122,10 +120,6 @@ struct nvme_namespace { =20 /* Page aligned buffer of size NVME_PAGE_SIZE. */ char *dma_buffer; - - /* Page List */ - u32 prpl_len; - u64 prpl[NVME_MAX_PRPL_ENTRIES]; }; =20 /* Data structures for NVMe admin identify commands */ diff --git a/src/hw/nvme.c b/src/hw/nvme.c index 3a73784..39b9138 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -470,35 +470,19 @@ nvme_bounce_xfer(struct nvme_namespace *ns, u64 lba, = void *buf, u16 count, return res; } =20 -static void nvme_reset_prpl(struct nvme_namespace *ns) -{ - ns->prpl_len =3D 0; -} - -static int nvme_add_prpl(struct nvme_namespace *ns, u64 base) -{ - if (ns->prpl_len >=3D NVME_MAX_PRPL_ENTRIES) - return -1; - - ns->prpl[ns->prpl_len++] =3D base; - - return 0; -} +#define NVME_MAX_PRPL_ENTRIES 15 /* Allows requests up to 64kb */ =20 // Transfer data using page list (if applicable) static int nvme_prpl_xfer(struct nvme_namespace *ns, u64 lba, void *buf, u16 count, int write) { - int first_page =3D 1; u32 base =3D (long)buf; s32 size; =20 if (count > ns->max_req_size) count =3D ns->max_req_size; =20 - nvme_reset_prpl(ns); - size =3D count * ns->block_size; /* Special case for transfers that fit into PRP1, but are unaligned */ if (((size + (base & ~NVME_PAGE_MASK)) <=3D NVME_PAGE_SIZE)) @@ -512,28 +496,29 @@ nvme_prpl_xfer(struct nvme_namespace *ns, u64 lba, vo= id *buf, u16 count, if (size & (ns->block_size - 1ULL)) return nvme_bounce_xfer(ns, lba, buf, count, write); =20 - for (; size > 0; base +=3D NVME_PAGE_SIZE, size -=3D NVME_PAGE_SIZE) { - if (first_page) { - /* First page is special */ - first_page =3D 0; - continue; - } - if (nvme_add_prpl(ns, base)) - return nvme_bounce_xfer(ns, lba, buf, count, write); - } - - void *prp2; if ((ns->block_size * count) > (NVME_PAGE_SIZE * 2)) { - /* We need to describe more than 2 pages, rely on PRP List */ - prp2 =3D ns->prpl; + /* We need to describe more than 2 pages, build PRP List */ + u32 prpl_len =3D 0; + u64 *prpl =3D (void*)ns->dma_buffer; + int first_page =3D 1; + for (; size > 0; base +=3D NVME_PAGE_SIZE, size -=3D NVME_PAGE_SIZ= E) { + if (first_page) { + /* First page is special */ + first_page =3D 0; + continue; + } + if (prpl_len >=3D NVME_MAX_PRPL_ENTRIES) + return nvme_bounce_xfer(ns, lba, buf, count, write); + prpl[prpl_len++] =3D base; + } + return nvme_io_xfer(ns, lba, buf, prpl, count, write); } else if ((ns->block_size * count) > NVME_PAGE_SIZE) { /* Directly embed the 2nd page if we only need 2 pages */ - prp2 =3D (void *)(long)ns->prpl[0]; + return nvme_io_xfer(ns, lba, buf, buf + NVME_PAGE_SIZE, count, wri= te); } else { /* One page is enough, don't expose anything else */ - prp2 =3D NULL; + return nvme_io_xfer(ns, lba, buf, NULL, count, write); } - return nvme_io_xfer(ns, lba, buf, prp2, count, write); } =20 static int --=20 2.31.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org