Closed gjinhui closed 1 year ago
Which "kenrel".img are you using? There is normally an id check for processor 1 in mpidr_el1
at a very early assembly stage.
If it is processor 1 it will continue to boot to linux. If it is false then the other processors are sent to a wait for event wfe
loop.
If the check fails and the co-processor is not working then all processors will either try to boot linux or all will be sent to loop.
Either way, in the 3rd case the user would experience degraded multi-threaded performance. Maybe try a different board?
我已收到您的邮件,稍后我会仔细阅读。
Which "kenrel".img are you using?
Linux kernel 5.15 ubuntu 22.04.1 server
Maybe try a different board?
If i don't boot with EFI and grub2, it call run well.
There is normally an id check for processor 1 in mpidr_el1 at a very early assembly stage.
Do you mean the check is done in the linux kernel?
If it is processor 1 it will continue to boot to linux. If it is false then the other processors are sent to a wait for event wfe loop. If the check fails and the co-processor is not working then all processors will either try to boot linux or all will be sent to loop. Either way, in the 3rd case the user would experience degraded multi-threaded performance.
I wonder if RPI_EFI.fd
will run on all the CPUs?
Will the other processors sent to a wait for event wfe loop by RPI_EFI.fd
except for the boot one?
https://github.com/TheMindVirus/PiX-iES/tree/pi4-smp-wfe-sev
I've just tested it; the cores are definitely there. Either Linux or Pi4 UEFI is missing a sev
instruction somewhere along the line.
Each one can also be made to run their own thing entirely but with incoherent registers and exclusively shared peripherals.
Not quite sure how I did that in one night but there it is...
https://github.com/TheMindVirus/PiX-iES/tree/pi4-smp-wfe-sev I've just tested it; the cores are definitely there. Either Linux or Pi4 UEFI is missing a
sev
instruction somewhere along the line. Each one can also be made to run their own thing entirely but with incoherent registers and exclusively shared peripherals. Not quite sure how I did that in one night but there it is...
Thanks for your hard work.
Either Linux or Pi4 UEFI is missing a sev instruction somewhere along the line.
Linux kernel will call sev
during the startup period. But i am not sure Pi4 UEFI
will do it or not.
(start4.elf -> RPI_EFI.fd -> grubaa64.efi -> linux kernel)
static int smp_spin_table_cpu_prepare(unsigned int cpu)
{
__le64 __iomem *release_addr;
phys_addr_t pa_holding_pen = __pa_symbol(function_nocfi(secondary_holding_pen));
if (!cpu_release_addr[cpu])
return -ENODEV;
/*
* The cpu-release-addr may or may not be inside the linear mapping.
* As ioremap_cache will either give us a new mapping or reuse the
* existing linear mapping, we can use it to cover both cases. In
* either case the memory will be MT_NORMAL.
*/
release_addr = ioremap_cache(cpu_release_addr[cpu],
sizeof(*release_addr));
if (!release_addr)
return -ENOMEM;
/*
* We write the release address as LE regardless of the native
* endianness of the kernel. Therefore, any boot-loaders that
* read this address need to convert this address to the
* boot-loader's endianness before jumping. This is mandated by
* the boot protocol.
*/
writeq_relaxed(pa_holding_pen, release_addr);
dcache_clean_inval_poc((__force unsigned long)release_addr,
(__force unsigned long)release_addr +
sizeof(*release_addr));
/*
* Send an event to wake up the secondary CPU.
*/
sev();
iounmap(release_addr);
return 0;
}
#define sev() asm volatile("sev" : : : "memory")
The problem is solved. RPI_EFI.fd can work well.
(1) It should not use spin-table
to initialize the secondary CPUs. Because RPI_EFI.fd
would run in EL3 and use sev
to wakeup the secondary CPUs.
(2) RPI_EFI.fd
would modify the device tree
to use psci
to boot the linux kernel.
(3) grub2
would load dtb again by using command devicetree
. It would cover the dtb passed by RPI_EFI.fd
.
Thus,grub2
should not load the dtb. Or it can load the dtb which is modifed to use psci
by dtc
.
Ok, sounds like you changed the DT to one that didn't export PSCI and it caused problems.
Closing.
我已收到您的邮件,稍后我会仔细阅读。
I try to boot the linux kenrel by EFI and grub2, but i find that only one cpu is online after linux kernel started. Has anyone had the same problem?
The dmesg is as follow:
The iomem is as follow:
I try to print cpu-release-addr when smp init. The cpu-release-addr is the same as defined in dtb. It seems that the cpu can't get rid of wfe or the cpu not in wfe?