From nobody Mon May 20 15:26:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685451607755604.6657931350506; Tue, 30 May 2023 06:00:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yx9-0006lo-Cb; Tue, 30 May 2023 08:59:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yx7-0006l9-8N for qemu-devel@nongnu.org; Tue, 30 May 2023 08:59:53 -0400 Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yx4-0000en-7m for qemu-devel@nongnu.org; Tue, 30 May 2023 08:59:53 -0400 Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8AxQ_BB83VkPJkCAA--.5848S3; Tue, 30 May 2023 20:59:45 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxKL1B83VkHKOAAA--.12887S2; Tue, 30 May 2023 20:59:45 +0800 (CST) From: Tianrui Zhao To: qemu-devel@nongnu.org Cc: gaosong@loongson.cn, maobibo@loongson.cn, zhaotianrui@loongson.cn, philmd@linaro.org, richard.henderson@linaro.org, peter.maydell@linaro.org Subject: [PATCH] hw/loongarch: Supplement cpu topology arguments Date: Tue, 30 May 2023 20:59:45 +0800 Message-Id: <20230530125945.804060-1-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID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IFyTuYvj4RC_MaUUUUU Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=114.242.206.163; envelope-from=zhaotianrui@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1685451609033100005 Content-Type: text/plain; charset="utf-8" Supplement LoongArch cpu topology arguments, including support socket and threads per core. Based-on: <20230518014115.117869-1-gaosong@loongson.cn> Signed-off-by: Tianrui Zhao --- hw/loongarch/acpi-build.c | 4 ++++ hw/loongarch/virt.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index d4429bac00..51541ac532 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -414,6 +414,10 @@ static void acpi_build(AcpiBuildTables *tables, Machin= eState *machine) acpi_add_table(table_offsets, tables_blob); build_madt(tables_blob, tables->linker, lams); =20 + 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); =20 diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 0a9067d4d8..1ace1631d0 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -1046,8 +1046,15 @@ static const CPUArchIdList *virt_possible_cpu_arch_i= ds(MachineState *ms) for (n =3D 0; n < ms->possible_cpus->len; n++) { ms->possible_cpus->cpus[n].type =3D ms->cpu_type; ms->possible_cpus->cpus[n].arch_id =3D n; + + ms->possible_cpus->cpus[n].props.has_socket_id =3D true; + ms->possible_cpus->cpus[n].props.socket_id =3D + n / (ms->smp.cores * ms->smp.threa= ds); ms->possible_cpus->cpus[n].props.has_core_id =3D true; - ms->possible_cpus->cpus[n].props.core_id =3D n; + ms->possible_cpus->cpus[n].props.core_id =3D + (n / ms->smp.threads) % ms->smp.cores; + ms->possible_cpus->cpus[n].props.has_thread_id =3D true; + ms->possible_cpus->cpus[n].props.thread_id =3D n % ms->smp.threads; } return ms->possible_cpus; } --=20 2.27.0