Skip to contentSkip to conversation

xen: arm64: Add support for Renesas RCar Gen3 H3 Salvator-X platform

PATCH In review Dirk Behme 5 participants 19 messages Jul 5, 2016 – Jul 11, 2016

lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

PATCH v2 1/1 xen: arm64: Add support for Renesas RCar Gen3 H3 Salvator-X platform

---
Changes in v2: Drop unneeded rcar3.c

 docs/misc/arm/early-printk.txt    |  1 +
 xen/arch/arm/Rules.mk             |  1 +
 xen/arch/arm/arm64/debug-scif.inc | 54 +++++++++++++++++++++++++++++++++++++++
 xen/drivers/char/Kconfig          |  2 +-
 4 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 xen/arch/arm/arm64/debug-scif.inc
docs/misc/arm/early-printk.txt +1 -0
index 41b528b..20acbc7 100644
@@ -41,6 +41,7 @@ the name of the machine:
   - lager: printk with SCIF0 on Renesas R-Car H2 processors
   - midway: printk with the pl011 on Calxeda Midway processors
   - omap5432: printk with UART3 on TI OMAP5432 processors
+  - salvator-x: printk with SCIF2 on Renesas R-Car H3 processors
   - seattle: printk with pl011 for AMD Seattle processor
   - sun6i: printk with 8250 on Allwinner A31 processors
   - sun7i: printk with 8250 on Allwinner A20 processors
xen/arch/arm/Rules.mk +1 -0
index 93304be..3003e7b 100644
@@ -36,6 +36,7 @@ EARLY_PRINTK_juno           := pl011,0x7ff80000
 EARLY_PRINTK_lager          := scif,0xe6e60000
 EARLY_PRINTK_midway         := pl011,0xfff36000
 EARLY_PRINTK_omap5432       := 8250,0x48020000,2
+EARLY_PRINTK_salvator-x     := scif,0xe6e88000
 EARLY_PRINTK_seattle        := pl011,0xe1010000
 EARLY_PRINTK_sun6i          := 8250,0x01c28000,2
 EARLY_PRINTK_sun7i          := 8250,0x01c28000,2
xen/arch/arm/arm64/debug-scif.inc new file +54 -0

54 lines not on this page · raw message

xen/drivers/char/Kconfig +1 -1
index 08973cf..703a311 100644
@@ -45,7 +45,7 @@ config HAS_OMAP
 config HAS_SCIF
 	bool
 	default y
-	depends on ARM_32
+	depends on ARM
 	help
 	  This selects the SuperH SCI(F) UART. If you have a SuperH based board,
 	  say Y.
Signature · 7 lines
2.8.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Regards,

[1] https://lists.xenproject.org/archives/html/xen-devel/2016-07/msg00109.html

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#2 lore raw

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Additionally, getting Xen running on this board and describe all this in the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Quoted 2 lines

[1]
https://lists.xenproject.org/archives/html/xen-devel/2016-07/msg00109.html

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 17 lines · Dirk Behme

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

Quoted 7 lines

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Additionally, getting Xen running on this board and describe all this in the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify the firmware? Is it because it does not boot the hypervisor in EL2?

Also, having a page at least mentioning in few bullet points the version of Linux/U-boot used is still useful for potential users of this board.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#4 lore raw
Quoted 24 lines · Julien Grall
Quoted 21 lines · Dirk Behme

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Quoted 6 lines
Quoted 3 lines

Additionally, getting Xen running on this board and describe all this in the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify the firmware? Is it because it does not boot the hypervisor in EL2?

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to EL2 to start Xen.

To give a pointer, I would recommend

https://github.com/ARM-software/tf-issues/issues/353

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

(CC Andre)

Quoted 29 lines · Dirk Behme
Quoted 28 lines · Julien Grall
Quoted 24 lines · Dirk Behme

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Additionally, getting Xen running on this board and describe all this in the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Quoted 7 lines
Quoted 2 lines

Can you details why you think it is not easy? Why do you have to modify the firmware? Is it because it does not boot the hypervisor in EL2?

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to EL2 to start Xen.

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#6 lore raw

