All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY
@ 2017-01-24 17:11 Ard Biesheuvel
  2017-01-24 18:01 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2017-01-24 17:11 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index b051367e2149..888295e46b53 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY
  2017-01-24 17:11 [PATCH] arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY Ard Biesheuvel
@ 2017-01-24 18:01 ` Will Deacon
  2017-01-24 18:13   ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2017-01-24 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 24, 2017 at 05:11:40PM +0000, Ard Biesheuvel wrote:
> 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.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY
  2017-01-24 18:01 ` Will Deacon
@ 2017-01-24 18:13   ` Ard Biesheuvel
  2017-01-25  4:26     ` Hanjun Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2017-01-24 18:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 24 January 2017 at 18:01, Will Deacon <will.deacon@arm.com> wrote:
> On Tue, Jan 24, 2017 at 05:11:40PM +0000, Ard Biesheuvel wrote:
>> 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.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY
  2017-01-24 18:13   ` Ard Biesheuvel
@ 2017-01-25  4:26     ` Hanjun Guo
  0 siblings, 0 replies; 4+ messages in thread
From: Hanjun Guo @ 2017-01-25  4:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 2017/1/25 2:13, Ard Biesheuvel wrote:
> On 24 January 2017 at 18:01, Will Deacon <will.deacon@arm.com> wrote:
>> On Tue, Jan 24, 2017 at 05:11:40PM +0000, Ard Biesheuvel wrote:
>>> 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.
>>>
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> ---
>>>  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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-25  4:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 17:11 [PATCH] arm64: kernel: do not mark reserved memory regions as IORESOURCE_BUSY Ard Biesheuvel
2017-01-24 18:01 ` Will Deacon
2017-01-24 18:13   ` Ard Biesheuvel
2017-01-25  4:26     ` Hanjun Guo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.