From: Tianrui Zhao Date: Tue, 13 Jun 2023 11:37:36 +0000 (+0800) Subject: hw/loongarch: Supplement cpu topology arguments X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f33238836544cb6f3b27968d1ececbd46f037904;p=qemu.git hw/loongarch: Supplement cpu topology arguments Supplement LoongArch cpu topology arguments, including support socket and threads per core. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Song Gao Signed-off-by: Tianrui Zhao Signed-off-by: Song Gao Message-Id: <20230613123251.2471878-1-zhaotianrui@loongson.cn> --- diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index f526f3abba..0b62c3a2f7 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -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); diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 1d5c764408..ca8824b6ef 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -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; }