Hi,

Quoted 37 lines · Julien Grall

(CC Andre)

Quoted 34 lines · Dirk Behme
Quoted 31 lines · Julien Grall
Quoted 17 lines · Dirk Behme

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

Quoted 8 lines

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 8 lines
Quoted 3 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to EL2 to start Xen.

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I see:

+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+ return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

The fix for the Pine64 was equally simple and works fine since then.

Cheers,
Andre.

[1]
https://github.com/renesas-rcar/meta-renesas/tree/jethro/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 54 lines · Andre Przywara

Hi,

Quoted 37 lines · Julien Grall

(CC Andre)

Quoted 34 lines · Dirk Behme
Quoted 31 lines · Julien Grall
Quoted 17 lines · Dirk Behme

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

Quoted 8 lines

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 8 lines
Quoted 3 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to EL2 to start Xen.

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I see:

(quoted diff) +2 -0
+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+	return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
Quoted 4 lines

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

The fix for the Pine64 was equally simple and works fine since then.

This is an other solution most probably I meant when talking about "modifying the firmware" ;)

I'm somehow unsure about the pros and cons running U-Boot at EL1 versus EL2, though.

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Hi,

Quoted 64 lines · Dirk Behme
Quoted 63 lines · Andre Przywara

Hi,

Quoted 44 lines · Julien Grall

(CC Andre)

Quoted 36 lines · Dirk Behme
Quoted 25 lines · Julien Grall
Quoted 22 lines · Dirk Behme

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Quoted 8 lines
Quoted 4 lines

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify
the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 4 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to
EL2 to start Xen.

Quoted 6 lines

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I see:

(quoted diff) +2 -0
+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+    return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,

DISABLE_ALL_EXCEPTIONS);

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

Quoted 8 lines
Quoted 1 line

The fix for the Pine64 was equally simple and works fine since then.

This is an other solution most probably I meant when talking about "modifying the firmware" ;)

I'm somehow unsure about the pros and cons running U-Boot at EL1 versus EL2, though.

It shouldn't matter, really. U-Boot on AArch64 (called armv8 here) is able to run in any exception level (in contrast to ARMv7). Actually running in EL2 is the architecturally recommended way, even with ATF (by default it drops into EL2 when returning to non-secure world). On Juno (and the Pine64) is works fine this way.

As U-Boot only uses an identity mapping, many differences between EL2 and EL1 don't matter.

Cheers,
Andre.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#9 lore raw

Hi Andre,

Quoted 73 lines · Andre Przywara

Hi,

Quoted 70 lines · Dirk Behme
Quoted 60 lines · Andre Przywara

Hi,

Quoted 44 lines · Julien Grall

(CC Andre)

Quoted 36 lines · Dirk Behme
Quoted 25 lines · Julien Grall
Quoted 22 lines · Dirk Behme

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Quoted 8 lines
Quoted 4 lines

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify
the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 4 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to
EL2 to start Xen.

Quoted 6 lines

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I see:

(quoted diff) +2 -0
+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+    return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,

DISABLE_ALL_EXCEPTIONS);

Quoted 4 lines

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

The fix for the Pine64 was equally simple and works fine since then.

This is an other solution most probably I meant when talking about "modifying the firmware" ;)

Quoted 8 lines
Quoted 2 lines

I'm somehow unsure about the pros and cons running U-Boot at EL1 versus EL2, though.

It shouldn't matter, really. U-Boot on AArch64 (called armv8 here) is able to run in any exception level (in contrast to ARMv7). Actually running in EL2 is the architecturally recommended way, even with ATF (by default it drops into EL2 when returning to non-secure world). On Juno (and the Pine64) is works fine this way.

Could you share the U-Boot commands how you load and esp. start Xen? For loading you use TFTP? How do you start Xen with U-Boot, then? I think we have to pass the device tree address in x0 and the Linux kernel image address in x2. How do you do this with an U-Boot command?

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw

Hi Dirk,

Quoted 4 lines · Dirk Behme

