From cab4dcc806683d8cf493eb4e6caa8ffd2d97202b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=98=E6=80=80?= Date: Sat, 7 Sep 2024 03:14:22 +0800 Subject: [PATCH] deepin: arm64: acpi: hisi: Revert disallow AML memory opregions to access kernel memory If we have a buggy bios,and we have no bios update for it, we cannot access the _OSC map, so the CPPC cpufreq driver will not probed in some case. example: Kunpeng 920 8 core Desktop Board Log: ACPI CPPC: Failed to ioremap PCC comm region mem for 0 ACPI CPPC: Failed to find PCC channel for subspace 0 ACPI CPPC: Failed to find PCC channel for subspace 0 ACPI CPPC: Failed to find PCC channel for subspace 0 ACPI CPPC: Failed to find PCC channel for subspace 0 ACPI CPPC: Failed to find PCC channel for subspace 0 ACPI CPPC: Failed to find PCC channel for subspace 0 ACPI CPPC: Failed to find PCC channel for subspace 0 Link:https://gitee.com/openeuler/kernel/issues/I39AN0 Signed-off-by: Wentao Guan --- arch/arm64/kernel/acpi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index dba8fcec7f33d..d1d1f16f07209 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -269,6 +269,20 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr) void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { + + if (read_cpuid_implementor() == ARM_CPU_IMP_HISI) { + /* For normal memory we already have a cacheable mapping. */ + if (memblock_is_map_memory(phys)) + return (void __iomem *)__phys_to_virt(phys); + + /* + * We should still honor the memory's attribute here because + * crash dump kernel possibly excludes some ACPI (reclaim) + * regions from memblock list. + */ + return ioremap_prot(phys, size, pgprot_val(__acpi_get_mem_attribute(phys))); + } + efi_memory_desc_t *md, *region = NULL; pgprot_t prot;