diff --git a/0021-OvmfPkg-IoMmuDxe-Implement-SetAttribute-of-CsvIoMmu.patch b/0021-OvmfPkg-IoMmuDxe-Implement-SetAttribute-of-CsvIoMmu.patch new file mode 100644 index 0000000000000000000000000000000000000000..a36b96f352379d654d4b560db3b00e30f01b9677 --- /dev/null +++ b/0021-OvmfPkg-IoMmuDxe-Implement-SetAttribute-of-CsvIoMmu.patch @@ -0,0 +1,82 @@ +From e8084565f3e41b55a0e1637b5fd948502fbec043 Mon Sep 17 00:00:00 2001 +From: Xin Jiang +Date: Mon, 20 May 2024 13:53:17 +0800 +Subject: [PATCH] OvmfPkg/IoMmuDxe: Implement SetAttribute() of CsvIoMmu + +As PciIoMap() adds feedback with the status of SetAttribute () +return value, it is necessary to implement SetAttribute () for +CsvIoMmu to fix the CSV3 boot up failure issue. + +Signed-off-by: Xin Jiang +Signed-off-by: hanliyang +--- + OvmfPkg/IoMmuDxe/CsvIoMmu.c | 53 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 52 insertions(+), 1 deletion(-) + +diff --git a/OvmfPkg/IoMmuDxe/CsvIoMmu.c b/OvmfPkg/IoMmuDxe/CsvIoMmu.c +index 2a46e98..755ef06 100644 +--- a/OvmfPkg/IoMmuDxe/CsvIoMmu.c ++++ b/OvmfPkg/IoMmuDxe/CsvIoMmu.c +@@ -539,7 +539,58 @@ CsvIoMmuSetAttribute ( + IN UINT64 IoMmuAccess + ) + { +- return EFI_UNSUPPORTED; ++ MAP_INFO *MapInfo; ++ EFI_STATUS Status; ++ ++ DEBUG ((DEBUG_VERBOSE, "%a: Mapping=0x%p Access=%lu\n", __func__, Mapping, IoMmuAccess)); ++ ++ if (Mapping == NULL) { ++ return EFI_INVALID_PARAMETER; ++ } ++ ++ Status = EFI_SUCCESS; ++ ++ // ++ // An IoMmuAccess value of 0 is always accepted, validate any non-zero value. ++ // ++ if (IoMmuAccess != 0) { ++ MapInfo = (MAP_INFO *)Mapping; ++ ++ // ++ // The mapping operation already implied the access mode. Validate that ++ // the supplied access mode matches operation access mode. ++ // ++ switch (MapInfo->Operation) { ++ case EdkiiIoMmuOperationBusMasterRead: ++ case EdkiiIoMmuOperationBusMasterRead64: ++ if (IoMmuAccess != EDKII_IOMMU_ACCESS_READ) { ++ Status = EFI_INVALID_PARAMETER; ++ } ++ ++ break; ++ ++ case EdkiiIoMmuOperationBusMasterWrite: ++ case EdkiiIoMmuOperationBusMasterWrite64: ++ if (IoMmuAccess != EDKII_IOMMU_ACCESS_WRITE) { ++ Status = EFI_INVALID_PARAMETER; ++ } ++ ++ break; ++ ++ case EdkiiIoMmuOperationBusMasterCommonBuffer: ++ case EdkiiIoMmuOperationBusMasterCommonBuffer64: ++ if (IoMmuAccess != (EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE)) { ++ Status = EFI_INVALID_PARAMETER; ++ } ++ ++ break; ++ ++ default: ++ Status = EFI_UNSUPPORTED; ++ } ++ } ++ ++ return Status; + } + + EDKII_IOMMU_PROTOCOL mCsv = { +-- +2.31.1 + diff --git a/edk2.spec b/edk2.spec index a533ab411a7124eee480b16666147f6e123244d3..3e8dabe3a35a741d69ba42743d6f41c150dabd92 100644 --- a/edk2.spec +++ b/edk2.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 %undefine _auto_set_build_flags ExclusiveArch: x86_64 aarch64 loongarch64 @@ -80,6 +80,7 @@ Patch0017: 0017-OvmfPkg-AmdSevDxe-Add-support-for-SEV-live-migration.patch Patch0018: 0018-OvmfPkg-BaseMemcryptSevLib-Correct-the-calculation-o.patch Patch0019: 0019-OvmfPkg-BaseMemEncryptLib-Return-SUCCESS-if-not-supp.patch Patch0020: 0020-OvmfPkg-BaseMemEncryptLib-Save-memory-encrypt-status.patch +Patch0021: 0021-OvmfPkg-IoMmuDxe-Implement-SetAttribute-of-CsvIoMmu.patch BuildRequires: python3-devel BuildRequires: libuuid-devel @@ -479,6 +480,9 @@ install -m 0644 \ %changelog +* Mon May 20 2024 Liyang Han - 202402-4 +- Fix failure to recognize block device in CSV3 guest + * Fri May 17 2024 Xiaotian Wu - 202402-3 - Fix json file to match loongarch64 machine.