Skip to content

Commit 25fd54c

Browse files
committed
hw/arm/xlnx-versal: fix Versal2 VxWorks SMP boot
VxWorks requires the Versal2 compatible string and looks up secondary CPU nodes using MPIDR-based CPU IDs. Add the amd,versal2 compatible string for the Versal2 virt machine and generate CPU node unit 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>
1 parent b385a6f commit 25fd54c

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

hw/arm/xlnx-versal-virt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static void fdt_create(VersalVirt *s)
6666
MachineClass *mc = MACHINE_GET_CLASS(s);
6767
VersalVirtClass *vvc = XLNX_VERSAL_VIRT_BASE_MACHINE_GET_CLASS(s);
6868
const char versal_compat[] = "xlnx,versal\0amd,versal\0amd-versal-virt\0xlnx-versal-virt";
69-
const char versal2_compat[] = "amd-versal2-virt";
69+
const char versal2_compat[] = "amd,versal2\0amd-versal2-virt";
7070

7171
s->fdt = create_device_tree(&s->fdt_size);
7272
if (!s->fdt) {

hw/arm/xlnx-versal.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,14 +1122,13 @@ static void versal_create_cpu_dtb(Versal *s, const VersalCpuClusterMap *map,
11221122
size_t core_idx)
11231123
{
11241124
ARMCPU *arm_cpu = ARM_CPU(cpu);
1125-
size_t idx = cluster_idx * map->num_core + core_idx;
1125+
uint32_t affinity = arm_cpu_mp_affinity(arm_cpu) & ARM64_AFFINITY_MASK;
11261126
g_autofree char *node = NULL;
11271127

1128-
node = versal_fdt_add_subnode(s, "/cpus/cpu", idx,
1128+
node = versal_fdt_add_subnode(s, "/cpus/cpu", affinity,
11291129
arm_cpu->dtb_compatible,
11301130
strlen(arm_cpu->dtb_compatible) + 1);
1131-
qemu_fdt_setprop_cell(s->cfg.fdt, node, "reg",
1132-
arm_cpu_mp_affinity(arm_cpu) & ARM64_AFFINITY_MASK);
1131+
qemu_fdt_setprop_cell(s->cfg.fdt, node, "reg", affinity);
11331132
qemu_fdt_setprop_string(s->cfg.fdt, node, "device_type", "cpu");
11341133
qemu_fdt_setprop_string(s->cfg.fdt, node, "enable-method", "psci");
11351134
}

0 commit comments

Comments
 (0)