Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base: ovmf: backport patches to fix nvm support with qemu #877

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From da20ace9d582f61a0938cf53f10a4352400619a4 Mon Sep 17 00:00:00 2001
From: "Mara Sophie Grosch via groups.io" <[email protected]>
Date: Wed, 23 Mar 2022 18:22:33 +0800
Subject: [PATCH 1/2] MdeModulePkg/NvmExpressDxe: fix check for Cap.Css

Fix the check for NVMe command set being supported by the controller.

Was problematic with qemu (6.2.0, Debian 1:6.2+dfsg-3), which sets 0xC1
in that register, making the OVMF think the NVMe controller does not
support NVMe.

Uncovered by commit 9dd14fc91c174eae87fd122c7ac70073a363527f, which
changed the number of bits included in the Css register from 4 to 8.

Upstream-Status: Backport [https://github.com/tianocore/edk2/pull/2682]

Signed-off-by: Mara Sophie Grosch <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
---
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
index ac77afe113..6706996ad5 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
@@ -785,7 +785,7 @@ NvmeControllerInit (
return Status;
}

- if (Private->Cap.Css != 0x01) {
+ if ((Private->Cap.Css & BIT0) == 0) {
DEBUG ((DEBUG_INFO, "NvmeControllerInit: the controller doesn't support NVMe command set\n"));
return EFI_UNSUPPORTED;
}
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From f4f6188862b5557f96581ce2d0fb6084e3f355e4 Mon Sep 17 00:00:00 2001
From: "Mara Sophie Grosch via groups.io" <[email protected]>
Date: Wed, 23 Mar 2022 18:22:34 +0800
Subject: [PATCH 2/2] MdeModulePkg/NvmExpressPei: fix check for NVM command set

Previous commit fixed that check in DXE, this one now for PEI.

Upstream-Status: Backport [https://github.com/tianocore/edk2/pull/2682]

Signed-off-by: Mara Sophie Grosch <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
---
MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c
index ac956bdce4..bff5cfd0d5 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c
@@ -571,7 +571,7 @@ NvmeControllerInit (
// Read the controller Capabilities register and verify that the NVM command set is supported
//
NVME_GET_CAP (Private, &Private->Cap);
- if (Private->Cap.Css != 0x01) {
+ if ((Private->Cap.Css & BIT0) == 0) {
DEBUG ((DEBUG_ERROR, "%a: The NVME controller doesn't support NVMe command set.\n", __FUNCTION__));
return EFI_UNSUPPORTED;
}
--
2.34.1

7 changes: 7 additions & 0 deletions meta-lmp-base/recipes-core/ovmf/ovmf_git.bbappend
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI += "\
file://0001-MdeModulePkg-NvmExpressDxe-fix-check-for-Cap.Css.patch \
file://0002-MdeModulePkg-NvmExpressPei-fix-check-for-NVM-command.patch \
"

PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'tpm2', '', d)}"
PACKAGECONFIG[tpm2] = "-D TPM2_ENABLE=TRUE,-D TPM2_ENABLE=FALSE,,"