Could you share the U-Boot commands how you load and esp. start Xen? For loading you use TFTP? How do you start Xen with U-Boot, then? I think we have to pass the device tree address in x0 and the Linux kernel image address in x2. How do you do this with an U-Boot command?

U-boot can load Xen from TFTP or from the SD-card. This is the same as booting a baremetal kernel with U-boot.

There is a section on the wiki page to explain how to create the device-tree node for the boot modules [1] and the allwinner page [2] gives a full example how to boot Xen with U-boot via tftp (Note that it could easily be adapted to load from the SD-Card).

Regards,

[1] http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#Boot_Modules
[2] http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Allwinner#Boot_script

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#11 lore raw
Quoted 16 lines · Julien Grall

Hi Dirk,

Quoted 4 lines · Dirk Behme

Could you share the U-Boot commands how you load and esp. start Xen? For loading you use TFTP? How do you start Xen with U-Boot, then? I think we have to pass the device tree address in x0 and the Linux kernel image address in x2. How do you do this with an U-Boot command?

U-boot can load Xen from TFTP or from the SD-card. This is the same as booting a baremetal kernel with U-boot.

There is a section on the wiki page to explain how to create the device-tree node for the boot modules [1] and the allwinner page [2] gives a full example how to boot Xen with U-boot via tftp (Note that it could easily be adapted to load from the SD-Card).

Quoted 7 lines

Regards,

[1]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#Boot_Modules

[2]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Allwinner#Boot_script

Hmm, sorry, I still seem to miss anything :(

I've loaded xen/xen with U-Boot to 0x4A000000 and then try to start it as described in [2] above:

=> bootz 0x4A000000 - 0x48000000
Bad Linux ARM zImage magic!

I'm not sure why xen/xen is assumed to be a zImage?

To verify that the address is correct, I can use U-Boot's go command (which then will fail, later, as I can't pass the device tree address):

=> go 0x4A000000
## Starting application at 0x4A000000 ...
- UART enabled -
- CPU 00000000 booting -
- Current EL 00000008 -
- Xen starting at EL2 -
- Zero BSS -
- Setting up control registers -
- Turning on paging -
- Ready -
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) No valid device tree
(XEN)
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw
Quoted 30 lines · Dirk Behme
Quoted 16 lines · Julien Grall

Hi Dirk,

Quoted 4 lines · Dirk Behme

Could you share the U-Boot commands how you load and esp. start Xen? For loading you use TFTP? How do you start Xen with U-Boot, then? I think we have to pass the device tree address in x0 and the Linux kernel image address in x2. How do you do this with an U-Boot command?

U-boot can load Xen from TFTP or from the SD-card. This is the same as booting a baremetal kernel with U-boot.

There is a section on the wiki page to explain how to create the device-tree node for the boot modules [1] and the allwinner page [2] gives a full example how to boot Xen with U-boot via tftp (Note that it could easily be adapted to load from the SD-Card).

Quoted 9 lines

Regards,

[1]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#Boot_Modules

[2]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Allwinner#Boot_script

Hmm, sorry, I still seem to miss anything :(

Quoted 7 lines

I've loaded xen/xen with U-Boot to 0x4A000000 and then try to start it as described in [2] above:

=> bootz 0x4A000000 - 0x48000000
Bad Linux ARM zImage magic!

I'm not sure why xen/xen is assumed to be a zImage?

Oh, sorry I meant to say that bootz should be replaced by booti but forgot to write it down.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#13 lore raw

Hi Julien,

Quoted 40 lines · Julien Grall
Quoted 37 lines · Dirk Behme
Quoted 20 lines · Julien Grall

Hi Dirk,

Quoted 6 lines · Dirk Behme

Could you share the U-Boot commands how you load and esp. start Xen? For
loading you use TFTP? How do you start Xen with U-Boot, then? I think we
have to pass the device tree address in x0 and the Linux kernel image address in x2. How do you do this with an U-Boot command?

U-boot can load Xen from TFTP or from the SD-card. This is the same as booting a baremetal kernel with U-boot.

There is a section on the wiki page to explain how to create the device-tree node for the boot modules [1] and the allwinner page [2] gives a full example how to boot Xen with U-boot via tftp (Note that it could easily be adapted to load from the SD-Card).

Regards,

Quoted 9 lines

[1]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#Boot_Modules

[2]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Allwinner#Boot_script

Hmm, sorry, I still seem to miss anything :(

I've loaded xen/xen with U-Boot to 0x4A000000 and then try to start it as described in [2] above:

Quoted 7 lines
Quoted 4 lines

=> bootz 0x4A000000 - 0x48000000
Bad Linux ARM zImage magic!

I'm not sure why xen/xen is assumed to be a zImage?

Oh, sorry I meant to say that bootz should be replaced by booti but forgot to write it down.

Ok, thanks, booti does work [1].

Most probably just cosmetics, but again our friend image_size:

Image lacks image_size field, assuming 16MiB

Is there any special reason why we don't write the image size to the xen header?

Or should we try to fix it? E.g. like the Linux kernel is doing it?

Best regards

Dirk

[1]

=> booti 0x48000000 - 0x4A000000
Image lacks image_size field, assuming 16MiB
## Flattened Device Tree blob at 4a000000
Booting using the fdt blob at 0x4a000000
Using Device Tree in place at 000000004a000000, end 000000004a00c767

Starting kernel ...

- UART enabled -
- CPU 00000000 booting -
- Current EL 00000008 -
- Xen starting at EL2 -
- Zero BSS -
- Setting up control registers -
- Turning on paging -
- Ready -
(XEN) Checking for initrd in /chosen
....

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw

Hi Dirk,

Quoted 44 lines · Dirk Behme
Quoted 43 lines · Julien Grall
Quoted 42 lines · Dirk Behme
Quoted 20 lines · Julien Grall

Hi Dirk,

Quoted 6 lines · Dirk Behme

Could you share the U-Boot commands how you load and esp. start Xen? For
loading you use TFTP? How do you start Xen with U-Boot, then? I think we
have to pass the device tree address in x0 and the Linux kernel image address in x2. How do you do this with an U-Boot command?

U-boot can load Xen from TFTP or from the SD-card. This is the same as booting a baremetal kernel with U-boot.

There is a section on the wiki page to explain how to create the device-tree node for the boot modules [1] and the allwinner page [2] gives a full example how to boot Xen with U-boot via tftp (Note that it could easily be adapted to load from the SD-Card).

Regards,

Quoted 11 lines

[1]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#Boot_Modules

[2]
http://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Allwinner#Boot_script

Hmm, sorry, I still seem to miss anything :(

I've loaded xen/xen with U-Boot to 0x4A000000 and then try to start it as described in [2] above:

=> bootz 0x4A000000 - 0x48000000
Bad Linux ARM zImage magic!

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'm not sure why xen/xen is assumed to be a zImage?

Oh, sorry I meant to say that bootz should be replaced by booti but forgot to write it down.

Ok, thanks, booti does work [1].

Good to know!

Quoted 8 lines

Most probably just cosmetics, but again our friend image_size:

Image lacks image_size field, assuming 16MiB

Is there any special reason why we don't write the image size to the xen header?

Or should we try to fix it? E.g. like the Linux kernel is doing it?

The support of Xen ARM64 was added before the size was extended with the size. We did not update the header since then.

I had the same warning a couple of weeks ago and have a patch in my xen tree at home. I will try to send it tonight.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#15 lore raw
In reply to Andre Przywara

Hi Andre,

Quoted 76 lines · Andre Przywara

Hi,

Quoted 64 lines · Dirk Behme
Quoted 63 lines · Andre Przywara

Hi,

Quoted 44 lines · Julien Grall

(CC Andre)

Quoted 36 lines · Dirk Behme
Quoted 25 lines · Julien Grall
Quoted 22 lines · Dirk Behme

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Quoted 8 lines
Quoted 4 lines

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify
the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 4 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to
EL2 to start Xen.

Quoted 6 lines

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I see:

(quoted diff) +2 -0
+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+    return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,

DISABLE_ALL_EXCEPTIONS);

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

Quoted 8 lines
Quoted 1 line

The fix for the Pine64 was equally simple and works fine since then.

This is an other solution most probably I meant when talking about "modifying the firmware" ;)

I'm somehow unsure about the pros and cons running U-Boot at EL1 versus EL2, though.

Quoted 8 lines

It shouldn't matter, really. U-Boot on AArch64 (called armv8 here) is able to run in any exception level (in contrast to ARMv7). Actually running in EL2 is the architecturally recommended way, even with ATF (by default it drops into EL2 when returning to non-secure world). On Juno (and the Pine64) is works fine this way.

As U-Boot only uses an identity mapping, many differences between EL2 and EL1 don't matter.

An understanding question regarding this: We found that running U-Boot at EL2 works fine and starting Xen works fine, then, too. So many thanks for that hint!

But we found that the Linux native boot case (without Xen) does fail, then. I.e. running U-Boot in EL1 starts the native Linux kernel successfully. While running U-Boot in EL2 starting the native Linux kernel fails, then.

Any idea regarding this?

Who is responsible to switch to EL1 for the native Linux boot case if U-Boot runs at EL2?

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw

Hi Dirk,

Quoted 91 lines · Dirk Behme

Hi Andre,

Quoted 79 lines · Andre Przywara

Hi,

Quoted 67 lines · Dirk Behme
Quoted 66 lines · Andre Przywara

Hi,

Quoted 46 lines · Julien Grall

(CC Andre)

Quoted 37 lines · Dirk Behme
Quoted 26 lines · Julien Grall
Quoted 23 lines · Dirk Behme

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment.
With this it's publically available and we can see how's the public interest for this board.

Quoted 8 lines
Quoted 4 lines

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify
the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 5 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to
find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to
EL2 to start Xen.

Quoted 6 lines

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I
see:

(quoted diff) +2 -0
+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+    return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,

DISABLE_ALL_EXCEPTIONS);

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

