Re: [PATCH v2] LoongArch: Enable ACPI BGRT handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2024/9/14 下午3:01, Huacai Chen wrote:
Hi, Bibo,

On Sat, Sep 14, 2024 at 2:53 PM Bibo Mao <maobibo@xxxxxxxxxxx> wrote:

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@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202409102056.DNqh6zzA-lkp@xxxxxxxxx/
Signed-off-by: Bibo Mao <maobibo@xxxxxxxxxxx>
---
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.
I've applied V1, build warnings seems another problem which has no
relationship with this patch itself.
Good, thanks for applying it.

Regards
Bibo Mao

Huacai

---
  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







[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux