Skip to contentSkip to conversation

Starting to port xen on beagleboard-x15 (GSoC 2019 project)

Xen-devel Andrii Anisov 5 participants 17 messages Jun 18, 2019 – Jun 19, 2019 12 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CALC81-vaVKgZoi27MauGTxjda8mchy5GRLipu5z=v1vh9fyvAg@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CALC81-tewzAtaaH94U1nVc-UiacR_YvqhaYcPXtXcviTFHAG8A@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): AM6PR0302MB32215CD7FAED139C682D92A386EA0@AM6PR0302MB3221.eurprd03.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): AM6PR0302MB3221D649900B54C2FFA7003A86EA0@AM6PR0302MB3221.eurprd03.prod.outlook.com

#12 lore raw

+xen-devel

Hello Julien,

Quoted 2 lines

I am a bit confused. Linux is able to bring-up CPU in hyp mode with the current U-boot. Why would we need more changes for Xen?

TI's ROM code starts all CPUs in NS PL1, doesn't matter if it is boot or secondary core.
If you look at Linux code [1], you'll see, that after the secondary core bringup Linux does switch that core from NS PL1 to PL2 (hyp mode) using ROM code interface (smc 0).
At some moment XEN dropped all to-hyp-mode switching code. So I did switch secondaries to hyp mode in u-boot with the loop which replicates the ROM Code logic in terms of waiting for an event and checking aux registers.

[1] https://elixir.bootlin.com/linux/v5.1/source/arch/arm/mach-omap2/omap-headsmp.S#L62

ANDRII ANISOV

Lead Systems Engineer

Office: +380 44 390 5457 x 66766   Cell: +380 50 573 8852   Email: [email protected]

Kyiv, Ukraine (GMT+3)   epam.com

CONFIDENTIALITY CAUTION AND DISCLAIMER
This message is intended only for the use of the individual(s) or entity(ies) to which it is addressed and contains information that is legally privileged and confidential. If you are not the intended recipient, or the person responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. All unintended recipients are obliged to delete this message and destroy any printed copies.

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

#13 lore raw
Quoted 1 line · Andrii Anisov

+xen-devel

Please don't cross-post e-mail. If you move the thread to xen-devel, then xen-users should be droppped.

Quoted 9 lines

Hello Julien,

Quoted 2 lines

I am a bit confused. Linux is able to bring-up CPU in hyp mode with the current U-boot. Why would we need more changes for Xen?

TI's ROM code starts all CPUs in NS PL1, doesn't matter if it is boot or secondary core.
If you look at Linux code [1], you'll see, that after the secondary core bringup Linux does switch that core from NS PL1 to PL2 (hyp mode) using ROM code interface (smc 0).
At some moment XEN dropped all to-hyp-mode switching code. So I did switch secondaries to hyp mode in u-boot with the loop which replicates the ROM Code logic in terms of waiting for an event and checking aux registers.

Switch to hyp-mode is fairly complex and depends on your processor. Hence why it was dropped in both Linux and Xen.

However, calling an SMC would be acceptable to me. Stefano, any opinion?

Quoted 2 lines

[1] https://elixir.bootlin.com/linux/v5.1/source/arch/arm/mach-omap2/omap-headsmp.S#L62

[...]

Quoted 3 lines

CONFIDENTIALITY CAUTION AND DISCLAIMER
This message is intended only for the use of the individual(s) or entity(ies) to which it is addressed and contains information that is legally privileged and confidential. If you are not the intended recipient, or the person responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. All unintended recipients are obliged to delete this message and destroy any printed copies.

Please configure your e-mail client to drop the footer.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#14 lore raw
Quoted 1 line · Julien Grall

Switch to hyp-mode is fairly complex and depends on your processor. Hence why it was dropped in both Linux and Xen.

Julien, I know it. We already discussed that few years ago.

Quoted 1 line

However, calling an SMC would be acceptable to me. Stefano, any opinion?

That patch (for u-boot) is 5+ years old. I do not work with TI's stuff for almost 3 years. So I'd not bother myself to play with the stuff again. If the topic author(s) have enough time and inspiration, they are welcome to improve OMAP5-like SoCs support.

Quoted 1 line

Please configure your e-mail client to drop the footer.

I think it is impossible, it is a corporate piece of ...email.
I've missed manual removal of the footer, yet I do not use that email for discussions normally.

Signature · 7 lines
Sincerely,
Andrii Anisov.

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

Sorry I've re-read your statement, and got another idea.

Quoted 2 lines · Andrii Anisov
Quoted 1 line · Julien Grall

Switch to hyp-mode is fairly complex and depends on your processor.

Switch to hyp-mode depends on the processor. So it may be complex. Or not.

Quoted 1 line
Quoted 1 line

Hence why it was dropped in both Linux and Xen.

As you can see, for OMAP5 Linux kernel did leave the switch to hyp mode. I guess the reasoning behind that also assumes a complexity of changes to a bootloader, like in the patch you noticed.

Signature · 7 lines
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#16 lore raw
In reply to Andrii Anisov
Quoted 11 lines · Andrii Anisov
Quoted 1 line · Julien Grall

Switch to hyp-mode is fairly complex and depends on your processor. Hence why it was dropped in both Linux and Xen.

Julien, I know it. We already discussed that few years ago.

Quoted 1 line

However, calling an SMC would be acceptable to me. Stefano, any opinion?

That patch (for u-boot) is 5+ years old. I do not work with TI's stuff for almost 3 years. So I'd not bother myself to play with the stuff again. If the topic author(s) have enough time and inspiration, they are welcome to improve OMAP5-like SoCs support.

Denis (the author of the thread) is doing a GSOC to port Xen on the BeagleBoard X15. You ended up CCed because you can provide feedback how to proceed. Not because we wanted you to implement it...

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#17 lore raw
Quoted 1 line · Julien Grall

Denis (the author of the thread) is doing a GSOC to port Xen on the BeagleBoard X15. You ended up CCed because you can provide feedback how to proceed. Not because we wanted you to implement it...

OK then.

Denis,

Feel free to contact me in case you need clarifications about the stuff.

Signature · 7 lines
Sincerely,
Andrii Anisov.

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

Hi,
ср, 19 июн. 2019 г. в 14:01, Andrii Anisov <[email protected]>:

Quoted 11 lines · Julien Grall
Quoted 1 line

Denis (the author of the thread) is doing a GSOC to port Xen on the BeagleBoard X15. You ended up CCed because you can provide feedback how to proceed. Not because we wanted you to implement it...

OK then.

Denis,

Feel free to contact me in case you need clarifications about the stuff.

thank you

Quoted 4 lines

--
Sincerely,
Andrii Anisov.

So, right now I get a bit further and it seems that CPU1 was switched to hyp mode:
https://github.com/embeddedden/xen/commit/2d76ae7aacb7c0ea7312eaddb91c3eb1e1963cc9

and the output:
https://pastebin.com/3JBw6S4K

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

#19 lore raw
Quoted 1 line · Denis Obrezkov

Hi,

Hi Denis,

Quoted 5 lines

ср, 19 июн. 2019 г. в 14:01, Andrii Anisov <[email protected]>:

Quoted 4 lines · Julien Grall
Quoted 12 lines
Quoted 7 lines
Quoted 1 line

Denis (the author of the thread) is doing a GSOC to port Xen on the BeagleBoard X15. You ended up CCed because you can provide feedback how to proceed. Not because we wanted you to implement it...

OK then.

Denis,

Feel free to contact me in case you need clarifications about the stuff.

thank you

Quoted 4 lines

--
Sincerely,
Andrii Anisov.

Don't forget to strip unnecessary bits of the e-mail you quote :).

Quoted 4 lines

So, right now I get a bit further and it seems that CPU1 was switched to hyp mode:
https://github.com/embeddedden/xen/commit/2d76ae7aacb7c0ea7312eaddb91c3eb1e1963cc9

Nice to see some progress here! :)

Just to keep record of the discussion on IRC:

- omap5_init_secondary is the entry point to Xen and SMC #0 is called right
after. There are nothing in r2-r12 that we care about, so there are no need to save/restore them. On a side note, you could not use sp because we don't know the value stored in it. So you may rewrite Xen (or any other modules).

- From the pastebin "(XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27 Freq: 0
KHz". It looks like the register CNTFREQ is not configured correctly on the CPU. Looking at Linux, they have code to setup CNTFRQ (set_cntfrq) for all the CPUs (see realtime_counter_init in arch/arm/mach-omap2/timer.c and omap4_secondary_init in arch/arm/mach-omap2/omap-smp.c).
In the case of Xen, I think we want to call set_cntfreq in omap5_init_time()
for the boot CPU. For the secondary CPUs, we may need to introduce a callback in struct platform_desc to be called during secondary startup.

Lastly, please clean-up the code and send the patch on xen-devel. I will have a closer look at that time. Feel free to ping me on IRC if you have any doubt how to proceed.

Quoted 2 lines

and the output:
https://pastebin.com/3JBw6S4K

(XEN) *** LOADING DOMAIN 0 ***
(XEN) Missing kernel boot module?
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************

You probably haven't set up the Dom0 kernel here. Check you u-boot runes for this.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#20 lore raw
Quoted 1 line · Julien Grall

Lastly, please clean-up the code and send the patch on xen-devel. I will have a closer look at that time. Feel free to ping me on IRC if you have any doubt how to proceed.

About the code: I think omap5_init_secondary() must be moved to the platform code (omap5.c).

I've nothing to add about the log. Pastebin is banned in our network.

Signature · 7 lines
Sincerely,
Andrii Anisov.

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

Hi,

Quoted 6 lines · Andrii Anisov
Quoted 1 line · Julien Grall

Lastly, please clean-up the code and send the patch on xen-devel. I will have a closer look at that time. Feel free to ping me on IRC if you have any doubt how to proceed.

About the code: I think omap5_init_secondary() must be moved to the platform code (omap5.c).

Well omap5.c is C code... You can't call C in the boot process at least until the MMU is on and we fully setup the processor.

Regarding the placement of the code, I am still split between two minds (either head.S or a new specific .S for omap). However, this could be discussed once the patch is submitted.

(Bear in mind this is likely the first time Denis works with the Xen community).

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#22 lore raw
Quoted 1 line · Julien Grall

Regarding the placement of the code, I am still split between two minds (either head.S or a new specific .S for omap). However, this could be discussed once the patch is submitted.

IMHO, that is a pure platform specific code. FMPOV it should be an inline assembly in omap5.c, or omap5.S under platform.

Quoted 1 line

(Bear in mind this is likely the first time Denis works with the Xen community).

Yep:)

Signature · 7 lines
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#23 lore raw
Quoted 6 lines · Andrii Anisov
Quoted 1 line · Julien Grall

Regarding the placement of the code, I am still split between two minds (either head.S or a new specific .S for omap). However, this could be discussed once the patch is submitted.

IMHO, that is a pure platform specific code. FMPOV it should be an inline assembly in omap5.c, or omap5.S under platform.

I would be happy to consider omap5.c if there are a nice way to do it. I can't find one so far. Please suggest...

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#24 lore raw
In reply to Julien Grall

Hi,

Quoted 10 lines · Julien Grall

Hi,

Quoted 7 lines · Andrii Anisov
Quoted 3 lines · Julien Grall

Lastly, please clean-up the code and send the patch on xen-devel. I will have a closer look at that time. Feel free to ping me on IRC if you have any doubt how to proceed.

Quoted 5 lines
Quoted 2 lines

About the code: I think omap5_init_secondary() must be moved to the platform code (omap5.c).

Well omap5.c is C code... You can't call C in the boot process at least until the MMU is on and we fully setup the processor.

I don't understand this since init_secondary is installed in C code, isn't it? (in omap5.c:omap5_smp_init())

Signature · 1 line
Regards, Denis Obrezkov

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

#25 lore raw

Hi,

Quoted 13 lines · Denis Obrezkov

Hi,

Quoted 10 lines · Julien Grall

Hi,

Quoted 7 lines · Andrii Anisov
Quoted 3 lines · Julien Grall

Lastly, please clean-up the code and send the patch on xen-devel. I will have a closer look at that time. Feel free to ping me on IRC if you have any doubt how to proceed.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

About the code: I think omap5_init_secondary() must be moved to the platform code (omap5.c).

Well omap5.c is C code... You can't call C in the boot process at least until the MMU is on and we fully setup the processor.

I don't understand this since init_secondary is installed in C code, isn't it? (in omap5.c:omap5_smp_init())

init_secondary is installed by the boot CPU. But init_secondary is executed on the secondary CPU.

You can't execute C code that early for a few reasons:
1) You don't know the state of the registers. So you need to set
them up in a sane state.
2) Xen is compiled position depend so far. This means some of the C
code use hardcoded address to access data or jump to other function. The hardcoded address are virtual. In most of the cases, Xen will not be loaded at at virtual address == physical address. So you need to setup the MMU first.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#26 lore raw
In reply to Julien Grall

Hi,