Quoted 8 lines
Quoted 1 line

The fix for the Pine64 was equally simple and works fine since then.

This is an other solution most probably I meant when talking about "modifying the firmware" ;)

I'm somehow unsure about the pros and cons running U-Boot at EL1 versus EL2, though.

Quoted 8 lines

It shouldn't matter, really. U-Boot on AArch64 (called armv8 here) is able to run in any exception level (in contrast to ARMv7). Actually running in EL2 is the architecturally recommended way, even with ATF (by default it drops into EL2 when returning to non-secure world). On Juno (and the Pine64) is works fine this way.

As U-Boot only uses an identity mapping, many differences between EL2 and EL1 don't matter.

Quoted 8 lines

An understanding question regarding this: We found that running U-Boot at EL2 works fine and starting Xen works fine, then, too. So many thanks for that hint!

But we found that the Linux native boot case (without Xen) does fail, then. I.e. running U-Boot in EL1 starts the native Linux kernel successfully. While running U-Boot in EL2 starting the native Linux kernel fails, then.

That's rather odd, can you provide some debug information?

Quoted 4 lines

Any idea regarding this?

Who is responsible to switch to EL1 for the native Linux boot case if U-Boot runs at EL2?

That's well supported kernel code in arch/arm64/kernel/head.S. If it sees the kernel to be entered in EL2 (which is highly recommended, btw), it installs the KVM HYP stub and drops into EL1 (after some register setup). You might want to check the code in there to see if something springs to mind or use some debug UART output to see where it gets stuck (if it gets stuck). I usually do something like "mov x1, #UART_TR; mov w0, #'1'; str w0, [x1]" to get an idea where low level code hangs.

Cheers,
Andre.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#17 lore raw

Hi,

Quoted 110 lines · Andre Przywara

Hi Dirk,

Quoted 91 lines · Dirk Behme

Hi Andre,

Quoted 79 lines · Andre Przywara

Hi,

Quoted 67 lines · Dirk Behme
Quoted 66 lines · Andre Przywara

Hi,

Quoted 46 lines · Julien Grall

(CC Andre)

Quoted 37 lines · Dirk Behme
Quoted 26 lines · Julien Grall
Quoted 23 lines · Dirk Behme

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

