diff mbox

[U-Boot,v5,5/7] armv8: ls2080a: Declare spin tables as reserved for efi loader

Message ID 1476525795-27483-6-git-send-email-agraf@suse.de
State Superseded
Delegated to: Alexander Graf
Headers show

Commit Message

Alexander Graf Oct. 15, 2016, 10:03 a.m. UTC
The efi loader code has its own memory map, so it needs to be aware where
the spin tables are located, to ensure that no code writes into those
regions.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

York Sun Oct. 15, 2016, 4:57 p.m. UTC | #1
On 10/15/2016 03:03 AM, Alexander Graf wrote:
> The efi loader code has its own memory map, so it needs to be aware where
> the spin tables are located, to ensure that no code writes into those
> regions.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> index 1a8321b..facfcca 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> @@ -5,6 +5,7 @@
>   */
>
>  #include <common.h>
> +#include <efi_loader.h>
>  #include <libfdt.h>
>  #include <fdt_support.h>
>  #include <phy.h>
> @@ -105,6 +106,11 @@ remove_psci_node:
>
>  	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
>  			*boot_code_size);
> +#ifdef CONFIG_EFI_LOADER
> +	efi_add_memory_map((uintptr_t)&secondary_boot_code,
> +			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
> +			   EFI_RESERVED_MEMORY_TYPE, false);
> +#endif
>  }
>  #endif
>
>
Alex,

Does it make more sense to use __spin_table instead of 
secondary_boot_code (even they happen to have the same value here)?

York
Alexander Graf Oct. 17, 2016, 7:01 a.m. UTC | #2
On 15.10.16 18:57, york sun wrote:
> On 10/15/2016 03:03 AM, Alexander Graf wrote:
>> The efi loader code has its own memory map, so it needs to be aware where
>> the spin tables are located, to ensure that no code writes into those
>> regions.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> index 1a8321b..facfcca 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> @@ -5,6 +5,7 @@
>>   */
>>
>>  #include <common.h>
>> +#include <efi_loader.h>
>>  #include <libfdt.h>
>>  #include <fdt_support.h>
>>  #include <phy.h>
>> @@ -105,6 +106,11 @@ remove_psci_node:
>>
>>  	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
>>  			*boot_code_size);
>> +#ifdef CONFIG_EFI_LOADER
>> +	efi_add_memory_map((uintptr_t)&secondary_boot_code,
>> +			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
>> +			   EFI_RESERVED_MEMORY_TYPE, false);
>> +#endif
>>  }
>>  #endif
>>
>>
> Alex,
> 
> Does it make more sense to use __spin_table instead of 
> secondary_boot_code (even they happen to have the same value here)?

I'm reasonably indifferent, but I wanted to make sure we're using the
same values as the fdt_add_mem_rsv() line above :).


Alex
York Sun Oct. 18, 2016, 3:42 p.m. UTC | #3
On 10/17/2016 02:01 AM, Alexander Graf wrote:
>
>
> On 15.10.16 18:57, york sun wrote:
>> On 10/15/2016 03:03 AM, Alexander Graf wrote:
>>> The efi loader code has its own memory map, so it needs to be aware where
>>> the spin tables are located, to ensure that no code writes into those
>>> regions.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> ---
>>>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>>> index 1a8321b..facfcca 100644
>>> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>>> @@ -5,6 +5,7 @@
>>>   */
>>>
>>>  #include <common.h>
>>> +#include <efi_loader.h>
>>>  #include <libfdt.h>
>>>  #include <fdt_support.h>
>>>  #include <phy.h>
>>> @@ -105,6 +106,11 @@ remove_psci_node:
>>>
>>>  	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
>>>  			*boot_code_size);
>>> +#ifdef CONFIG_EFI_LOADER
>>> +	efi_add_memory_map((uintptr_t)&secondary_boot_code,
>>> +			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
>>> +			   EFI_RESERVED_MEMORY_TYPE, false);
>>> +#endif
>>>  }
>>>  #endif
>>>
>>>
>> Alex,
>>
>> Does it make more sense to use __spin_table instead of
>> secondary_boot_code (even they happen to have the same value here)?
>
> I'm reasonably indifferent, but I wanted to make sure we're using the
> same values as the fdt_add_mem_rsv() line above :).

OK, then.

York
diff mbox

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 1a8321b..facfcca 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -5,6 +5,7 @@ 
  */
 
 #include <common.h>
+#include <efi_loader.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 #include <phy.h>
@@ -105,6 +106,11 @@  remove_psci_node:
 
 	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
 			*boot_code_size);
+#ifdef CONFIG_EFI_LOADER
+	efi_add_memory_map((uintptr_t)&secondary_boot_code,
+			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
+			   EFI_RESERVED_MEMORY_TYPE, false);
+#endif
 }
 #endif