I’m trying to enable KVM on the board, but it is not possible, because the CPU works in SVC and not in HYP mode.
I tried to play around with the U-boot code, and defined CONFIG_ARMV7_VIRT and CONFIG_ARMV7_NONSEC, which are needed for the HYP mode.
All would go well, but CONFIG_ARMV7_NONSEC requires the functions “smp_set_core_boot_addr” and “smp_waitloop”, which are not defined for the BBX15. I have looked at the implementations for other boards, but they all are different. Tried to define them as empty functions (as in the Broadcom “bcm_ep” case) but that did not work - the board didn’t even start booting.
Does anyone have any idea or a hint as for how I should define these functions for the BBX15?
Sorry for the very late reply - I was away from the board for over a week.
This patch doesn’t seem to work: after turning the board on, it just turns itself off after a few seconds. Thanks for the lead though! Trying different ideas now. If anyone has a suggestion, I’d love to hear!
By the way, why is the HYP mode not enabled by default? If the CPU supports virtualization…
That patch looks okay to me, but a critical difference seems to be that
there the alternative to the smc is "bx lr", which is good since the
smc[r12=0x102] behaves like "bx r0 in hyp mode". If you want to go
somewhere else you'll need to load that destination in r0. Since you have
live registers (at least lr) you'll want to stash those somewhere first,
and make r0 point to a trampoline which restores it before branching to
your intended destination.
The "this is a great place" comment in the patch you linked to is worth
reflecting on: you want to do this call in some place where preferably
there are no live registers at all.
Thanks for the explanation, but it is still a bit unclear to me (first time touching any bootloader code). I know that the solution is very simple here, but I can’t get it yet…
I can not apply that patch as-is, because meanwhile that file have changed. Could you please explain how should I go about it?
I just inspected the code: it turns out this function is the very very
first thing called by SPL and its purpose it to ensure no register is
live at the end of it, by saving any relevant info the ROM bootloader
may have passed in registers.
I get the impression my post got corrupted or something… in my gmail I see part of an old draft appended while on google groups I only see the old draft…
I was supposed to say:
To add to that, there might be a very remote that save_boot_params_ret is beyond the range of adr. The safe alternative would be:
Thanks again for your help. I have made the changes that you can see below, but it still does not work. I assumed that you missed the “ldr r12, =0x102” line, since obviously that value should be loaded there somehow. The result: the board shuts down right after powering on.
I will try and give it a shot later this week or next, but I think a
bunch of registers get clobbered by ROM code and left to us in
non-secure world to protect.
Thanks again for your help. I have made the changes that you can see
below, but it still does not work. I assumed that you missed the "ldr
r12, =0x102" line, since obviously that value should be loaded there
somehow.
Yeah sorry
The result: the board shuts down right after powering on.
You could also try the original patch against the version of u-boot it was
based off. Assuming he posted a patch that worked, you can then rebase all
changes to u-boot since then on top of that (fixing the conflict around
commit e11c6c2 by changing the call to what you have now) and use git
bisect to figure out what broke it.