Skip to content

hw/arm/xlnx-versal: fix Versal2 VxWorks CPU boot#45

Merged
ho28 merged 1 commit into
Wind-River:wr-integrationfrom
shivkd:shivkd-versal2-vxworks-cpu-boot
Jun 13, 2026
Merged

hw/arm/xlnx-versal: fix Versal2 VxWorks CPU boot#45
ho28 merged 1 commit into
Wind-River:wr-integrationfrom
shivkd:shivkd-versal2-vxworks-cpu-boot

Conversation

@shivkd

@shivkd shivkd commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

VxWorks requires the QEMU generated Versal2 DTB to expose the expected board compatible string and CPU node number to boot Vxworks and turn on the secondary CPUs. This change adds the amd,versal2 compatible string for amd-versal2-virt and updates CPU DT node generation to use the MPIDR affinity value for the CPU node unit address.
Previously, QEMU generated CPU node names from a linear CPU index while setting reg to the MPIDR affinity value, producing nodes such as cpu@1 with reg = <0x100>. VxWorks looks up secondary CPU nodes using the MPIDR-based CPU ID, for example /cpus/cpu@100. Since cpu@100 did not exist, vxFdtPathOffset() failed and the CPU enable path returned before reaching vxPsciCpuOn() / PSCI CPU_ON. Using the MPIDR affinity value for both the unit address and reg produces nodes such as cpu@100 with reg = <0x100>. With this change, VxWorks discovers the secondary CPU nodes correctly and brings all 8 application CPUs online on amd-versal2-virt. Tested by booting VxWorks 26.03 SMP on amd-versal2-virt and confirming vxCpuEnabledGet() returns 0xff.

@shivkd shivkd force-pushed the shivkd-versal2-vxworks-cpu-boot branch 2 times, most recently from d776856 to 25fd54c Compare June 12, 2026 20:46
@shivkd shivkd requested review from ho28 and kpeng3 June 12, 2026 21:12
@ho28

ho28 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

CPU node number to boot CPU and enable PSCI correctly.

I'm being a bit nitpicky and pedantic here, but vxworks does not enable PSCI - it uses PSCI to enable the secondary cpu cores. PSCI is an interface that is implemented by the ATF. I think it is important to understand the distinction here.

So in actuality, PSCI has nothing to do with this change, except that vxworks bails out of secondary cpu initialization due to a device tree parsing issue before attempting to enable the secondary cpus via PSCI (which is functioning properly without this change)

Besides that the change looks good. Thanks for finding and fixing the issue!

@ho28 ho28 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length on the commit message is long.

But i see you characterized the issue correctly here - with the cpu node @ change, vxworks is able to identify the secondary cpus and successfully attempt to power them on using PSCI CPU_ON command.

I would mention that it is not a requirement to keep the CPU node address value aligned with their reg values, just that this is what vxworks expects. Linux properly parses the mpidr values from reg property even with linear cpu node address values, so this is a vxworks specific fix

@shivkd

shivkd commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

CPU node number to boot CPU and enable PSCI correctly.

I'm being a bit nitpicky and pedantic here, but vxworks does not enable PSCI - it uses PSCI to enable the secondary cpu cores. PSCI is an interface that is implemented by the ATF. I think it is important to understand the distinction here.

So in actuality, PSCI has nothing to do with this change, except that vxworks bails out of secondary cpu initialization due to a device tree parsing issue before attempting to enable the secondary cpus via PSCI (which is functioning properly without this change)

Besides that the change looks good. Thanks for finding and fixing the issue!

Fair enough, youre right it doesnt enable PSCI, made the comment factually correct now.

@shivkd shivkd force-pushed the shivkd-versal2-vxworks-cpu-boot branch 3 times, most recently from a3b09dd to 1ae15f5 Compare June 12, 2026 23:49
Comment thread hw/arm/xlnx-versal.c Outdated
{
ARMCPU *arm_cpu = ARM_CPU(cpu);
size_t idx = cluster_idx * map->num_core + core_idx;
uint32_t affinity = arm_cpu_mp_affinity(arm_cpu) & ARM64_AFFINITY_MASK;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this should actually be uint64_t

VxWorks requires the Versal2 compatible string and looks up secondary
CPU nodes using MPIDR CPU IDs.

Add the amd,versal2 compatible string for the Versal2 machine and
generate CPU node addresses from the MPIDR affinity value instead
of the linear CPU index. This keeps CPU node names aligned with their
reg values, for example cpu@100 with reg = <0x100>.

With this change, VxWorks can match the Versal2 DTB, discover secondary
CPU nodes, reach the PSCI CPU_ON path, and bring all application CPUs
online.

Signed-off-by: shivkd <shiveshkd@gmail.com>
@shivkd shivkd force-pushed the shivkd-versal2-vxworks-cpu-boot branch from 1ae15f5 to 700514e Compare June 13, 2026 00:23
@ho28 ho28 merged commit 82aadca into Wind-River:wr-integration Jun 13, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants