lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240914065318.2099448-1-maobibo@loongson.cn>
Date: Sat, 14 Sep 2024 14:53:18 +0800
From: Bibo Mao <maobibo@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>,
	"Rafael J . Wysocki" <rafael@...nel.org>
Cc: Len Brown <lenb@...nel.org>,
	WANG Xuerui <kernel@...0n.name>,
	loongarch@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	linux-acpi@...r.kernel.org,
	kernel test robot <lkp@...el.com>
Subject: [PATCH v2] LoongArch: Enable ACPI BGRT handling

Add ACPI BGRT support on LoongArch so it can display image provied by
acpi table at boot stage and switch to graphical UI smoothly.

Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409102056.DNqh6zzA-lkp@intel.com/
Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
---
v1 ... v2:
  1. Solve compile warning issue reported from lkp, return type of
     function early_memunmap() is void *, that of function early_ioremap()
     is void __iomem *, force type conversion is added.
---
 arch/loongarch/include/asm/io.h | 4 +---
 arch/loongarch/kernel/acpi.c    | 8 ++++++--
 arch/loongarch/mm/ioremap.c     | 9 +++++++++
 drivers/acpi/Kconfig            | 2 +-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
index 5e95a60df180..3049bccec693 100644
--- a/arch/loongarch/include/asm/io.h
+++ b/arch/loongarch/include/asm/io.h
@@ -10,6 +10,7 @@
 
 #include <asm/addrspace.h>
 #include <asm/cpu.h>
+#include <asm/early_ioremap.h>
 #include <asm/page.h>
 #include <asm/pgtable-bits.h>
 #include <asm/string.h>
@@ -17,9 +18,6 @@
 extern void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size);
 extern void __init early_iounmap(void __iomem *addr, unsigned long size);
 
-#define early_memremap early_ioremap
-#define early_memunmap early_iounmap
-
 #ifdef CONFIG_ARCH_IOREMAP
 
 static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index 929a497c987e..2993d7921198 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -9,6 +9,7 @@
 
 #include <linux/init.h>
 #include <linux/acpi.h>
+#include <linux/efi-bgrt.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/memblock.h>
@@ -39,14 +40,14 @@ void __init __iomem * __acpi_map_table(unsigned long phys, unsigned long size)
 	if (!phys || !size)
 		return NULL;
 
-	return early_memremap(phys, size);
+	return (void __iomem *)early_memremap(phys, size);
 }
 void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
 {
 	if (!map || !size)
 		return;
 
-	early_memunmap(map, size);
+	early_memunmap((void *)map, size);
 }
 
 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
@@ -212,6 +213,9 @@ void __init acpi_boot_table_init(void)
 	/* Do not enable ACPI SPCR console by default */
 	acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
 
+	if (IS_ENABLED(CONFIG_ACPI_BGRT))
+		acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
+
 	return;
 
 fdt_earlycon:
diff --git a/arch/loongarch/mm/ioremap.c b/arch/loongarch/mm/ioremap.c
index 70ca73019811..28562ac510c8 100644
--- a/arch/loongarch/mm/ioremap.c
+++ b/arch/loongarch/mm/ioremap.c
@@ -16,6 +16,15 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)
 
 }
 
+void __init *early_memremap(resource_size_t phys_addr, unsigned long size)
+{
+	return (__force void *)early_ioremap(phys_addr, size);
+}
+
+void __init early_memunmap(void *addr, unsigned long size)
+{
+}
+
 void *early_memremap_ro(resource_size_t phys_addr, unsigned long size)
 {
 	return early_memremap(phys_addr, size);
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e3a7c2aedd5f..d67f63d93b2a 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -451,7 +451,7 @@ config ACPI_HED
 
 config ACPI_BGRT
 	bool "Boottime Graphics Resource Table support"
-	depends on EFI && (X86 || ARM64)
+	depends on EFI && (X86 || ARM64 || LOONGARCH)
 	help
 	  This driver adds support for exposing the ACPI Boottime Graphics
 	  Resource Table, which allows the operating system to obtain

base-commit: 196145c606d0f816fd3926483cb1ff87e09c2c0b
-- 
2.39.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