Skip to contentSkip to conversation

arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY

PATCH New Ard Biesheuvel 3 participants 4 messages Jan 24, 2017 – Jan 25, 2017 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY

Memory regions marked as NOMAP should not be used for general allocation by the kernel, and should not even be covered by the linear mapping (hence the name). However, drivers or other subsystems (such as ACPI) that access the firmware directly may legally access them, which means it is also reasonable for such drivers to claim them by invoking request_resource(). Currently, this is prevented by the fact that arm64's request_standard_resources() marks reserved regions as IORESOURCE_BUSY.

So drop the IORESOURCE_BUSY flag from these requests.

---
 arch/arm64/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/setup.c +1 -1
index b051367e2149..888295e46b53 100644
@@ -208,7 +208,7 @@ static void __init request_standard_resources(void)
 		res = alloc_bootmem_low(sizeof(*res));
 		if (memblock_is_nomap(region)) {
 			res->name  = "reserved";
-			res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+			res->flags = IORESOURCE_MEM;
 		} else {
 			res->name  = "System RAM";
 			res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY

Quoted 8 lines · Ard Biesheuvel

Memory regions marked as NOMAP should not be used for general allocation by the kernel, and should not even be covered by the linear mapping (hence the name). However, drivers or other subsystems (such as ACPI) that access the firmware directly may legally access them, which means it is also reasonable for such drivers to claim them by invoking request_resource(). Currently, this is prevented by the fact that arm64's request_standard_resources() marks reserved regions as IORESOURCE_BUSY.

Quoted 6 lines

So drop the IORESOURCE_BUSY flag from these requests.

---
 arch/arm64/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Did you find this my inspection, or has somebody reported a problem?

Will

#2 lore raw

PATCH 1/1 arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY

Quoted 9 lines · Will Deacon
Quoted 8 lines · Ard Biesheuvel

Memory regions marked as NOMAP should not be used for general allocation by the kernel, and should not even be covered by the linear mapping (hence the name). However, drivers or other subsystems (such as ACPI) that access the firmware directly may legally access them, which means it is also reasonable for such drivers to claim them by invoking request_resource(). Currently, this is prevented by the fact that arm64's request_standard_resources() marks reserved regions as IORESOURCE_BUSY.

Quoted 9 lines
Quoted 6 lines

So drop the IORESOURCE_BUSY flag from these requests.

---
 arch/arm64/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Did you find this my inspection, or has somebody reported a problem?

Hanjun (whom I forgot to cc) reported an issue with the ACPI EINJ (error injection) code, which may call request_resource() on UEFI reserved regions.

#3 lore raw

PATCH 1/1 arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY

Quoted 17 lines · Ard Biesheuvel
Quoted 16 lines · Will Deacon
Quoted 14 lines · Ard Biesheuvel

Memory regions marked as NOMAP should not be used for general allocation by the kernel, and should not even be covered by the linear mapping (hence the name). However, drivers or other subsystems (such as ACPI) that access the firmware directly may legally access them, which means it is also reasonable for such drivers to claim them by invoking request_resource(). Currently, this is prevented by the fact that arm64's request_standard_resources() marks reserved regions as IORESOURCE_BUSY.

So drop the IORESOURCE_BUSY flag from these requests.

---
 arch/arm64/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines
Quoted 2 lines

Did you find this my inspection, or has somebody reported a problem?

Hanjun (whom I forgot to cc) reported an issue with the ACPI EINJ (error injection) code, which may call request_resource() on UEFI reserved regions.

Yes, we were testing ACPI error ejection thought the register region, the register region is reported by firmware in EINJ table which the table is marked as reserved, then in the kernel will failed to request the memory region because all the reserved memory block is set to IORESOURCE_BUSY before this patch.

Tested this patch and error ejecting works OK.

Thanks
Hanjun