Commit 30300027 authored by Matt DeVillier's avatar Matt DeVillier Committed by Youness Alaoui

payloads/SeaBIOS: apply NVMe queue allocation patch

The committer name, email and date needs to match the author's
otherwise on every build, seabios will have a different commit
hash for HEAD, which can be problematic for reproducable builds
but also could confuse people if every time they type 'make', they
get a different hash of their rom

Change-Id: Ic4f2095173d9a58c5df335c500c8ce6578d236ec
Signed-off-by: Matt DeVillier's avatarMatt DeVillier <matt.devillier@puri.sm>
parent ff38c84d
Pipeline #3447 failed with stages
......@@ -35,6 +35,14 @@ endif
checkout: fetch
echo " Checking out SeaBIOS revision $(TAG-y)"
cd seabios; git checkout master; git branch -D coreboot 2>/dev/null; git checkout -b coreboot $(TAG-y)
for patch in $(CURDIR)/patches/*.patch; do \
echo "Applying $$patch"; \
cd $(project_dir); \
export GIT_COMMITTER_EMAIL="`grep 'From:' $$patch | grep -Po '<\K[^>]+@[^>]+(?=>)'`"; \
export GIT_COMMITTER_NAME="`grep 'From:' $$patch | cut -d '<' -f 1 | tail -c +7`"; \
git am --committer-date-is-author-date --keep-cr $$patch || \
( echo " Error when applying patches.\n"; git am --abort; exit 1; ); \
done;
config: checkout
echo " CONFIG SeaBIOS $(TAG-y)"
......
From a17975b5fe0cb2b17fdf0335430d5f4d2ab3ba4d Mon Sep 17 00:00:00 2001
From: Matt DeVillier <matt.devillier@puri.sm>
Date: Sun, 12 Aug 2018 15:26:59 -0500
Subject: [PATCH 1/1] nvme: fix I/O queue length calculation overflow
Commit cd47172 changed the I/O queue length calculation to use the
Maximum Queue Entries Supported (MQES) value from the capabilities
register, plus one, with a maximum value of NVME_PAGE_SIZE.
An unintended effect from this is that a MQES value of 0xFFFF yields
a length of zero, resulting in the queue allocation failing. Fix this
by checking for a zero length when checking that the length exceeds
NVME_PAGE_SIZE, and setting to NVME_PAGE_SIZE.
TEST: build/boot on a Purism Librem13v2 with a MyDigitalSSD BPX NVMe
drive, which reports a MQES of 0xFFFF. Verify NVMe drive present in
boot menu and OS boots successfully.
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
---
src/hw/nvme.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hw/nvme.c b/src/hw/nvme.c
index e6d739d..c2d6863 100644
--- a/src/hw/nvme.c
+++ b/src/hw/nvme.c
@@ -319,7 +319,7 @@ nvme_create_io_cq(struct nvme_ctrl *ctrl, struct nvme_cq *cq, u16 q_idx)
int rc;
struct nvme_sqe *cmd_create_cq;
u16 length = 1 + (ctrl->reg->cap & 0xffff);
- if (length > NVME_PAGE_SIZE / sizeof(struct nvme_cqe))
+ if (length == 0 || length > NVME_PAGE_SIZE / sizeof(struct nvme_cqe))
length = NVME_PAGE_SIZE / sizeof(struct nvme_cqe);
rc = nvme_init_cq(ctrl, cq, q_idx, length);
@@ -363,7 +363,7 @@ nvme_create_io_sq(struct nvme_ctrl *ctrl, struct nvme_sq *sq, u16 q_idx, struct
int rc;
struct nvme_sqe *cmd_create_sq;
u16 length = 1 + (ctrl->reg->cap & 0xffff);
- if (length > NVME_PAGE_SIZE / sizeof(struct nvme_cqe))
+ if (length == 0 || length > NVME_PAGE_SIZE / sizeof(struct nvme_cqe))
length = NVME_PAGE_SIZE / sizeof(struct nvme_cqe);
rc = nvme_init_sq(ctrl, sq, q_idx, length, cq);
--
2.17.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment