* [PATCH v3] xen:arm: Populate arm64 image header
@ 2018-09-11 16:48 Amit Singh Tomar
2018-09-12 9:03 ` Andre Przywara
0 siblings, 1 reply; 4+ messages in thread
From: Amit Singh Tomar @ 2018-09-11 16:48 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, julien.grall, sstabellini, Amit Singh Tomar
This patch adds image size and flags to XEN image header. It uses
those fields according to the updated Linux kernel image definition.
With this patch bootloader can now place XEN image anywhere in system
RAM at 2MB aligned address without to worry about relocation.
For instance, it fixes the XEN boot on Amlogic SoC where bootloader(U-BOOT)
always relocates the XEN image to an address range reserved for firmware data.
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
---
Changes since v2:
* Undo changes in assembler.h(as suggested by Andre)
Changes since v1:
* Updated commit message
* Removed endianess code
---
xen/arch/arm/arm64/head.S | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index d63734f..ef87b5c 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -32,6 +32,13 @@
#define PT_DEV 0xe71 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=0 P=1 */
#define PT_DEV_L3 0xe73 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=1 P=1 */
+#define __HEAD_FLAG_PAGE_SIZE ((PAGE_SHIFT - 10) / 2)
+
+#define __HEAD_FLAG_PHYS_BASE 1
+
+#define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \
+ (__HEAD_FLAG_PHYS_BASE << 3))
+
#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC))
#include EARLY_PRINTK_INC
#endif
@@ -120,8 +127,8 @@ efi_head:
add x13, x18, #0x16
b real_start /* branch to kernel start */
.quad 0 /* Image load offset from start of RAM */
- .quad 0 /* reserved */
- .quad 0 /* reserved */
+ .quad _end - start /* Effective size of kernel image, little-endian */
+ .quad __HEAD_FLAGS /* Informative flags, little-endian */
.quad 0 /* reserved */
.quad 0 /* reserved */
.quad 0 /* reserved */
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v3] xen:arm: Populate arm64 image header
2018-09-11 16:48 [PATCH v3] xen:arm: Populate arm64 image header Amit Singh Tomar
@ 2018-09-12 9:03 ` Andre Przywara
2018-09-24 13:42 ` Julien Grall
0 siblings, 1 reply; 4+ messages in thread
From: Andre Przywara @ 2018-09-12 9:03 UTC (permalink / raw)
To: Amit Singh Tomar, xen-devel; +Cc: julien.grall, sstabellini
Hi,
On 11/09/2018 17:48, Amit Singh Tomar wrote:
> This patch adds image size and flags to XEN image header. It uses
> those fields according to the updated Linux kernel image definition.
>
> With this patch bootloader can now place XEN image anywhere in system
> RAM at 2MB aligned address without to worry about relocation.
> For instance, it fixes the XEN boot on Amlogic SoC where bootloader(U-BOOT)
> always relocates the XEN image to an address range reserved for firmware data.
>
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
Thanks, looks good to me now:
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre.
> ---
> Changes since v2:
> * Undo changes in assembler.h(as suggested by Andre)
> Changes since v1:
> * Updated commit message
> * Removed endianess code
> ---
> xen/arch/arm/arm64/head.S | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
> index d63734f..ef87b5c 100644
> --- a/xen/arch/arm/arm64/head.S
> +++ b/xen/arch/arm/arm64/head.S
> @@ -32,6 +32,13 @@
> #define PT_DEV 0xe71 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=0 P=1 */
> #define PT_DEV_L3 0xe73 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=1 P=1 */
>
> +#define __HEAD_FLAG_PAGE_SIZE ((PAGE_SHIFT - 10) / 2)
> +
> +#define __HEAD_FLAG_PHYS_BASE 1
> +
> +#define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \
> + (__HEAD_FLAG_PHYS_BASE << 3))
> +
> #if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC))
> #include EARLY_PRINTK_INC
> #endif
> @@ -120,8 +127,8 @@ efi_head:
> add x13, x18, #0x16
> b real_start /* branch to kernel start */
> .quad 0 /* Image load offset from start of RAM */
> - .quad 0 /* reserved */
> - .quad 0 /* reserved */
> + .quad _end - start /* Effective size of kernel image, little-endian */
> + .quad __HEAD_FLAGS /* Informative flags, little-endian */
> .quad 0 /* reserved */
> .quad 0 /* reserved */
> .quad 0 /* reserved */
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] xen:arm: Populate arm64 image header
2018-09-12 9:03 ` Andre Przywara
@ 2018-09-24 13:42 ` Julien Grall
0 siblings, 0 replies; 4+ messages in thread
From: Julien Grall @ 2018-09-24 13:42 UTC (permalink / raw)
To: Andre Przywara, Amit Singh Tomar, xen-devel; +Cc: sstabellini
On 09/12/2018 10:03 AM, Andre Przywara wrote:
> Hi,
>
> On 11/09/2018 17:48, Amit Singh Tomar wrote:
>> This patch adds image size and flags to XEN image header. It uses
>> those fields according to the updated Linux kernel image definition.
>>
>> With this patch bootloader can now place XEN image anywhere in system
>> RAM at 2MB aligned address without to worry about relocation.
>> For instance, it fixes the XEN boot on Amlogic SoC where bootloader(U-BOOT)
>> always relocates the XEN image to an address range reserved for firmware data.
>>
>> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
>
> Thanks, looks good to me now:
>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Julien Grall <julien.grall@arm.com>
And commited.
Cheers,
>
> Cheers,
> Andre.
>
>> ---
>> Changes since v2:
>> * Undo changes in assembler.h(as suggested by Andre)
>> Changes since v1:
>> * Updated commit message
>> * Removed endianess code
>> ---
>> xen/arch/arm/arm64/head.S | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
>> index d63734f..ef87b5c 100644
>> --- a/xen/arch/arm/arm64/head.S
>> +++ b/xen/arch/arm/arm64/head.S
>> @@ -32,6 +32,13 @@
>> #define PT_DEV 0xe71 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=0 P=1 */
>> #define PT_DEV_L3 0xe73 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=1 P=1 */
>>
>> +#define __HEAD_FLAG_PAGE_SIZE ((PAGE_SHIFT - 10) / 2)
>> +
>> +#define __HEAD_FLAG_PHYS_BASE 1
>> +
>> +#define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \
>> + (__HEAD_FLAG_PHYS_BASE << 3))
>> +
>> #if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC))
>> #include EARLY_PRINTK_INC
>> #endif
>> @@ -120,8 +127,8 @@ efi_head:
>> add x13, x18, #0x16
>> b real_start /* branch to kernel start */
>> .quad 0 /* Image load offset from start of RAM */
>> - .quad 0 /* reserved */
>> - .quad 0 /* reserved */
>> + .quad _end - start /* Effective size of kernel image, little-endian */
>> + .quad __HEAD_FLAGS /* Informative flags, little-endian */
>> .quad 0 /* reserved */
>> .quad 0 /* reserved */
>> .quad 0 /* reserved */
>>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] xen:arm: Populate arm64 image header
@ 2018-10-05 22:17 Stewart Hildebrand
0 siblings, 0 replies; 4+ messages in thread
From: Stewart Hildebrand @ 2018-10-05 22:17 UTC (permalink / raw)
To: Andre Przywara, Amit Tomer, Julien Grall; +Cc: xen-devel@lists.xenproject.org
On 11/09/2018 17:48, Amit Singh Tomar wrote:
> diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
> index d63734f..ef87b5c 100644
> --- a/xen/arch/arm/arm64/head.S
> +++ b/xen/arch/arm/arm64/head.S
> @@ -120,8 +127,8 @@ efi_head:
> add x13, x18, #0x16
> b real_start /* branch to kernel start */
> .quad 0 /* Image load offset from start of RAM */
> - .quad 0 /* reserved */
> - .quad 0 /* reserved */
> + .quad _end - start /* Effective size of kernel image, little-endian */
> + .quad __HEAD_FLAGS /* Informative flags, little-endian */
> .quad 0 /* reserved */
> .quad 0 /* reserved */
> .quad 0 /* reserved */
Since 17bd254a xen:arm: Populate arm64 image header, qemu-system-aarch64 has not been too happy about booting Xen.
Trying to launch qemu-system-aarch64 gives the following error:
rom: requested regions overlap (rom bootloader. free=0x00000000400d0150, addr=0x0000000040000000)
qemu-system-aarch64: rom check and register reset failed
Reverting 17bd254a allowed it to boot again. Alternatively, setting the image offset to some value allowed it to boot again.
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index ef87b5c..8879c77 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -126,7 +126,7 @@ efi_head:
*/
add x13, x18, #0x16
b real_start /* branch to kernel start */
- .quad 0 /* Image load offset from start of RAM */
+ .quad 0x00080000 /* Image load offset from start of RAM */
.quad _end - start /* Effective size of kernel image, little-endian */
.quad __HEAD_FLAGS /* Informative flags, little-endian */
.quad 0 /* reserved */
I'm not sure if this is a fault of qemu, or if Xen should put some value in the image load offset field?
For reference, I'm using the following script to build and launch qemu+Xen https://gist.github.com/stewdk/110f43e0cc1d905fc6ed4c7e10d8d35e
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-05 22:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-11 16:48 [PATCH v3] xen:arm: Populate arm64 image header Amit Singh Tomar
2018-09-12 9:03 ` Andre Przywara
2018-09-24 13:42 ` Julien Grall
-- strict thread matches above, loose matches on Subject: below --
2018-10-05 22:17 Stewart Hildebrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).