I just wonder if we keep the patch on the mailing list for a moment.
With this it's publically available and we can see how's the public interest for this board.

Quoted 8 lines
Quoted 4 lines

Additionally, getting Xen running on this board and describe all this in
the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

Can you details why you think it is not easy? Why do you have to modify
the firmware? Is it because it does not boot the hypervisor in EL2?

Quoted 5 lines

The board boots via ATF, which starts U-Boot in EL1, then. You have to
find a way to load Xen into memory (e.g. U-Boot TFTP) and then switch to
EL2 to start Xen.

Quoted 6 lines

But ATF is running in EL3, right? If so, can ATF just starts U-boot in EL2?

I have a board at home (pine64) which also uses ATF and U-Boot and is able to boot Xen without any SMC call because the U-Boot is entered in EL2.

From having a very quick look into the rcar ATF port on github[1] I
see:

(quoted diff) +2 -0
+#elif (RCAR_BL33_EXECUTION_EL == BL33_EL2)
+    return (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,

DISABLE_ALL_EXCEPTIONS);

So if you rebuild ATF with RCAR_BL33_EXECUTION_EL set to BL33_EL2 that should enter U-Boot in EL2.

Quoted 8 lines
Quoted 1 line

The fix for the Pine64 was equally simple and works fine since then.

This is an other solution most probably I meant when talking about "modifying the firmware" ;)

I'm somehow unsure about the pros and cons running U-Boot at EL1 versus EL2, though.

Quoted 8 lines

It shouldn't matter, really. U-Boot on AArch64 (called armv8 here) is able to run in any exception level (in contrast to ARMv7). Actually running in EL2 is the architecturally recommended way, even with ATF (by default it drops into EL2 when returning to non-secure world). On Juno (and the Pine64) is works fine this way.

As U-Boot only uses an identity mapping, many differences between EL2 and EL1 don't matter.

Quoted 8 lines

An understanding question regarding this: We found that running U-Boot at EL2 works fine and starting Xen works fine, then, too. So many thanks for that hint!

But we found that the Linux native boot case (without Xen) does fail, then. I.e. running U-Boot in EL1 starts the native Linux kernel successfully. While running U-Boot in EL2 starting the native Linux kernel fails, then.

That's rather odd, can you provide some debug information?

Quoted 4 lines

Any idea regarding this?

Who is responsible to switch to EL1 for the native Linux boot case if U-Boot runs at EL2?

Quoted 7 lines

That's well supported kernel code in arch/arm64/kernel/head.S. If it sees the kernel to be entered in EL2 (which is highly recommended, btw), it installs the KVM HYP stub and drops into EL1 (after some register setup). You might want to check the code in there to see if something springs to mind or use some debug UART output to see where it gets stuck (if it gets stuck). I usually do something like "mov x1, #UART_TR; mov w0, #'1'; str w0, [x1]" to get an idea where low level code hangs.

Just for the logs, it seems that the kernel I was using missed

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/arm64/boot/dts/renesas?id=4c811edf65e809e6ac6ec35f4818efba2b1c6163

resulting in EL2 interrupt misbehavior.

Thanks!

Best regards

Dirk

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#18 lore raw
In reply to Dirk Behme
Quoted 17 lines · Dirk Behme

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Dirk,

Quoted 1 line · Dirk Behme

This patch looks good to me, however I would like to see the documentation on the wiki page (see [1]) before giving any formal ack.

Ok, many thanks for your review!

Yes, I understood that something more is needed.

Quoted 7 lines

I just wonder if we keep the patch on the mailing list for a moment. With this it's publically available and we can see how's the public interest for this board.

Additionally, getting Xen running on this board and describe all this in the wiki isn't that easy. You either need to modify the flashed firmware. Or, like me, load everything via a JTAG debugger ...

That's fine. The purpose of writing down the requirements on the wiki is to avoid misleading our users. We don't want them to think that Xen works out of the box on Renesas RCar Gen3 H3 Salvator-X, when some specific extra steps might be required. Even something as cumbersome as using JTAG to load the firmware is fine, as long as it is documented. With that in place, both Julien and I would be happy to have this patch in the tree.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel