Skip to content

Commit eed2ef4

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fix from Catalin Marinas: "A previous commit to prevent AML memory opregions from accessing the kernel memory turned out to be too restrictive. Relax the permission check to permit the ACPI core to map kernel memory used for table overrides" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: permit ACPI core to map kernel memory used for table overrides
2 parents fcadab7 + a509a66 commit eed2ef4

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

arch/arm64/kernel/acpi.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,21 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
298298
case EFI_BOOT_SERVICES_DATA:
299299
case EFI_CONVENTIONAL_MEMORY:
300300
case EFI_PERSISTENT_MEMORY:
301-
pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
302-
return NULL;
301+
if (memblock_is_map_memory(phys) ||
302+
!memblock_is_region_memory(phys, size)) {
303+
pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
304+
return NULL;
305+
}
306+
/*
307+
* Mapping kernel memory is permitted if the region in
308+
* question is covered by a single memblock with the
309+
* NOMAP attribute set: this enables the use of ACPI
310+
* table overrides passed via initramfs, which are
311+
* reserved in memory using arch_reserve_mem_area()
312+
* below. As this particular use case only requires
313+
* read access, fall through to the R/O mapping case.
314+
*/
315+
fallthrough;
303316

304317
case EFI_RUNTIME_SERVICES_CODE:
305318
/*
@@ -388,3 +401,8 @@ int apei_claim_sea(struct pt_regs *regs)
388401

389402
return err;
390403
}
404+
405+
void arch_reserve_mem_area(acpi_physical_address addr, size_t size)
406+
{
407+
memblock_mark_nomap(addr, size);
408+
}

include/linux/acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
958958
acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
959959
u32 val_a, u32 val_b);
960960

961-
#ifdef CONFIG_X86
961+
#ifndef CONFIG_IA64
962962
void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
963963
#else
964964
static inline void arch_reserve_mem_area(acpi_physical_address addr,

0 commit comments

Comments
 (0)