From nobody Tue Feb 10 10:07:52 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1604891417; cv=none; d=zohomail.com; s=zohoarc; b=JdFGpacBZ7MytYEWX9jpjFnBixnlTh9vMWyWpbEUakciXlKTb8mv1xcdkJ2pG7Jex8vLyJXPV90xL3KXULL2ENlZNt5Y4Ay+KkqGFAUPoYdWwJQfy26BHdV2sdPa5bkZhjjJgJ+f82B0uhD6ZBD/Vm+6YHlN0pIJoso9YtSJdmg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604891417; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GH+ibQ2576qOP1kBNTtEm74Ke+Cz6piaTaaNiBV+ex8=; b=ZWDNc01qgQdlJ2lraXiBGnv9tBcwVE8gvdc+ozypVkzywFCwbDxK9mjHtQgL4lkt8+sWKsL9I9AyprRw0DdrD8kL93Ez+XP7O31SWkDAopYj7MtHAn6kc/BMdxL5cCR7JxZCOQocHU4edVP/llInHRuoshnmWektO6BDvH+QjAk= ARC-Authentication-Results: i=1; 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 1604891417592664.9075930443124; Sun, 8 Nov 2020 19:10:17 -0800 (PST) Received: from localhost ([::1]:55464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbxZQ-0007fc-HT for importer@patchew.org; Sun, 08 Nov 2020 22:10:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbxUt-0001d0-Hm; Sun, 08 Nov 2020 22:05:35 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbxUo-0006hT-1b; Sun, 08 Nov 2020 22:05:35 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CTwpf2ZGkzkgtG; Mon, 9 Nov 2020 11:05:14 +0800 (CST) Received: from localhost (10.174.186.67) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Mon, 9 Nov 2020 11:05:15 +0800 From: Ying Fang To: Subject: [RFC PATCH v3 09/13] hw/arm/virt-acpi-build: add PPTT table Date: Mon, 9 Nov 2020 11:04:48 +0800 Message-ID: <20201109030452.2197-10-fangying1@huawei.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201109030452.2197-1-fangying1@huawei.com> References: <20201109030452.2197-1-fangying1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.186.67] X-CFilter-Loop: Reflected 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=45.249.212.190; envelope-from=fangying1@huawei.com; helo=szxga04-in.huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/08 22:05:17 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: drjones@redhat.com, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, qemu-arm@nongnu.org, alistair.francis@wdc.com, Ying Fang , imammedo@redhat.com, salil.mehta@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add the Processor Properties Topology Table (PPTT) to present cpu topology information to the guest. Signed-off-by: Ying Fang --- hw/arm/virt-acpi-build.c | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 9edd6385dc..5784370257 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -429,6 +429,42 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) "SRAT", table_data->len - srat_start, 3, NULL, NULL); } =20 +static void build_pptt(GArray *table_data, BIOSLinker *linker, MachineStat= e *ms) +{ + int pptt_start =3D table_data->len; + int uid =3D 0, cpus =3D 0, socket; + unsigned int smp_cores =3D ms->smp.cores; + unsigned int smp_threads =3D ms->smp.threads; + + acpi_data_push(table_data, sizeof(AcpiTableHeader)); + + for (socket =3D 0; cpus < ms->possible_cpus->len; socket++) { + uint32_t socket_offset =3D table_data->len - pptt_start; + int core; + + build_socket_hierarchy(table_data, 0, socket); + + for (core =3D 0; core < smp_cores; core++) { + uint32_t core_offset =3D table_data->len - pptt_start; + int thread; + + if (smp_threads <=3D 1) { + build_processor_hierarchy(table_data, 2, socket_offset, ui= d++); + } else { + build_processor_hierarchy(table_data, 0, socket_offset, co= re); + for (thread =3D 0; thread < smp_threads; thread++) { + build_smt_hierarchy(table_data, core_offset, uid++); + } + } + } + cpus +=3D smp_cores * smp_threads; + } + + build_header(linker, table_data, + (void *)(table_data->data + pptt_start), "PPTT", + table_data->len - pptt_start, 2, NULL, NULL); +} + /* GTDT */ static void build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) @@ -669,6 +705,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) unsigned dsdt, xsdt; GArray *tables_blob =3D tables->table_data; MachineState *ms =3D MACHINE(vms); + bool cpu_topology_enabled =3D !vmc->ignore_cpu_topology; =20 table_offsets =3D g_array_new(false, true /* clear */, sizeof(uint32_t)); @@ -688,6 +725,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) acpi_add_table(table_offsets, tables_blob); build_madt(tables_blob, tables->linker, vms); =20 + if (cpu_topology_enabled) { + acpi_add_table(table_offsets, tables_blob); + build_pptt(tables_blob, tables->linker, ms); + } + acpi_add_table(table_offsets, tables_blob); build_gtdt(tables_blob, tables->linker, vms); =20 --=20 2.23.0