Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/loongarch: Supplement cpu topology arguments
Supplement LoongArch cpu topology arguments, including support socket
and threads per core.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20230613123251.2471878-1-zhaotianrui@loongson.cn>
  • Loading branch information
zhaotianrui-loongson authored and gaosong-loongson committed Jun 16, 2023
1 parent 0cf1478 commit f332388
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions hw/loongarch/acpi-build.c
Expand Up @@ -437,6 +437,10 @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine)
acpi_add_table(table_offsets, tables_blob);
build_madt(tables_blob, tables->linker, lams);

acpi_add_table(table_offsets, tables_blob);
build_pptt(tables_blob, tables->linker, machine,
lams->oem_id, lams->oem_table_id);

acpi_add_table(table_offsets, tables_blob);
build_srat(tables_blob, tables->linker, machine);

Expand Down
9 changes: 8 additions & 1 deletion hw/loongarch/virt.c
Expand Up @@ -1096,8 +1096,15 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
for (n = 0; n < ms->possible_cpus->len; n++) {
ms->possible_cpus->cpus[n].type = ms->cpu_type;
ms->possible_cpus->cpus[n].arch_id = n;

ms->possible_cpus->cpus[n].props.has_socket_id = true;
ms->possible_cpus->cpus[n].props.socket_id =
n / (ms->smp.cores * ms->smp.threads);
ms->possible_cpus->cpus[n].props.has_core_id = true;
ms->possible_cpus->cpus[n].props.core_id = n % ms->smp.cores;
ms->possible_cpus->cpus[n].props.core_id =
n / ms->smp.threads % ms->smp.cores;
ms->possible_cpus->cpus[n].props.has_thread_id = true;
ms->possible_cpus->cpus[n].props.thread_id = n % ms->smp.threads;
}
return ms->possible_cpus;
}
Expand Down

0 comments on commit f332388

Please sign in to comment.