From 60c48504c262606c75540c014de0c4c5a9ef65bd Mon Sep 17 00:00:00 2001 From: mengyingkun Date: Thu, 23 Mar 2023 09:14:23 +0800 Subject: [PATCH] LoongArch: Implement cache synchronization operation Signed-off-by: mengyingkun --- grub.patches | 1 + grub2.spec | 8 ++++- ...ment-cache-synchronization-operation.patch | 30 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 loongarch-Implement-cache-synchronization-operation.patch diff --git a/grub.patches b/grub.patches index 0f899d9..b002621 100644 --- a/grub.patches +++ b/grub.patches @@ -312,4 +312,5 @@ Patch0306: loongarch-Add-support-for-new-EFI-screen-info-GUID.patch Patch0307: 0202-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch %ifarch loongarch64 Patch0308: loongarch-Force-initrd-load-address-64KiB-alignment.patch +Patch0309: loongarch-Implement-cache-synchronization-operation.patch %endif diff --git a/grub2.spec b/grub2.spec index 6dec9d2..75613de 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 26 +Release: 27 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -439,6 +439,12 @@ fi %{_datadir}/man/man* %changelog +* Wed Mar 22 2023 mengyingkun - 1:2.06-27 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:loongarch: Implement cache synchronization operation + * Sat Mar 18 2023 mengyingkun - 1:2.06-26 - Type:bugfix - CVE:NA diff --git a/loongarch-Implement-cache-synchronization-operation.patch b/loongarch-Implement-cache-synchronization-operation.patch new file mode 100644 index 0000000..bbe927b --- /dev/null +++ b/loongarch-Implement-cache-synchronization-operation.patch @@ -0,0 +1,30 @@ +From 7dccf456ce7fe693c6e488a812dc8f14ea592eeb Mon Sep 17 00:00:00 2001 +From: mengyingkun +Date: Wed, 22 Mar 2023 09:29:42 +0800 +Subject: [PATCH] loongarch: Implement cache synchronization operation + +When the module is loaded, ICACHE and DCACHE need to flush +before calling init function. If the caches are not flushed, +loader will crash unexpectedly. + +Signed-off-by: mengyingkun +--- + grub-core/kern/loongarch64/cache.S | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/kern/loongarch64/cache.S b/grub-core/kern/loongarch64/cache.S +index d291c67..6e32d37 100644 +--- a/grub-core/kern/loongarch64/cache.S ++++ b/grub-core/kern/loongarch64/cache.S +@@ -19,6 +19,8 @@ + #include + + FUNCTION (grub_arch_sync_caches) ++ ibar 0 ++ dbar 0 + jr $ra + + FUNCTION (grub_arch_sync_dma_caches) +-- +2.33.0 + -- Gitee