From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641199782; cv=none; d=zohomail.com; s=zohoarc; b=D0CYBrXfj80owzSV8HnbbPnyHxSwFkO9SFdjapsCzU6s8+MRz0HI9tEGxYpTfuuQeZgG9pfDaqH6JIiuzMi8m5fesFnTjreEBVnpYGTAQ++mNXepLoRXvFHSVbe1efwcw0fmO34EpfaCasv48WTge7QOs+wAPqNBdzrEkYX7Onw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641199782; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=e8YVyGVOiZt9XzqbHWXxr9hz/m+h+uDv3hs5odO302Q=; b=L/aBbXGDGK+Ej7rbcpc3Dzmz0uKoe0kF1ZDIosU4cqUnp2x5peNZgW6ig4G5qXmx4lOvu4/T49EqGPcgpitu0DTACGE8A0GBYfpyKBRwzLGbCtDwX/qtYI0Pgqt4p//H2ljPucIdq7f+NEZ/DaUQdEe0Ula5p1RilzRPaOCQr5w= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641199782417458.81368245207386; Mon, 3 Jan 2022 00:49:42 -0800 (PST) Received: from localhost ([::1]:60372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J2C-000751-OA for importer@patchew.org; Mon, 03 Jan 2022 03:49:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzU-0004Ih-L3; Mon, 03 Jan 2022 03:46:52 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzS-0006Rh-2P; Mon, 03 Jan 2022 03:46:52 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JS8V75Yf0zcc2g; Mon, 3 Jan 2022 16:46:07 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:39 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 1/7] hw/arm/virt: Support CPU cluster on ARM virt machine Date: Mon, 3 Jan 2022 16:46:30 +0800 Message-ID: <20220103084636.2496-2-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.187; envelope-from=wangyanan55@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641199783950100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ARM64 machines like Kunpeng Family Server Chips have a level of hardware topology in which a group of CPU cores share L3 cache tag or L2 cache. For example, Kunpeng 920 typically has 6 or 8 clusters in each NUMA node (also represent range of CPU die), and each cluster has 4 CPU cores. All clusters share L3 cache data, but CPU cores in each cluster share a local L3 tag. Running a guest kernel with Cluster-Aware Scheduling on the Hosts which have physical clusters, if we can design a vCPU topology with cluster level for guest kernel and then have a dedicated vCPU pinning, the guest will gain scheduling performance improvement from cache affinity of CPU cluster. So let's enable the support for this new parameter on ARM virt machines. After this patch, we can define a 4-level CPU hierarchy like: cpus=3D*,maxcpus=3D*,sockets=3D*,clusters=3D*, cores=3D*,threads=3D*. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/arm/virt.c | 1 + qemu-options.hx | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 6bce595aba..f413e146d9 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2700,6 +2700,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) hc->unplug_request =3D virt_machine_device_unplug_request_cb; hc->unplug =3D virt_machine_device_unplug_cb; mc->nvdimm_supported =3D true; + mc->smp_props.clusters_supported =3D true; mc->auto_enable_numa_with_memhp =3D true; mc->auto_enable_numa_with_memdev =3D true; mc->default_ram_id =3D "mach-virt.ram"; diff --git a/qemu-options.hx b/qemu-options.hx index fd1f8135fb..69ef1cdb85 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -277,6 +277,16 @@ SRST =20 -smp 16,sockets=3D2,dies=3D2,cores=3D2,threads=3D2,maxcpus=3D16 =20 + The following sub-option defines a CPU topology hierarchy (2 sockets + totally on the machine, 2 clusters per socket, 2 cores per cluster, + 2 threads per core) for ARM virt machines which support sockets/cluste= rs + /cores/threads. Some members of the option can be omitted but their va= lues + will be automatically computed: + + :: + + -smp 16,sockets=3D2,clusters=3D2,cores=3D2,threads=3D2,maxcpus=3D16 + Historically preference was given to the coarsest topology parameters when computing missing values (ie sockets preferred over cores, which were preferred over threads), however, this behaviour is considered --=20 2.27.0 From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641200007; cv=none; d=zohomail.com; s=zohoarc; b=A+fuT6LbwhHbgpvzeeChgDvhP1h+0EaDYR5SetgZG0byhU9N8HEaVn9HY1WPzVRmhPhTDdBAdEPZGJf15RUw5aREiRuJTvga9CMwxNEjVm0Iz8HFYQUrOwUGLWXwrzE+Pze7UyqvAN+4ODmBzx7vMk7XFsrYUtvmzwcK8H0WsEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641200007; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=FXYiiXD5ERzmHZVnk8OaIEFOH1pIB5aphae5eBBBpCE=; b=S49nfaLhmAY21/gqF+5Kc8dnoSjJaMPNQSj2BTBNvC8FlY1j4deqeYiF2MsBDss3o7QLIGjrbocZEjNijjHZ6narVDugCuUwcdYsxvB9F4X9eEI3SapAJ1qWtGiLFzzzwe9WVGeWP7IgD0zDDJvkZYpbSJ1oAQcICqDGtRg/49U= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16412000071571012.3477944599997; Mon, 3 Jan 2022 00:53:27 -0800 (PST) Received: from localhost ([::1]:39756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J5q-0003nh-7O for importer@patchew.org; Mon, 03 Jan 2022 03:53:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzU-0004Ij-Sg; Mon, 03 Jan 2022 03:46:53 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzS-0006Rk-2C; Mon, 03 Jan 2022 03:46:52 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JS8V86h57zcbh5; Mon, 3 Jan 2022 16:46:08 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:40 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 2/7] hw/arm/virt: Support cluster level in DT cpu-map Date: Mon, 3 Jan 2022 16:46:31 +0800 Message-ID: <20220103084636.2496-3-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.187; envelope-from=wangyanan55@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641200007664100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Support one cluster level between core and physical package in the cpu-map of Arm/virt devicetree. This is also consistent with Linux Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/arm/virt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f413e146d9..fc5eea8c8c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -430,9 +430,8 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) * can contain several layers of clustering within a single physic= al * package and cluster nodes can be contained in parent cluster no= des. * - * Given that cluster is not yet supported in the vCPU topology, - * we currently generate one cluster node within each socket node - * by default. + * Note: currently we only support one layer of clustering within + * each physical package. */ qemu_fdt_add_subnode(ms->fdt, "/cpus/cpu-map"); =20 @@ -442,14 +441,16 @@ static void fdt_add_cpu_nodes(const VirtMachineState = *vms) =20 if (ms->smp.threads > 1) { map_path =3D g_strdup_printf( - "/cpus/cpu-map/socket%d/cluster0/core%d/thread%d", - cpu / (ms->smp.cores * ms->smp.threads), + "/cpus/cpu-map/socket%d/cluster%d/core%d/thread%d", + cpu / (ms->smp.clusters * ms->smp.cores * ms->smp.thre= ads), + (cpu / (ms->smp.cores * ms->smp.threads)) % ms->smp.cl= usters, (cpu / ms->smp.threads) % ms->smp.cores, cpu % ms->smp.threads); } else { map_path =3D g_strdup_printf( - "/cpus/cpu-map/socket%d/cluster0/core%d", - cpu / ms->smp.cores, + "/cpus/cpu-map/socket%d/cluster%d/core%d", + cpu / (ms->smp.clusters * ms->smp.cores), + (cpu / ms->smp.cores) % ms->smp.clusters, cpu % ms->smp.cores); } qemu_fdt_add_path(ms->fdt, map_path); --=20 2.27.0 From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641199956; cv=none; d=zohomail.com; s=zohoarc; b=IRg/KAq3YqioCEWZ9+zKtYL6AhmdE085mX7DfKvdItZlirVIg5IqIGCIRF8kzG+a0F3owKrRz2Pso9RqcBY6c/s/LEUKvEIqO5mV2LiHOz/ijqeLbfbVCw3LvlCLLb7TAGyC3oWf4MKIoPN3cyO4ldiNqaAwLrXnY4sUPYDg6ME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641199956; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cBUfiVOYGWl22yRynyBLQG69X/Lz5PPIYnz7j9gsncE=; b=XpCWgUJ4/DG0V6uimdlz2Jzc4KX555BJ9HpkY5TDt43z5NTQ1aeJpEJM10Z7ppQE6AelMub8OJHTHx5HCceSuAGw5Z7/57v3AYciDF1ZDWivQv0MCAFHLwprDA6QUkmmx0kH3WOL0nwuoQQQfz2wpDCYAqKf2TJHHfxMRgVMphc= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16411999566931023.1744334513836; Mon, 3 Jan 2022 00:52:36 -0800 (PST) Received: from localhost ([::1]:38728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J51-00037H-QG for importer@patchew.org; Mon, 03 Jan 2022 03:52:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzW-0004J0-BR; Mon, 03 Jan 2022 03:46:54 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:4169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzS-0006Rw-5i; Mon, 03 Jan 2022 03:46:54 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JS8Rs214Xz8wCP; Mon, 3 Jan 2022 16:44:09 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:41 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 3/7] hw/acpi/aml-build: Improve scalability of PPTT generation Date: Mon, 3 Jan 2022 16:46:32 +0800 Message-ID: <20220103084636.2496-4-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.189; envelope-from=wangyanan55@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641199957944100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently we generate a PPTT table of n-level processor hierarchy with n-level loops in build_pptt(). It works fine as now there are only three CPU topology parameters. But the code may become less scalable with the processor hierarchy levels increasing. This patch only improves the scalability of build_pptt by reducing the loops, and intends to make no functional change. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/acpi/aml-build.c | 50 +++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index b3b3310df3..be3851be36 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -2001,7 +2001,10 @@ static void build_processor_hierarchy_node(GArray *t= bl, uint32_t flags, void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, const char *oem_id, const char *oem_table_id) { - int pptt_start =3D table_data->len; + GQueue *list =3D g_queue_new(); + guint pptt_start =3D table_data->len; + guint father_offset; + guint length, i; int uid =3D 0; int socket; AcpiTable table =3D { .sig =3D "PPTT", .rev =3D 2, @@ -2010,9 +2013,8 @@ void build_pptt(GArray *table_data, BIOSLinker *linke= r, MachineState *ms, acpi_table_begin(&table, table_data); =20 for (socket =3D 0; socket < ms->smp.sockets; socket++) { - uint32_t socket_offset =3D table_data->len - pptt_start; - int core; - + g_queue_push_tail(list, + GUINT_TO_POINTER(table_data->len - pptt_start)); build_processor_hierarchy_node( table_data, /* @@ -2021,35 +2023,47 @@ void build_pptt(GArray *table_data, BIOSLinker *lin= ker, MachineState *ms, */ (1 << 0), 0, socket, NULL, 0); + } =20 - for (core =3D 0; core < ms->smp.cores; core++) { - uint32_t core_offset =3D table_data->len - pptt_start; - int thread; + length =3D g_queue_get_length(list); + for (i =3D 0; i < length; i++) { + int core; =20 + father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); + for (core =3D 0; core < ms->smp.cores; core++) { if (ms->smp.threads > 1) { + g_queue_push_tail(list, + GUINT_TO_POINTER(table_data->len - pptt_start)); build_processor_hierarchy_node( table_data, (0 << 0), /* not a physical package */ - socket_offset, core, NULL, 0); - - for (thread =3D 0; thread < ms->smp.threads; thread++) { - build_processor_hierarchy_node( - table_data, - (1 << 1) | /* ACPI Processor ID valid */ - (1 << 2) | /* Processor is a Thread */ - (1 << 3), /* Node is a Leaf */ - core_offset, uid++, NULL, 0); - } + father_offset, core, NULL, 0); } else { build_processor_hierarchy_node( table_data, (1 << 1) | /* ACPI Processor ID valid */ (1 << 3), /* Node is a Leaf */ - socket_offset, uid++, NULL, 0); + father_offset, uid++, NULL, 0); } } } =20 + length =3D g_queue_get_length(list); + for (i =3D 0; i < length; i++) { + int thread; + + father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); + for (thread =3D 0; thread < ms->smp.threads; thread++) { + build_processor_hierarchy_node( + table_data, + (1 << 1) | /* ACPI Processor ID valid */ + (1 << 2) | /* Processor is a Thread */ + (1 << 3), /* Node is a Leaf */ + father_offset, uid++, NULL, 0); + } + } + + g_queue_free(list); acpi_table_end(linker, &table); } =20 --=20 2.27.0 From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641199793; cv=none; d=zohomail.com; s=zohoarc; b=kVX9GUzdTWoqgg6UKapShXjbuNPcF/h1E3+LTMtVv9SuV1rOHfXUfgOkxopfawoS6ZHKy5GjxxseiZESRc1XadsxOHN62b9CfRPqNDiLtghMhvhGLagvZ2Quz4eh0XTOFLg3rrBBzaBAlzWRe4pp9QBH7K8XzH6k0+SSXkbjZPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641199793; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ntReV0YfFUa7Tv6qwj3m5JrMoHmN5NcLAf/ErdBqvoQ=; b=Rv0NvBTRN+zbqAno7sS+Da18kHCAu73YU7GComchN3+Gh1TaBFkyQ9l3DwVvRjrFg8s7LQHTZw/ziOwdFJJh3Q5VyK2X1g7uoHK/d6QgjaHvIf+d7heZmp4oDvVI0pj4IpU0Gh9Z1lxnrLL4jsej4aPS32S0pFTlIQv+Ds4FDPM= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641199793233942.6949383554302; Mon, 3 Jan 2022 00:49:53 -0800 (PST) Received: from localhost ([::1]:33288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J2N-0007pg-KX for importer@patchew.org; Mon, 03 Jan 2022 03:49:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzW-0004J3-Ms; Mon, 03 Jan 2022 03:46:55 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:3065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzR-0006S5-Vr; Mon, 03 Jan 2022 03:46:54 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JS8VB4rtPzbhjd; Mon, 3 Jan 2022 16:46:10 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:42 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 4/7] hw/arm/virt-acpi-build: Make an ARM specific PPTT generator Date: Mon, 3 Jan 2022 16:46:33 +0800 Message-ID: <20220103084636.2496-5-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.188; envelope-from=wangyanan55@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641199795157100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We have a generic build_pptt() in hw/acpi/aml-build.c but it's currently only used in ARM acpi initialization. Now we are going to support the new CPU cluster parameter which is currently only supported by ARM, it won't be a very good idea to add it to the generic build_pptt() as it will make the code complex and hard to maintain especially when we also support CPU cache topology hierarchy in build_pptt() too. Note that the cache topology design also varies between different CPU targets. So an ARM specific PPTT generator becomes necessary now. Given that the generic one is currently only used by ARM, let's just move build_pptt() from aml-build.c to virt-acpi-build.c with minor update. Signed-off-by: Yanan Wang --- hw/acpi/aml-build.c | 80 ++----------------------------------- hw/arm/virt-acpi-build.c | 77 ++++++++++++++++++++++++++++++++++- include/hw/acpi/aml-build.h | 5 ++- 3 files changed, 81 insertions(+), 81 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index be3851be36..040fbc9b4b 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1968,10 +1968,9 @@ void build_slit(GArray *table_data, BIOSLinker *link= er, MachineState *ms, * ACPI spec, Revision 6.3 * 5.2.29.1 Processor hierarchy node structure (Type 0) */ -static void build_processor_hierarchy_node(GArray *tbl, uint32_t flags, - uint32_t parent, uint32_t id, - uint32_t *priv_rsrc, - uint32_t priv_num) +void build_processor_hierarchy_node(GArray *tbl, uint32_t flags, + uint32_t parent, uint32_t id, + uint32_t *priv_rsrc, uint32_t priv_num) { int i; =20 @@ -1994,79 +1993,6 @@ static void build_processor_hierarchy_node(GArray *t= bl, uint32_t flags, } } =20 -/* - * ACPI spec, Revision 6.3 - * 5.2.29 Processor Properties Topology Table (PPTT) - */ -void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, - const char *oem_id, const char *oem_table_id) -{ - GQueue *list =3D g_queue_new(); - guint pptt_start =3D table_data->len; - guint father_offset; - guint length, i; - int uid =3D 0; - int socket; - AcpiTable table =3D { .sig =3D "PPTT", .rev =3D 2, - .oem_id =3D oem_id, .oem_table_id =3D oem_table_id= }; - - acpi_table_begin(&table, table_data); - - for (socket =3D 0; socket < ms->smp.sockets; socket++) { - g_queue_push_tail(list, - GUINT_TO_POINTER(table_data->len - pptt_start)); - build_processor_hierarchy_node( - table_data, - /* - * Physical package - represents the boundary - * of a physical package - */ - (1 << 0), - 0, socket, NULL, 0); - } - - length =3D g_queue_get_length(list); - for (i =3D 0; i < length; i++) { - int core; - - father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); - for (core =3D 0; core < ms->smp.cores; core++) { - if (ms->smp.threads > 1) { - g_queue_push_tail(list, - GUINT_TO_POINTER(table_data->len - pptt_start)); - build_processor_hierarchy_node( - table_data, - (0 << 0), /* not a physical package */ - father_offset, core, NULL, 0); - } else { - build_processor_hierarchy_node( - table_data, - (1 << 1) | /* ACPI Processor ID valid */ - (1 << 3), /* Node is a Leaf */ - father_offset, uid++, NULL, 0); - } - } - } - - length =3D g_queue_get_length(list); - for (i =3D 0; i < length; i++) { - int thread; - - father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); - for (thread =3D 0; thread < ms->smp.threads; thread++) { - build_processor_hierarchy_node( - table_data, - (1 << 1) | /* ACPI Processor ID valid */ - (1 << 2) | /* Processor is a Thread */ - (1 << 3), /* Node is a Leaf */ - father_offset, uid++, NULL, 0); - } - } - - g_queue_free(list); - acpi_table_end(linker, &table); -} - /* build rev1/rev3/rev5.1 FADT */ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, const char *oem_id, const char *oem_table_id) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index d0f4867fdf..3ce7680393 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -808,6 +808,80 @@ build_madt(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) acpi_table_end(linker, &table); } =20 +/* + * ACPI spec, Revision 6.3 + * 5.2.29 Processor Properties Topology Table (PPTT) + */ +static void +build_pptt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) +{ + MachineState *ms =3D MACHINE(vms); + GQueue *list =3D g_queue_new(); + guint pptt_start =3D table_data->len; + guint father_offset; + guint length, i; + int uid =3D 0; + int socket; + AcpiTable table =3D { .sig =3D "PPTT", .rev =3D 2, .oem_id =3D vms->oe= m_id, + .oem_table_id =3D vms->oem_table_id }; + + acpi_table_begin(&table, table_data); + + for (socket =3D 0; socket < ms->smp.sockets; socket++) { + g_queue_push_tail(list, + GUINT_TO_POINTER(table_data->len - pptt_start)); + build_processor_hierarchy_node( + table_data, + /* + * Physical package - represents the boundary + * of a physical package + */ + (1 << 0), + 0, socket, NULL, 0); + } + + length =3D g_queue_get_length(list); + for (i =3D 0; i < length; i++) { + int core; + + father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); + for (core =3D 0; core < ms->smp.cores; core++) { + if (ms->smp.threads > 1) { + g_queue_push_tail(list, + GUINT_TO_POINTER(table_data->len - pptt_start)); + build_processor_hierarchy_node( + table_data, + (0 << 0), /* not a physical package */ + father_offset, core, NULL, 0); + } else { + build_processor_hierarchy_node( + table_data, + (1 << 1) | /* ACPI Processor ID valid */ + (1 << 3), /* Node is a Leaf */ + father_offset, uid++, NULL, 0); + } + } + } + + length =3D g_queue_get_length(list); + for (i =3D 0; i < length; i++) { + int thread; + + father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); + for (thread =3D 0; thread < ms->smp.threads; thread++) { + build_processor_hierarchy_node( + table_data, + (1 << 1) | /* ACPI Processor ID valid */ + (1 << 2) | /* Processor is a Thread */ + (1 << 3), /* Node is a Leaf */ + father_offset, uid++, NULL, 0); + } + } + + g_queue_free(list); + acpi_table_end(linker, &table); +} + /* FADT */ static void build_fadt_rev5(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms, unsigned dsdt_tbl_offse= t) @@ -953,8 +1027,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) =20 if (!vmc->no_cpu_topology) { acpi_add_table(table_offsets, tables_blob); - build_pptt(tables_blob, tables->linker, ms, - vms->oem_id, vms->oem_table_id); + build_pptt(tables_blob, tables->linker, vms); } =20 acpi_add_table(table_offsets, tables_blob); diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 8346003a22..2c457c8f17 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -489,8 +489,9 @@ void build_srat_memory(GArray *table_data, uint64_t bas= e, void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, const char *oem_id, const char *oem_table_id); =20 -void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, - const char *oem_id, const char *oem_table_id); +void build_processor_hierarchy_node(GArray *tbl, uint32_t flags, + uint32_t parent, uint32_t id, + uint32_t *priv_rsrc, uint32_t priv_num= ); =20 void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, const char *oem_id, const char *oem_table_id); --=20 2.27.0 From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641200219; cv=none; d=zohomail.com; s=zohoarc; b=UVzHWzPjkaTzQGgldrhewPGneUpduDc7T8dtGkvHD7xL2hNyOKWyos4/9pDOfbSVgatnAo0879sigrtlVeRTIkrWTOuNCCjQw13GSdGrtPwZs38abxmxYfkhQQ7tPD1odEMVBXe7FxJo8xHFRkPVpbLsidI+0smWjSx6E2XRaTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641200219; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=J/wuiWW5G0o9+usXREMXSg1yCX1vOEGYoIBWB08Dgrk=; b=eR5PRDDAmsLpaExn4c3brcdsBd6ib4yK0ZBQpP3+ACw6wCQoUhObW6zDATZ+SwV0vTIyDifQYZyBhynRhXqk+5hCwho4xxzW8uJiMWeakkyk7qwBE/AfeboBdLtWPkR0PvftcE4P537G31NVFfmbUlCevAaP6SvJYr3FvlFLf90= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641200219624794.1727860163043; Mon, 3 Jan 2022 00:56:59 -0800 (PST) Received: from localhost ([::1]:46542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J9G-0008U1-OD for importer@patchew.org; Mon, 03 Jan 2022 03:56:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzW-0004J1-FP; Mon, 03 Jan 2022 03:46:54 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:4170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzT-0006S9-Qc; Mon, 03 Jan 2022 03:46:54 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JS8Rv33zWz8wCM; Mon, 3 Jan 2022 16:44:11 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:43 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 5/7] tests/acpi/bios-tables-test: Allow changes to virt/PPTT file Date: Mon, 3 Jan 2022 16:46:34 +0800 Message-ID: <20220103084636.2496-6-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.189; envelope-from=wangyanan55@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641200220740100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" List test/data/acpi/virt/PPTT as the expected files allowed to be changed in tests/qtest/bios-tables-test-allowed-diff.h Signed-off-by: Yanan Wang Acked-by: Ani Sinha --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..cb143a55a6 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/virt/PPTT", --=20 2.27.0 From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641200194; cv=none; d=zohomail.com; s=zohoarc; b=AJL/KFiQh/qYgEoYp3SIT1bqtz+TM5ovxaJ1xIEDIVgi/HVJECb0FlTPRv46bS8drOfIM9G6vtV2QEKzHZKyhCnXBdQOPR9XEYBRGZ+E+KxhqWzzGaoTw4oeFA840caIpgcN8R2BnuhUFu4BJ3WEsEfCq2oAzM6nd2vBiR9S4+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641200194; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=P2JLn7sZQTszxItloYBLcZBNIjPbfKFohUNGaLhjspQ=; b=hNgcCFn0tKYY3QxjV2R3C5Rdq2Ce8CpNTIXNLC5rsNZrl6aqctTV4b7Lwxizr65z1NqF+tJDZ/LuHeSxblXa7A+qKFiEYK8+b8Hq+PlAXFCdRY7GMGHOhrWT1bY8XbL5tgqo80/wCiWc2fI6Ifv2LcUFXRUAJsyGafUkrUekSi4= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641200194068893.050964191965; Mon, 3 Jan 2022 00:56:34 -0800 (PST) Received: from localhost ([::1]:45076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J8q-0007Pp-JD for importer@patchew.org; Mon, 03 Jan 2022 03:56:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzX-0004Ja-TE; Mon, 03 Jan 2022 03:46:56 -0500 Received: from szxga08-in.huawei.com ([45.249.212.255]:3257) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzU-0006SG-9P; Mon, 03 Jan 2022 03:46:55 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4JS8Qx0bX2z1DJwq; Mon, 3 Jan 2022 16:43:21 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:44 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 6/7] hw/arm/virt-acpi-build: Support cluster level in PPTT generation Date: Mon, 3 Jan 2022 16:46:35 +0800 Message-ID: <20220103084636.2496-7-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.255; envelope-from=wangyanan55@huawei.com; helo=szxga08-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641200196418100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Support cluster level in generation of ACPI Processor Properties Topology Table (PPTT) for ARM virt machines. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/arm/virt-acpi-build.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 3ce7680393..5f91969688 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -840,6 +840,21 @@ build_pptt(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) 0, socket, NULL, 0); } =20 + length =3D g_queue_get_length(list); + for (i =3D 0; i < length; i++) { + int cluster; + + father_offset =3D GPOINTER_TO_UINT(g_queue_pop_head(list)); + for (cluster =3D 0; cluster < ms->smp.clusters; cluster++) { + g_queue_push_tail(list, + GUINT_TO_POINTER(table_data->len - pptt_start)); + build_processor_hierarchy_node( + table_data, + (0 << 0), /* not a physical package */ + father_offset, cluster, NULL, 0); + } + } + length =3D g_queue_get_length(list); for (i =3D 0; i < length; i++) { int core; --=20 2.27.0 From nobody Sat May 18 12:29:48 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1641200007; cv=none; d=zohomail.com; s=zohoarc; b=eKNNd+HVBYmS+/wInlkT3itwWQk5Wt/zVvST4Jpn/YlWDEvx1HhzEtqJ6cFOXALRKwkdoO486lvyr4bWEU3ADy2ssPpOE3Jsq/A0iLmSbZ6UC/eabo5iYwttgVdH5rOV3713o4Bl/pYDMS8ErUeKZIb60GSXeiKjeeKVnfFDwVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641200007; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Jwy7Rtd92m9QClZeLfoET89DQwFB0D+b7fIiDBmygBc=; b=PTV2E0LZpW0b1U1e/+kLPzZtwjMV9wB42kemrTVvqCet/x6yBf3jQO4EEOLJC8NsAlDCBYg2A8StrSu2UBmHEiSED305JvE8/Mb6an62rH20RqqiwuRcFG1ZtWLmQuohJExUT2v5pTcYfGvjRq7iIHC58dTwc5A36C9/HXalTcI= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641200007633728.3601197647022; Mon, 3 Jan 2022 00:53:27 -0800 (PST) Received: from localhost ([::1]:39762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J5q-0003ns-MA for importer@patchew.org; Mon, 03 Jan 2022 03:53:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzX-0004JZ-Na; Mon, 03 Jan 2022 03:46:56 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:4171) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzU-0006SL-7F; Mon, 03 Jan 2022 03:46:55 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JS8Rx3TSHz8vnq; Mon, 3 Jan 2022 16:44:13 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:45 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 7/7] tests/acpi/bios-table-test: Update expected virt/PPTT file Date: Mon, 3 Jan 2022 16:46:36 +0800 Message-ID: <20220103084636.2496-8-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20220103084636.2496-1-wangyanan55@huawei.com> References: <20220103084636.2496-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) 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.189; envelope-from=wangyanan55@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1641200009569100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Run ./tests/data/acpi/rebuild-expected-aml.sh from build directory to update PPTT binary. Also empty bios-tables-test-allowed-diff.h. The disassembled differences between actual and expected PPTT: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20180810 (64-bit version) * Copyright (c) 2000 - 2018 Intel Corporation * - * Disassembly of tests/data/acpi/virt/PPTT, Mon Oct 25 20:24:53 2021 + * Disassembly of /tmp/aml-BPI5B1, Mon Oct 25 20:24:53 2021 * * ACPI Data Table [PPTT] * * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue */ [000h 0000 4] Signature : "PPTT" [Processor Proper= ties Topology Table] -[004h 0004 4] Table Length : 0000004C +[004h 0004 4] Table Length : 00000060 [008h 0008 1] Revision : 02 -[009h 0009 1] Checksum : A8 +[009h 0009 1] Checksum : 48 [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001 [024h 0036 1] Subtable Type : 00 [Processor Hierarchy Nod= e] [025h 0037 1] Length : 14 [026h 0038 2] Reserved : 0000 [028h 0040 4] Flags (decoded below) : 00000001 Physical package : 1 ACPI Processor ID valid : 0 [02Ch 0044 4] Parent : 00000000 [030h 0048 4] ACPI Processor ID : 00000000 [034h 0052 4] Private Resource Number : 00000000 [038h 0056 1] Subtable Type : 00 [Processor Hierarchy Nod= e] [039h 0057 1] Length : 14 [03Ah 0058 2] Reserved : 0000 -[03Ch 0060 4] Flags (decoded below) : 0000000A +[03Ch 0060 4] Flags (decoded below) : 00000000 Physical package : 0 - ACPI Processor ID valid : 1 + ACPI Processor ID valid : 0 [040h 0064 4] Parent : 00000024 [044h 0068 4] ACPI Processor ID : 00000000 [048h 0072 4] Private Resource Number : 00000000 -Raw Table Data: Length 76 (0x4C) +[04Ch 0076 1] Subtable Type : 00 [Processor Hierarchy Nod= e] +[04Dh 0077 1] Length : 14 +[04Eh 0078 2] Reserved : 0000 +[050h 0080 4] Flags (decoded below) : 0000000A + Physical package : 0 + ACPI Processor ID valid : 1 +[054h 0084 4] Parent : 00000038 +[058h 0088 4] ACPI Processor ID : 00000000 +[05Ch 0092 4] Private Resource Number : 00000000 + +Raw Table Data: Length 96 (0x60) - 0000: 50 50 54 54 4C 00 00 00 02 A8 42 4F 43 48 53 20 // PPTTL.....BO= CHS + 0000: 50 50 54 54 60 00 00 00 02 48 42 4F 43 48 53 20 // PPTT`....HBO= CHS 0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ....= BXPC 0020: 01 00 00 00 00 14 00 00 01 00 00 00 00 00 00 00 // ............= .... - 0030: 00 00 00 00 00 00 00 00 00 14 00 00 0A 00 00 00 // ............= .... - 0040: 24 00 00 00 00 00 00 00 00 00 00 00 // $........... + 0030: 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 // ............= .... + 0040: 24 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 // $...........= .... + 0050: 0A 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 // ....8.......= .... Signed-off-by: Yanan Wang Reviewed-by: Ani Sinha --- tests/data/acpi/virt/PPTT | Bin 76 -> 96 bytes tests/qtest/bios-tables-test-allowed-diff.h | 1 - 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/virt/PPTT b/tests/data/acpi/virt/PPTT index 7a1258ecf123555b24462c98ccbb76b4ac1d0c2b..f56ea63b369a604877374ad696c= 396e796ab1c83 100644 GIT binary patch delta 53 zcmV-50LuSNU