From nobody Tue Nov 26 17:29:33 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; arc=pass (i=1 dmarc=pass fromdomain=starfivetech.com) ARC-Seal: i=2; a=rsa-sha256; t=1706524963; cv=pass; d=zohomail.com; s=zohoarc; b=TL2qMg265r0F8sB9NEdyTP2aXzwX9eTjlpt4QU0PXAavfwJjQzjun3TZTwDgcz1RIkOYjAu/F2wRDf50vnibH3Tk9gf8cyH1WSNVzCHBRIJZbQ7OzO29YwsDepXW/Pwy0dd2yVsWzcymzApALj8hnKfq7niYpMYv53AdYtI31CM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706524963; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oR6oZhoEfVAJa/pd6hmVtB00Ch1tHWdIwMXgWaVHi4Y=; b=OWBaeZNpqS3kl2vq9qHNVOHLpAxEsTRtiwSsGqeaOR4Mmcf0xsJU2DaY4cbXqk4PJFUx2sImryYyAso6oUUYox9pSH476fcHi5V/lhNYArJKP/pcJe1ivza4RdMWlXlKwzpAgHjpzAdLuLVSV7ZaP662q9fYSijrk8hGSBVCmw8= ARC-Authentication-Results: i=2; 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=pass (i=1 dmarc=pass fromdomain=starfivetech.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706524963877989.0377770664381; Mon, 29 Jan 2024 02:42:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUP5D-0003zm-Bl; Mon, 29 Jan 2024 05:41:43 -0500 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 1rUP5C-0003zR-AV; Mon, 29 Jan 2024 05:41:42 -0500 Received: from mail-bjschn02on20616.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::616] helo=CHN02-BJS-obe.outbound.protection.partner.outlook.cn) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUP58-0005iY-4H; Mon, 29 Jan 2024 05:41:40 -0500 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0594.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.32; Mon, 29 Jan 2024 10:41:12 +0000 Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6]) by BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn ([fe80::3862:65b4:c857:c4a6%4]) with mapi id 15.20.7228.029; Mon, 29 Jan 2024 10:41:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O3tNGGXhVfExlwdiSll8IabJ3DiAzDepOpYqyIUVk7b7HmmM0BwO64+bFsMjrkHQACzZVW1QcBB27lbIjthR9B2i0z9dKiTgTnRvp10mdejz5MpBGBOL901YSk+VOMvrOZvgKMUDetpq6naqZkj5qQfVRI7+KcRAAzAnQhXz08Kl6cp3PLA0fxWSdJ5+8iS1ND8QMxiBxLEhAImkLwI28mKMflSh3CBvTCAczmOn/RQI37zIuJHzglbBLXETUHWtNlchU74psZjb+TvUZqTvIGnBvlKm34zrKkKZRdIor3uZqwmD20Z/GCTQVBhpH0hGg9iKy+cdXaMRjcIhMsyA6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oR6oZhoEfVAJa/pd6hmVtB00Ch1tHWdIwMXgWaVHi4Y=; b=JDBq9TYEfuSy8KNE4w7S107meeGWZISnINI0nbLSJDFpy9F9Bb1c/zruTDIFMEpQc5yHZxXnts+5SEKntB4Gxxn/cTZDqoImz+MWFwINGZCgnN7vahgfz4GzGkOsuNw2YYxkJN/AmyBjMjTqb6uDO/nR8hbhPz2nUIb+tlnm79QaNwQMchj42EK86KoJwvL3lQPF7UpRRnN7e6PTS+eJk2ilUjQXeIwMztjlUbzVlaloBSd738ofLixFgUwXgk4ahaGP90xa9MXOHdD7tOOULz8dVsddum9l7aY89i54pPIUwBG6Yq1adHw8oUyp/M1Atrt8Cq6FTI5anI6sJUdPFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; From: Sia Jee Heng To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org Cc: mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, shannon.zhaosl@gmail.com, jeeheng.sia@starfivetech.com, peter.maydell@linaro.org, sunilvl@ventanamicro.com, palmer@dabbelt.com, alistair.francis@wdc.com, bin.meng@windriver.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com Subject: [RESEND RFC 3/3] hw/arm/virt-acpi-build.c: Enable CPU cache topology Date: Mon, 29 Jan 2024 02:40:39 -0800 Message-Id: <20240129104039.117671-4-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129104039.117671-1-jeeheng.sia@starfivetech.com> References: <20240129104039.117671-1-jeeheng.sia@starfivetech.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BJSPR01CA0004.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:c::16) To BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0561:EE_|BJSPR01MB0594:EE_ X-MS-Office365-Filtering-Correlation-Id: 48926e21-ddb1-4c35-dcc1-08dc20b6cf98 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mVHKS/WfyQn6t+RlTLbmU8Qpit1iCk/SX7SSZwvp+HeLYRfYGywWFshWS7Q2Bzq9t0u1/wO5mjg89c8NRBc/Q334W5CZeXfTfhvtGAPrkaZ2EcwaKuS1YmqkkadTLw92klnJ+nkmZRzJF6jK2IS9af/i66XqOUywByrreNwJavL3rJv1ob3M1R0hmmYvAKvBhR7f639yTbh3YfP0OZUyGMGQ1jbn4PCJ0ADf/6JM1GP9eecalo7Se6vYDSqU2W+ucD3XOkkMIVMc8kdazr/YIMuBeXLlqyqm9B6zZm422klLJ157DwjbiPcpBoykUpFG8lANAhUZePTsUjkezsBiCBC+GDXElN1DFMTN7p3/ZUwqJ30RnuP7IOT4WbirNQFQinZazDa6hNNtagpTrJFL5Z/Tbcc5nXJK4uB8FI1oRa48YWk6G9Wfz+xlssja2r0QwEIMr72+bXqiabBz4I4RombKLFFype8wYVOQRrPDEXC6OAmZkghmqLKWX+ovMuYAUAYBDQnum8IyP6TjzI3+0pAc3x312Iay3A3egOGi/zQk5ezarxlQ1JsrhyUyT/Ys X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(346002)(396003)(39830400003)(230922051799003)(186009)(1800799012)(64100799003)(451199024)(38350700005)(41320700001)(2616005)(2906002)(52116002)(5660300002)(6666004)(7416002)(66946007)(66556008)(4326008)(26005)(1076003)(66476007)(8676002)(8936002)(38100700002)(83380400001)(508600001)(41300700001)(40180700001)(86362001)(40160700002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ovdp45Z/ek7alqIGCiuKL/Apqfe5eSZUa+f8MVX/KlMrSv7Kv8C21K5W2p8B?= =?us-ascii?Q?jb34YLPM2h7Yi5cDsgUAIwSTus3pM/Zd9Lj5zcIGuM8/6gWFzQ/D5X9Ckq8r?= =?us-ascii?Q?5npon7FQzg+amFS6xWl0CPcZ6q/XaSWDNipVQcOQahbSrOtLMOGwOina+Bta?= =?us-ascii?Q?0o6bXsBT1fzgT6XpsHNYsj+FyKRB25XTPwNUdeNTNcVZXfjEEwy3J6aZFvwZ?= =?us-ascii?Q?Mc6vkrTLfKnWNNATNZI18PtJQgBx2iB9rV8M7xUU23DrV2wbBguuaWlN6uJ7?= =?us-ascii?Q?wRF852M39A5fTv9xan8lUIgldAGxZTkAbXqISzJX9PSLpvL2HKaxl6E2Q2JB?= =?us-ascii?Q?rrLFqsqAYlvs2Y6MPJcQOWAkwdk4+1dtecgQa6C8Pql2DeMEpESi1ti+alks?= =?us-ascii?Q?jtAv8xu5SdxwNTSRq7Qsuz7hGy4gdazouzM3NqZk1sH3AO4n/ofY5SPLHdM3?= =?us-ascii?Q?DuSvh+qOh0O2eHWEEl+bFtpfEbh1mF20JCp4UUDOTCysWbNrS8/ZbBuJjC/l?= =?us-ascii?Q?HPsiTDTAobtYc4b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?Q?JJRo5kJV+s5DIBAOqxyaPG6n8sWRl8B4UrC1BtW3MsItoYNUkJqteKyL0yRS?= =?us-ascii?Q?N/LihBvPryNsEEmAy2sg1QOOQKdKsOAHA7iesrpUe72kSZZ3brDMInt/YGmU?= =?us-ascii?Q?W5Ud53Rf+HSgwTbDfg/Wzai738+LjbWJ/G105PqgbCX/vLwIHdxZsbHbJBzp?= =?us-ascii?Q?NQ=3D=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48926e21-ddb1-4c35-dcc1-08dc20b6cf98 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2024 10:41:12.2059 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LtqeuRVR2IUxQBxpsFOhShzog/yY7EsI2tPlzHTu4+8D0zwG9lP5v+QJaCQGoBGo+s/y5KSVwoyb6zCUNH2JD8A/yNe31adIBuapjbBXOPE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0594 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=2406:e500:4440:2::616; envelope-from=jeeheng.sia@starfivetech.com; helo=CHN02-BJS-obe.outbound.protection.partner.outlook.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_PASS=-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: 1706524964747100001 Content-Type: text/plain; charset="utf-8" Introduced a 3-layer cache for the ARM virtual machine. Signed-off-by: Sia Jee Heng --- hw/arm/virt-acpi-build.c | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 17aeec7a6f..c57067cd63 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -426,6 +426,48 @@ build_iort(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) g_array_free(its_idmaps, true); } =20 +static void pptt_setup(GArray *table_data, BIOSLinker *linker, MachineStat= e *ms, + const char *oem_id, const char *oem_table_id) +{ + CPUCaches default_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + .type =3D DATA_CACHE, + .size =3D 64 * KiB, + .line_size =3D 64, + .associativity =3D 4, + .sets =3D 256, + .attributes =3D 0x02, + }, + .l1i_cache =3D &(CPUCacheInfo) { + .type =3D INSTRUCTION_CACHE, + .size =3D 64 * KiB, + .line_size =3D 64, + .associativity =3D 4, + .sets =3D 256, + .attributes =3D 0x04, + }, + .l2_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .size =3D 2048 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .sets =3D 4096, + .attributes =3D 0x0a, + }, + .l3_cache =3D &(CPUCacheInfo) { + .type =3D UNIFIED_CACHE, + .size =3D 4096 * KiB, + .line_size =3D 64, + .associativity =3D 8, + .sets =3D 8192, + .attributes =3D 0x0a, + }, + }; + + build_pptt(table_data, linker, ms, oem_id, oem_table_id, + &default_cache_info); +} + /* * Serial Port Console Redirection Table (SPCR) * Rev: 1.07 @@ -912,7 +954,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) =20 if (!vmc->no_cpu_topology) { acpi_add_table(table_offsets, tables_blob); - build_pptt(tables_blob, tables->linker, ms, + pptt_setup(tables_blob, tables->linker, ms, vms->oem_id, vms->oem_table_id); } =20 --=20 2.34.1