LoongArch: Implement cache synchronization operation

Signed-off-by: mengyingkun <mengyingkun@loongson.cn>
(cherry picked from commit 60c48504c262606c75540c014de0c4c5a9ef65bd)
This commit is contained in:
mengyingkun 2023-03-23 09:14:23 +08:00 committed by openeuler-sync-bot
parent 28ada8bbc2
commit 8a04f685e3
3 changed files with 38 additions and 1 deletions

View File

@ -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 Patch0307: 0202-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch
%ifarch loongarch64 %ifarch loongarch64
Patch0308: loongarch-Force-initrd-load-address-64KiB-alignment.patch Patch0308: loongarch-Force-initrd-load-address-64KiB-alignment.patch
Patch0309: loongarch-Implement-cache-synchronization-operation.patch
%endif %endif

View File

@ -14,7 +14,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.06 Version: 2.06
Release: 26 Release: 27
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
@ -439,6 +439,12 @@ fi
%{_datadir}/man/man* %{_datadir}/man/man*
%changelog %changelog
* Wed Mar 22 2023 mengyingkun <mengyingkun@loongson.cn> - 1:2.06-27
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:loongarch: Implement cache synchronization operation
* Sat Mar 18 2023 mengyingkun <mengyingkun@loongson.cn> - 1:2.06-26 * Sat Mar 18 2023 mengyingkun <mengyingkun@loongson.cn> - 1:2.06-26
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA

View File

@ -0,0 +1,30 @@
From 7dccf456ce7fe693c6e488a812dc8f14ea592eeb Mon Sep 17 00:00:00 2001
From: mengyingkun <mengyingkun@loongson.cn>
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 <mengyingkun@loongson.cn>
---
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 <grub/symbol.h>
FUNCTION (grub_arch_sync_caches)
+ ibar 0
+ dbar 0
jr $ra
FUNCTION (grub_arch_sync_dma_caches)
--
2.33.0