Quoted 56 lines · Julien Grall
Quoted 1 line · Denis Obrezkov

Hi,

Hi Denis,

Quoted 9 lines

ср, 19 июн. 2019 г. в 14:01, Andrii Anisov <[email protected]>:

Quoted 8 lines · Julien Grall
Quoted 3 lines

Denis (the author of the thread) is doing a GSOC to port Xen on the BeagleBoard X15. You ended up CCed because you can provide feedback how to proceed. Not because we wanted you to implement it...

Quoted 10 lines
Quoted 5 lines

OK then.

Denis,

Feel free to contact me in case you need clarifications about the stuff.

thank you

Quoted 4 lines
Signature · 3 lines
-- 
Sincerely,
Andrii Anisov.

Don't forget to strip unnecessary bits of the e-mail you quote :).

Quoted 5 lines

So, right now I get a bit further and it seems that CPU1 was switched to hyp mode:
https://github.com/embeddedden/xen/commit/2d76ae7aacb7c0ea7312eaddb91c3eb1e1963cc9

Nice to see some progress here! :)

Just to keep record of the discussion on IRC:

    - omap5_init_secondary is the entry point to Xen and SMC #0 is called right after. There are nothing in r2-r12 that we care about, so there are no need to save/restore them. On a side note, you could not use sp because we don't know the value stored in it. So you may rewrite Xen (or any other modules).

    - From the pastebin "(XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27
Freq: 0 KHz". It looks like the register CNTFREQ is not configured correctly on the CPU. Looking at Linux, they have code to setup CNTFRQ (set_cntfrq) for all the CPUs (see realtime_counter_init in arch/arm/mach-omap2/timer.c and omap4_secondary_init in arch/arm/mach-omap2/omap-smp.c).
      In the case of Xen, I think we want to call set_cntfreq in omap5_init_time() for the boot CPU. For the secondary CPUs, we may need to introduce a callback in struct platform_desc to be called during secondary startup.

Quoted 3 lines

Lastly, please clean-up the code and send the patch on xen-devel. I will have a closer look at that time. Feel free to ping me on IRC if you have any doubt how to proceed.

Ok, I will read xen code guideline and send the patch.

Quoted 12 lines
Quoted 3 lines

and the output:
https://pastebin.com/3JBw6S4K

(XEN) *** LOADING DOMAIN 0 ***
(XEN) Missing kernel boot module?
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************

Quoted 2 lines

You probably haven't set up the Dom0 kernel here. Check you u-boot runes for this.

So, I configured dtb and got:
https://pastebin.com/uDYiGsHL
So, it seems that timer interrupts don't work for now.

Signature · 1 line
Regards, Denis Obrezkov

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

#27 lore raw

Hi,

Quoted 8 lines · Denis Obrezkov
Quoted 8 lines

(XEN) *** LOADING DOMAIN 0 ***
(XEN) Missing kernel boot module?
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************

Quoted 5 lines
Quoted 2 lines

You probably haven't set up the Dom0 kernel here. Check you u-boot runes for this.

So, I configured dtb and got:
https://pastebin.com/uDYiGsHL
So, it seems that timer interrupts don't work for now.

Most likely this is because the frequency is incorrect. Have a look at set_cntfreq() (see my previous e-mail).

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#28 lore raw
In reply to Julien Grall
Quoted 22 lines · Julien Grall
Quoted 1 line · Andrii Anisov

+xen-devel

Please don't cross-post e-mail. If you move the thread to xen-devel, then xen-users should be droppped.

Quoted 7 lines

Hello Julien,

Quoted 3 lines

I am a bit confused. Linux is able to bring-up CPU in hyp mode with the current
U-boot. Why would we need more changes for Xen?

Quoted 8 lines

TI's ROM code starts all CPUs in NS PL1, doesn't matter if it is boot or secondary core.
If you look at Linux code [1], you'll see, that after the secondary core bringup Linux does switch that core from NS PL1 to PL2 (hyp mode) using ROM code interface (smc 0).
At some moment XEN dropped all to-hyp-mode switching code. So I did switch secondaries to hyp mode in u-boot with the loop which replicates the ROM Code logic in terms of waiting for an event and checking aux registers.

Quoted 4 lines

Switch to hyp-mode is fairly complex and depends on your processor. Hence why it was dropped in both Linux and Xen.

However, calling an SMC would be acceptable to me. Stefano, any opinion?

Yes, it would be trivial to maintain something like that.

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