Message ID | 20230613123251.2471878-1-zhaotianrui@loongson.cn |
---|---|
State | New |
Headers | show |
Series | hw/loongarch: Supplement cpu topology arguments | expand |
On 13/6/23 14:32, Tianrui Zhao wrote: > Supplement LoongArch cpu topology arguments, including support socket > and threads per core. > > Base-on: > https://patchew.org/QEMU/20230613122613.2471743-1-zhaotianrui@loongson.cn/ ^ FYI this tag ... > Signed-off-by: Song Gao <gaosong@loongson.cn> > Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn> > --- ... goes here after the '---' separator, because it is only helpful when testing/merging the patch. Once it is committed, this become irrelevant. (Everything after the '---' separator is normally stripped when applying patches). > hw/loongarch/acpi-build.c | 4 ++++ > hw/loongarch/virt.c | 9 ++++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
在 2023/6/13 下午8:55, Philippe Mathieu-Daudé 写道: > On 13/6/23 14:32, Tianrui Zhao wrote: >> Supplement LoongArch cpu topology arguments, including support socket >> and threads per core. >> >> Base-on: >> https://patchew.org/QEMU/20230613122613.2471743-1-zhaotianrui@loongson.cn/ >> > > ^ FYI this tag ... > >> Signed-off-by: Song Gao <gaosong@loongson.cn> >> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn> >> --- > > ... goes here after the '---' separator, because it is only helpful when > testing/merging the patch. Once it is committed, this become irrelevant. > (Everything after the '---' separator is normally stripped when applying > patches). > Thanks, I will move the 'Base-on' flag after the '---'. Tianrui Zhao >> hw/loongarch/acpi-build.c | 4 ++++ >> hw/loongarch/virt.c | 9 ++++++++- >> 2 files changed, 12 insertions(+), 1 deletion(-) > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
在 2023/6/13 下午8:32, Tianrui Zhao 写道: > Supplement LoongArch cpu topology arguments, including support socket > and threads per core. > > Base-on: > https://patchew.org/QEMU/20230613122613.2471743-1-zhaotianrui@loongson.cn/ > > Signed-off-by: Song Gao <gaosong@loongson.cn> > Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn> > --- > hw/loongarch/acpi-build.c | 4 ++++ > hw/loongarch/virt.c | 9 ++++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) Reviewed-by: Song Gao <gaosong@loongson.cn> Thanks. Song Gao > 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 a2fcbf7643..d3b31e3f71 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; > }
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 a2fcbf7643..d3b31e3f71 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; }