From patchwork Mon Jan 29 08:14:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13535160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CCCEC48285 for ; Mon, 29 Jan 2024 08:16:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUMnd-00037g-GZ; Mon, 29 Jan 2024 03:15:26 -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 1rUMnS-00036d-Az; Mon, 29 Jan 2024 03:15:17 -0500 Received: from mail-bjschn02on2061e.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::61e] 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 1rUMnG-0007by-N8; Mon, 29 Jan 2024 03:15:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=De4/mWmTR9ZpZ7i+SMGPPYOt3HjAfZiJ7nLZ+iHhzkSw58yVWSF13F+dU72nYUtH8RVrnnEyOhnMQOwYB1gm86qqCHk92ndPkf9itGmV4zq9ZmuzSYcyUHF8PmHpmLDBdW8t39uix47O36Fs45fqtTSmVIV5O8zjr0kIaVEI0AkBmpSxKAvzVyeSCF5pV41NLnfw1jX1JcbQ1gN1+wPBrrLtCejdXr7xDvbXignd+xz1xMuIQ/xOwXoFx+gXZNpWT1DAxhhmJ1yybWm6wBdaDyQSIVUUm69bExpIBGoI19XWcugB2IBhDalW5blcnaBa2HJpZ0BFi6DNdDAdAF6iVw== 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=cOK+QbeIBvZavTgQ44cMGtn8EZ+i/+q2X8/r7Te9k1w=; b=SYbBJIzL5bPQv1WbC5Xh4LEMZRQSxE+cu7ZEolJaSXwvQYkowsCYSAzUORkn9rT6xwHk95X0QyeGg3erJZPo44iafYDSfu5JfNfVspLIvVLgQfjJXDT4V3nhOzGja/n55Wu1XsD8kc9OMZM+58EriFHED4hmjDJt+k/091Ug242HJZ8SS4lF6TEHkSgOCzTNkFxfccJCkKaXXbw9Hl6/rFQF7PtHbMZ3ypzwt0tCWYs5X4kfaK/svtFuCpQ5cAOZzD+GOiI9dQHWRj+lnYrd9JzvCK8kaQoEanVKZWk3oJ4soFxXjbA/eD6qyZrL6USxWfjWg1KElsCH1BaqLPbIGQ== 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; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0721.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:1e::23) 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 08:14:46 +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 08:14:46 +0000 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: [RFC v1 1/3] hw/acpi/aml-build: Add cache structure table creation for PPTT table Date: Mon, 29 Jan 2024 00:14:21 -0800 Message-Id: <20240129081423.116615-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129081423.116615-1-jeeheng.sia@starfivetech.com> References: <20240129081423.116615-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: SHXPR01CA0017.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1b::26) 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_|BJSPR01MB0721:EE_ X-MS-Office365-Filtering-Correlation-Id: ccc0f81a-ef34-4614-29ef-08dc20a25aef X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: anNnbCYFk2lvQo1a+KPvhKSITDp6seaPwWv2Yxn8xial4R57ROKGUUlOgbb8gRBwAjtXtr/fgGvZwhI60h+PO2ATn7X4nsg9wcL+1J1hLBd/5cM7sgPEFbQX9gKSIeErbkYm2FAvfmIUX4mv/YfjnzwY/NkbDqUg4HpRBLFInUViTwuXq9cTbwrULpRYI+HIVTY2eziilkIyuZ77xdFSgNWVzTyzM+9lCnd290VwZPGHgP5CQ0KLYN7goz8rU6kskwvxWYrqpH8QtX1hA+Smj/z1TRuvquwbj4tf08xl1oxBa1DvU792I7Zdu5XDn0esMudO17Y3kCi0MUGWbnbN6Lgk6fU4LFIRhR4oQGllaRqClIFWYi69B84PkapFda/RzDaC/dC9wmijIy8XINY/sNz/r4BMFxyWK1ug0P7K0KVyMEF6dV/w5JbQLs8mQA6SocVNUapJ62Gr9Yd/KF7bAMVJ/NEvff8mvGDAOmXYuMWWBnt1Rjd25xMEu1+LeZGYOrSMzuFYhWucq1zlDaNxQP0L1nSrBTnxwTP9peCqlcdPf9LTbi6vnRJkC4oTsBZG 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)(136003)(396003)(366004)(346002)(39830400003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(41320700001)(38100700002)(2906002)(36756003)(41300700001)(83380400001)(1076003)(2616005)(6666004)(26005)(40160700002)(508600001)(52116002)(40180700001)(66476007)(66556008)(66946007)(38350700005)(8676002)(8936002)(4326008)(86362001)(7416002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eRhswpvqpSD/mUanzdnkACQQJlTnIkc78Muq3xXfA5BYzljSJHAjFRmML71OTxxN/D170nPwVlMG7sJzYECKGSoQaYRqQ+Lw3BIZlND4+YfE9kRffDWyO0POJqZW8oQUDzxyVDuVnP8cF5oi3B+spCcR21CHUGD0WjMRfFRFM0v/8mY04rHPY+usXGbmOyTyVSUE+MLytQDZ/geWN8joMroNsBMzSRcDCvbXTSMuyVJZ9WvtfMpPS7/qSfkDHsnoIG+M91OnOw6zcZ6EnAUigATpooozxQGJe0DSJgrGpOvI6JCzCeFIoW7UwGeTEzAwgNCF8mNGXIk4JP9w7j6AuShDrIyQyfT8CWVwz64VeQw1L7cZX17ZwORCAqOtMtWiPHjY6ROOZ4ENnN5i08htmGx1nFkDBO1hsTngygnolIlveO/mk+9nkMyUmaOepUH8U/Tg9ldrqYS7NqwPjauLUZGQYhma623MJ52HSaik/L9I/dy4xJwEMXCszNPp56dQgDqM5vq0mjGfEvUXizq4vZDgkixdQje9Xd5D34eTPj0It0GaBmGNLD0DbFil4lxs60dyNI8Iy6wARTHr7grY+OPDh98rS6DSP0zWJljKnRq+wBztTkkFLoKjGNG7g4V1zy9vgXVji2XQxOwXJ2prgYEnmIdp4xNZlnMqfoNXUUc78+pIfWdA+jd5+i/F7eJQUr1PBbZ5Y3H1jqGj91e5ktO5ZuHdsDHOk0tr4gg00Z4cJukjVCeZC9K1Nocyje9XIOnA73FDfs5Vt9GH9ZrqM24v/YHfmxaYCnYKyIByG2Ti6LjO9yT+CkthTDP/l7xgvH07BcMIxkP4V6ppE3kUX8ZXST4ojgKDZCPlinb96Fl9guTbk6mG80mm3ixfxMtiI0fHUUf85YlppMqxZG9W/fIJxmQnU6tVa3zgShoBE2zPItorSFg1mmWsAgUWYEixveH2l6e4huxw8OaHXQD8STvU/j7mV/nQcDFZde66E4e/XSvLKbSyLFN1FXIsqk5ZS9n90CCfo/ZMdHC/eD/NWDo5VUWTJ0ggB+GiFsSZADjfg9rFFb1E9THIclhq7odWE3BhuwO9+0bbHaOdTzPRZos13nevVghDovGn3jKClPDtzKP89dx6GxkPjOzEBo0QGtyuFNRdpr91nke60NBOfTw0M6yVVzT2rNkXrBCpvPvOTHV1hBuCkAJMsLcXdxnC+7y1hkXlQc3K8F+6Zz4TESwF1P4eFLV0F/PgPS2dYMkeaE8u/Qqj3YhSP/kc9yJ5LfUwkabUzGQFAzR1JkGtionIZfe6IkN9IWKz15/aCDGBkxkS50MFSKxbmXUtsOOmf7nengO/wVMGYzzOOTomb/Xc5i6G2xXTCEo267yrT5+wfYWRNqj/1K3evbpj2CIp+bLTFPbEW0zt/uzRRO6DYlxXjVnG3Pa34zqgYXa69oF8z7NItLIcMY1Hwa5oXaXXDD7GGcXthk3/l7xjyKKdFffy+oys0hcYIrRQCplnai6249Nqs/JuSqSHRZ7DTJschBq/Y7pgM5jDhjUhTgWRFBsC6vqgpJ5RcXLPUyZA4Fza406tYjwux7dGLiZVvMdhVqchbk4JVW2qSLFOL25QXA== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccc0f81a-ef34-4614-29ef-08dc20a25aef 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 08:14:46.5113 (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: jDpKBunIt8gKwRpZpYx6n5q3TNWYmc/JpB5LN6YSvFfQCbYzuEZ0ooz6m/pkAMXV+eSBAJQa54hdVt3bMeAZ6qqXFlAEZqUqRBb1C3hH/yo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0721 Received-SPF: pass client-ip=2406:e500:4440:2::61e; 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Adds cache structure table generation for the Processor Properties Topology Table (PPTT) to describe cache hierarchy information for ACPI guests. A 3-level cache topology is employed here, referring to the type 1 cache structure according to ACPI spec v6.3. The L1 cache and L2 cache are private resources for the core, while the L3 cache is the private resource for the cluster. In the absence of cluster values in the QEMU command, a 2-layer cache is expected. The default cache value should be passed in from the architecture code. Examples: 3-layer: -smp 4,sockets=1,clusters=2,cores=2,threads=1 2-layer: -smp 4,sockets=1,cores=2,threads=2 Signed-off-by: Sia Jee Heng --- hw/acpi/aml-build.c | 65 ++++++++++++++++++++++++++++++++++--- include/hw/acpi/aml-build.h | 26 ++++++++++++++- 2 files changed, 85 insertions(+), 6 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index af66bde0f5..416275fdcc 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1994,18 +1994,48 @@ static void build_processor_hierarchy_node(GArray *tbl, uint32_t flags, } } +/* ACPI spec, Revision 6.3 Cache type structure (Type 1) */ +static void build_cache_structure(GArray *tbl, + uint32_t next_level, + CPUCacheInfo *cache_info) +{ + /* 1 – Cache type structure */ + build_append_byte(tbl, 1); + /* Length */ + build_append_byte(tbl, 24); + /* Reserved */ + build_append_int_noprefix(tbl, 0, 2); + /* Flags */ + build_append_int_noprefix(tbl, 0x7f, 4); + /* Next level cache */ + build_append_int_noprefix(tbl, next_level, 4); + /* Size */ + build_append_int_noprefix(tbl, cache_info->size, 4); + /* Number of sets */ + build_append_int_noprefix(tbl, cache_info->sets, 4); + /* Associativity */ + build_append_byte(tbl, cache_info->associativity); + /* Attributes */ + build_append_byte(tbl, cache_info->attributes); + /* Line size */ + build_append_int_noprefix(tbl, cache_info->line_size, 2); +} + /* * 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) + const char *oem_id, const char *oem_table_id, + const CPUCaches *CPUCaches) { MachineClass *mc = MACHINE_GET_CLASS(ms); CPUArchIdList *cpus = ms->possible_cpus; int64_t socket_id = -1, cluster_id = -1, core_id = -1; uint32_t socket_offset = 0, cluster_offset = 0, core_offset = 0; uint32_t pptt_start = table_data->len; + uint32_t l3_offset = 0, priv_num = 0; + uint32_t priv_rsrc[3] = {0}; int n; AcpiTable table = { .sig = "PPTT", .rev = 2, .oem_id = oem_id, .oem_table_id = oem_table_id }; @@ -2024,10 +2054,11 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, socket_id = cpus->cpus[n].props.socket_id; cluster_id = -1; core_id = -1; + priv_num = 0; socket_offset = table_data->len - pptt_start; build_processor_hierarchy_node(table_data, (1 << 0), /* Physical package */ - 0, socket_id, NULL, 0); + 0, socket_id, NULL, priv_num); } if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) { @@ -2035,20 +2066,44 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, assert(cpus->cpus[n].props.cluster_id > cluster_id); cluster_id = cpus->cpus[n].props.cluster_id; core_id = -1; + priv_num = 0; + l3_offset = table_data->len - pptt_start; + /* L3 cache type structure */ + if (CPUCaches && CPUCaches->l3_cache) { + priv_num = 1; + build_cache_structure(table_data, 0, CPUCaches->l3_cache); + } cluster_offset = table_data->len - pptt_start; build_processor_hierarchy_node(table_data, (0 << 0), /* Not a physical package */ - socket_offset, cluster_id, NULL, 0); + socket_offset, cluster_id, &l3_offset, priv_num); } } else { cluster_offset = socket_offset; } + if (CPUCaches) { + /* L2 cache type structure */ + priv_rsrc[0] = table_data->len - pptt_start; + build_cache_structure(table_data, 0, CPUCaches->l2_cache); + + /* L1d cache type structure */ + priv_rsrc[1] = table_data->len - pptt_start; + build_cache_structure(table_data, priv_rsrc[0], + CPUCaches->l1d_cache); + + /* L1i cache type structure */ + priv_rsrc[2] = table_data->len - pptt_start; + build_cache_structure(table_data, priv_rsrc[0], + CPUCaches->l1i_cache); + + priv_num = 3; + } if (ms->smp.threads == 1) { build_processor_hierarchy_node(table_data, (1 << 1) | /* ACPI Processor ID valid */ (1 << 3), /* Node is a Leaf */ - cluster_offset, n, NULL, 0); + cluster_offset, n, priv_rsrc, priv_num); } else { if (cpus->cpus[n].props.core_id != core_id) { assert(cpus->cpus[n].props.core_id > core_id); @@ -2063,7 +2118,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, (1 << 1) | /* ACPI Processor ID valid */ (1 << 2) | /* Processor is a Thread */ (1 << 3), /* Node is a Leaf */ - core_offset, n, NULL, 0); + core_offset, n, priv_rsrc, priv_num); } } diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index ff2a310270..2dd949f41e 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -234,6 +234,29 @@ struct CrsRangeSet { GPtrArray *mem_64bit_ranges; } CrsRangeSet; +enum CacheType { + DATA_CACHE, + INSTRUCTION_CACHE, + UNIFIED_CACHE +}; + +typedef +struct CPUCacheInfo { + enum CacheType type; /* Cache Type*/ + uint32_t size; /* Size of the cache in bytes */ + uint32_t sets; /* Number of sets in the cache */ + uint8_t associativity; /* Cache associativity */ + uint8_t attributes; /* Cache attributes */ + uint16_t line_size; /* Line size in bytes */ +} CPUCacheInfo; + +typedef +struct CPUCaches { + CPUCacheInfo *l1d_cache; + CPUCacheInfo *l1i_cache; + CPUCacheInfo *l2_cache; + CPUCacheInfo *l3_cache; +} CPUCaches; /* * ACPI 5.0: 6.4.3.8.2 Serial Bus Connection Descriptors @@ -490,7 +513,8 @@ void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, const char *oem_id, const char *oem_table_id); void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, - const char *oem_id, const char *oem_table_id); + const char *oem_id, const char *oem_table_id, + const CPUCaches *CPUCaches); void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, const char *oem_id, const char *oem_table_id); From patchwork Mon Jan 29 08:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13535158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0BE3BC47422 for ; Mon, 29 Jan 2024 08:15:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUMni-00038j-Bh; Mon, 29 Jan 2024 03:15:30 -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 1rUMnc-00037l-BJ; Mon, 29 Jan 2024 03:15:25 -0500 Received: from mail-bjschn02on2061e.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::61e] 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 1rUMnU-0007by-TX; Mon, 29 Jan 2024 03:15:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EGpgg/2lM81m5z6gUINozqVgZswqRfp/VZzxtPb+dI02/a13EMFOzuh9nky79IOcVmJrTfwc1vv6Ouk9uCofYnTQIAMe7ZEHSewIO1s5s9YKvsiAo8LXzjAiK+XiLJ0NmnrFsCjFWzGJx9N8G1jRv92UIdbgrS6iakePmwrAOAz8P7upfaO9dKsREDm1iwjI0bDQ+gyJhuZjse2IOJJ54l2QJje3StYaqvNfYlk5zauJ+1yEn84GqPr9r2GlR4gZ8Z2woD7YLZW4Undeob7+1ctL2KFcjrzl87N25hzZdcfBLxilnWFjC4os2YFiSAtpkvoKly9QEbZ27BQE6ijehQ== 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=w7VCP15G1BvqWTdQRPP3FfBZvOzet9rpsAoH/InIbt8=; b=d8L/YazOB1UpuXAncQrSmQYJg83MLYzmsArIxQuuEFTx5ZUwQEwLYGxo1Akn4AzRnIund/U0uvrTqQa8see84DDPPs8Yimo9joNJfCpYnrkpPo19o12rjt7lqAr2GiwVXDpQ22FhpftQlZP4kW3MGUIwR+Ke9t2JbYcJXsCETIeGpVB3db3wH//IRZGjdicifiB8ZsAA6U55TwiOuX2QbNVjj/0nTyFdBFhyfP9YGR/0ngEOxP3+leqJXQyVlRzwrkYMDX1BhiNmYEEW17eSmp5yXMXsL4+tBRqBi30BNaZ6RKOLORcbH6Jhkfgwa/rQSJ2h+c/nSdt5AQzyq057nQ== 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; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0721.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:1e::23) 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 08:14:52 +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 08:14:52 +0000 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: [RFC v1 2/3] hw/riscv/virt-acpi-build.c: Generate PPTT table Date: Mon, 29 Jan 2024 00:14:22 -0800 Message-Id: <20240129081423.116615-3-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129081423.116615-1-jeeheng.sia@starfivetech.com> References: <20240129081423.116615-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: SHXPR01CA0017.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1b::26) 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_|BJSPR01MB0721:EE_ X-MS-Office365-Filtering-Correlation-Id: 947971c7-38d4-4226-b192-08dc20a25e95 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a1q03tYDLfiGcHFOKInCDsyyIrx7wJES32aqNmhfg9Y867n0rAHsbmj+ecvIPVB423XQPMWMBkcPh+tUW2xY0aaIlJfQs1NHdo5dvzzrGm0clRdRdNHaD7L8YQaWBbG+l8YLPYUbdpZITdtKtNySTL6HYvnsS/nzPO9MQUM9sHM4Cj5OW9qZFPnmsMlgtEMkVM4ORpJmuGzjd44Pgc0oqj8Y9786FMxS158KsMrsy1CXijn0JLjxdWVoWje/iYh2wXtP638UpWCMiNv/0he59J7odLhtPVK07tjueIAozrJCv2CyFTeUmJ/5v50326ajYG38MuXWzOjMmKjCgR/e5lSm6wvyDN+X6xHTgcy/ugKTVPIUTnu613ekhtz6zfyms2iPXN9lzFBPiU9nR9vU3GJ8cN1qyoR8FK3dGkQozyAKDcn7GI5ylJ4ec5aPVL+Iy2gKQXnNLadPFSWFXZpWthDgZOZGchx1es3AODlI9t07hDthiPM5YRH5SdKONjJgnTlBpOLVLG7KaoXjPe02fk5iRGyPE87e/KvNiI2gElXWcFI1ySpK4D+SPkxGRVru 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)(136003)(396003)(366004)(346002)(39830400003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(41320700001)(38100700002)(2906002)(36756003)(41300700001)(83380400001)(1076003)(2616005)(6666004)(26005)(40160700002)(508600001)(52116002)(40180700001)(66476007)(66556008)(66946007)(38350700005)(8676002)(8936002)(4326008)(86362001)(7416002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qzwHpw2XuV+5Kg5/TNp5uTCMwp5SVvY+bdUTwUhWwN8LnR2wk0Cwe8PXp9FSUTvTfaUUIZJogz0CMr3PXpPRXDU2NKQFSsWPCfBuG8VhsxhMESt0qihQWRHKJxeUlX00dEs/wWWebxBjwx43YbmVLNVe1NfH2aExwmrfQ0eL2cNXpulobWcbdPZ7IWAbN2BeBrfF/IxGfQyGAKJvCU0HV1qN/BnhJ3R8jfYnLi/qvXAB9+Z8sEtSNj5q+Sz7PZzy7xi6K7RtpJHnU3f/VTDoX1ztvPxnRsem3USLHSGLdhg49Aiqa7nDk5nhuwh5sdAchv5hLJPKb46YqgrYKme8UDdXC/FBaSO93buF+wdYxjVoqWaYQx2fKJp6AmDiWRxckwxF/lkW/jmxY/V5Gc4VXvSZ5MAodhBUo7v3B25f/8dDLrdyhqp32Kze0wPu2KJf1BulRwQRSVlF9EgmJ/quaadoGQZUlX5RLn3MdIi7XpnI19UVPF0JG2/dm9S0Niddz/k1XdByUdTz9B/T+V8SqEB4vNl9aVmfFOIzjdTyL1c66HROfcpy7ycPd4J8w5JRSfXugEt+4NfQ+UknLyIcOeKwk0Xsn90up65sYVbj7MBfuEc9Ftn/y6XAPCrKcYhS+oi9WMgfU9xk9aasX7L9KyyIIV5YA62oAfZREIgDBbqlG8IJ3fzFL6faRIpaoIjlQ96+Yye3SP1oORkcRR3wRntu6yLK4MMFZ9+1LThmbdr66ba8mBqqpGGhDaRNW+A+G/Yf8arTCaG1fEmDfxhqNzzYAl9C9MF2eqJFh+dRwyOy/is0fnXxaB+fvouLqxiihjbugPeca5Hsi2pz4qmkcyrDFEDgeTzxTPqI/16gXva8Z0V0Fs8h9+0Xsvc2THOsC8wdP2YrHu/cupMmanutwoO57gWJ1WMBesUhN62gfkodYGCU8XbbX0FN+t9vX+eg7O3qGzDRz9MA6WD4VpqFTtGdgtufJae3hAzKx/ux8XBLaqPTcbByJ3mLbE/gIuxtsk/6koqnTaShYxyTm+D81N1IIMeTmw9QDDvHHyLwaz3gYe6Tf+qwfJPGMHUSBt+9yyz1ZNu9ElxdLVSmZVHw6ehsc85UQOgchpW4UL7vBKWvNySB6Qm/rX3IzUw7jk3mMU8L/cLqja1j4slKd6UwCc8XBKkVKcWx9CftlAPMiY4wfqqV5i0qtc3qVo/vqR9JHaBU6ofSstRmgNPgrHPNyVJK8C7fX4HKV9qKq2NpHoK+ljauUcTextduLfSPLc623gXslJEJ79BJgz0Efy7MMiyqSSGo1Yikqxw0w3ganAZVAVvVLD+q6ZTARCOcl9Ggha5qyIWAZLCwiU/RDT48rPK4/QAXGNbQJErl5fC6ux/v+2REAov6BDA367DjqmrwHVDKyva2oJuMcAoKw+3k4tp8v6hZCw4o66ZVt85SLyFnzCIED7rpZUBJ6XqAA2uC9EhuELbqUa+YuDJCE0XvZycwbVSQUBsY6PA7HdoE5iD9hAoRPdcPuTJH495UsxjNqNrdVkJjM5Ea9pGMUFyOJAbe3f3RCpfDP78I1IZ/JlcMNH/ZeDrIJnbr68dzYH236FyjaKM+65xf4zWLt4VmEg== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 947971c7-38d4-4226-b192-08dc20a25e95 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 08:14:52.6273 (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: 2r3szqQr9txzb8Bf0SNtwhoBJ/YQdMnyNLm2WnPAqlWEIY7WgjylopA498tC/6LPs662aHiVq+e3Cdi8J6e7+dOmnV1031SZ+FrTpxuB6/s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0721 Received-SPF: pass client-ip=2406:e500:4440:2::61e; 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Generate the Processor Properties Topology Table (PPTT) with a cache type 1 structure for RISC-V virtual machine. A 3-layer cache topology is used. Signed-off-by: Sia Jee Heng --- hw/riscv/virt-acpi-build.c | 49 +++++++++++++++++++++++++++++++++++++- hw/riscv/virt.c | 1 + 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 26c7e4482d..d95ae1cf01 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -38,6 +38,7 @@ #include "migration/vmstate.h" #include "qapi/error.h" #include "qemu/error-report.h" +#include "qemu/units.h" #include "sysemu/reset.h" #define ACPI_BUILD_TABLE_SIZE 0x20000 @@ -528,12 +529,54 @@ static void build_madt(GArray *table_data, acpi_table_end(linker, &table); } +static void pptt_setup(GArray *table_data, BIOSLinker *linker, MachineState *ms, + const char *oem_id, const char *oem_table_id) +{ + CPUCaches default_cache_info = { + .l1d_cache = &(CPUCacheInfo) { + .type = DATA_CACHE, + .size = 64 * KiB, + .line_size = 64, + .associativity = 4, + .sets = 256, + .attributes = 0x02, + }, + .l1i_cache = &(CPUCacheInfo) { + .type = INSTRUCTION_CACHE, + .size = 64 * KiB, + .line_size = 64, + .associativity = 4, + .sets = 256, + .attributes = 0x04, + }, + .l2_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .size = 2048 * KiB, + .line_size = 64, + .associativity = 8, + .sets = 4096, + .attributes = 0x0a, + }, + .l3_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .size = 4096 * KiB, + .line_size = 64, + .associativity = 8, + .sets = 8192, + .attributes = 0x0a, + }, + }; + + build_pptt(table_data, linker, ms, oem_id, oem_table_id, + &default_cache_info); +} + static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables) { GArray *table_offsets; unsigned dsdt, xsdt; GArray *tables_blob = tables->table_data; - + MachineState *ms = MACHINE(s); table_offsets = g_array_new(false, true, sizeof(uint32_t)); @@ -555,6 +598,10 @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_rhct(tables_blob, tables->linker, s); + acpi_add_table(table_offsets, tables_blob); + pptt_setup(tables_blob, tables->linker, ms, + s->oem_id, s->oem_table_id); + acpi_add_table(table_offsets, tables_blob); { AcpiMcfgInfo mcfg = { diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index f9fd1341fc..a6f468fc22 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1710,6 +1710,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props; mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id; mc->numa_mem_supported = true; + mc->smp_props.clusters_supported = true; /* platform instead of architectural choice */ mc->cpu_cluster_has_numa_boundary = true; mc->default_ram_id = "riscv_virt_board.ram"; From patchwork Mon Jan 29 08:14:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sia Jee Heng X-Patchwork-Id: 13535159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF833C47DDB for ; Mon, 29 Jan 2024 08:16:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUMns-0003CN-15; Mon, 29 Jan 2024 03:15:40 -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 1rUMnk-0003BM-JG; Mon, 29 Jan 2024 03:15:34 -0500 Received: from mail-bjschn02on2061e.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::61e] 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 1rUMnf-0007by-Uf; Mon, 29 Jan 2024 03:15:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XqepDEcID2oV3/RGRRKW99FRmaxo3Td+Lqalwsa6P+wgL2RLyCV/xBGJGR6iXbczujt2wLoxO/6mr2GItm3wDz9hgGkaIxieamC1oXaKwIs1qn1FKRWu7VuJUbWWGjWBuirMPxNzJWz1hjJZoQUcn7kFJtR4rnvg2tmU+51RUUyviZrFOYw6U2eGzWJF3rZSDy+/REYVi/3YMj/x2bQhu/7piwI95bHQWSkiYKdE4/iaQCVkpfZAjdhuXMuXHna9dqMjHFEaghK5xutp401YvMSCuG3jlJxJPZjFrOv0q7AfuxwsnkgU/Q71woB9SfmPCqGq5QaO2wNIpQT3YZcbMA== 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=I00TGfGGubOIzaiJKhRLJEczm5DiAzwR+FzzAOyTeLfJvllLCUxodj0hijwvCQ1G2sVuP4agV+547q8oB7jGajUX+x6wTlo3Te1r8dhSl+SPiXn1/FCrNpjvOZeVUBYxgfrX5RTw0AnugtL11hDVTCS70xjLBLgBapuIoq9BnV1XTtnV5GLFKVczkQ7E9iMIjStlzO+6QAS/EoRIKqIIJ48xjJ5dR7GTn1xznpxALUlEleyuBSToUwq21TF5reRIYLm+LF+88DmwO1mFmaw/KJG/x1FiCX+CKrpLH3SHDCGhhUr8b9JxyDhiPiDTR6zYz104znunRrm4+XXIw/bwiA== 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; Received: from BJSPR01MB0561.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:f::16) by BJSPR01MB0721.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:1e::23) 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 08:14:59 +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 08:14:59 +0000 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: [RFC v1 3/3] hw/arm/virt-acpi-build.c: Enable CPU cache topology Date: Mon, 29 Jan 2024 00:14:23 -0800 Message-Id: <20240129081423.116615-4-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129081423.116615-1-jeeheng.sia@starfivetech.com> References: <20240129081423.116615-1-jeeheng.sia@starfivetech.com> X-ClientProxiedBy: SHXPR01CA0017.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1b::26) 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_|BJSPR01MB0721:EE_ X-MS-Office365-Filtering-Correlation-Id: cde75c6d-b413-469a-fbf1-08dc20a2625f X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FgcTrCQT1eCOJGqCXzXidFrd37XqKAN6RKxCpNNK858YxvAVKnOVCGl/v3PQ3Aix7L8rL1iGn7V+J1skuotXB4J2SIiRB68ZU6PSVbtSPz4XvBPgV28Jm36qIc1o1yi5jLodhXMu22w7Ggxof3OI2UTXf+u5hKdXt5cCzhuvLiKEWCHWdNFeNh1R8QLl/8HSBbmUlNKX57qr23+zOnNYLM9DKwp5QFkowOt1Xv0YObdFWlMbweJFDibfMoEKsgwRhERvzq0BP8QmkcoyXlNY4KsBD+8QeAtZAJuPXFI4DmiduYmdofKuq36qTSBsqsbEAkt90rJZcIT8+M2adlKMrNYSoYROCur84hLSXT6JAIzdXtoXYLRY9H5maTku0bqgnf9NfzjfYJopB1MvJ0eNMIHBIAYDJq9Kno2mCWYXKsRqPEeT5E+WSF7m0fWaTWM+jxyGj82MWHb5hg6HgzBp0tzWlOq1W0ggfiWt707ev4/lUwtdWeORae0Y3dRJaa8DtCltpvQPllD+EwK23+/URXVSDHXIZSNPUjoqnBex98eoBCCgUYZosZ3Wgu7TJ16r 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)(136003)(396003)(366004)(346002)(39830400003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(41320700001)(38100700002)(2906002)(36756003)(41300700001)(83380400001)(1076003)(2616005)(6666004)(26005)(40160700002)(508600001)(52116002)(40180700001)(66476007)(66556008)(66946007)(38350700005)(8676002)(8936002)(4326008)(86362001)(7416002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 51edytD3pZwKY2ezuGfw1ivCNC/WPfbagImVcZHjiKOveq0KFZKQt1RpEhEGLK08qZfEUBTyCTW7RQWwcqRy2olSPIPKcs2LhHetU56dkZqGhIAB+p+IMxAYPlj3Of75LqH+1Wh2Z03ebSau8LlVva1kiUdEuDSkwQA4dLlYVo+Iyazn8mIhIDmQCjwDk9UNGK+Uwxhx/rR9zg7KNY0Ag5WnKSMAUHWuO+vJXXAHPguemNRPxh+T+u/ifiNo4N/6XtyZw4ioYOW8C2L+5uqNL8MYqFttfH+w9BQInUzTT82Q3m0mJD7PGOZdOGFH1xTEcqs6UAZNDykduzr7g+XxVYsicqUFT0PojXfhG25z5bXVm/hWNRyldK43e4d0Ly32VQJobO+yqULyi4qUUfjRrja+XNEYE/b4791qpOoGXrjQ2vxj+PXfMT4veqXM+U/CJa2je0D5dcKSUb/ste03kxFA4vXbctcLGqAO6fZF+paYPcqrO5MH4q7XuhjUAhGJzAP+Yp5XyKNFEHaRNMHqKqMlY5OTIKijfPqTHWuXkPbDprWo4if6omJUe2KdA/+Ggw4letgpryhbe+m6Fdi6XhUsdcEUaKaGX3gQVgN1v444kiiC+Px8o81QKPB+eIHM1B+YXak0GOJliJAeV1PN5PpXCOJmcAKIPd6rPdNUFkidy+av+SnBTo4zQsLWOG5QPOHu1nY6wBreal1FVXGiQ+yZDHytLzyIB7Qz4oGwIAyKEFNrTzjwi5PnxaIa7jRNrf8zaUf2JOGtFqQAkUPvvPuDWFQdJjacS9IY6MmSk6dlcttoEGpMkgeiCzlmMgbSjvd8fl228lQwGli4T4QP+9V5HP5EU3e30ifBuWtYMaN8K6HTLs839F7AXv09iQFPm+y3VFyF9SCrUeWrYDDbvLSulRXC5E852DTvAyGRiazjWbbOk52jBelLUkf2xVZey9yy1Ukd0dx/g9oL385rv4bLiOcSj0OIK2qzwFpbExjk/KzuVhWzywi3wT9iyZNvY5vTezKDme+Gre+ttUlupT1NGB3WrF2Wfe+d1Gheu+2+DnlUMZf6t8xXeEkIUgXFdF3fG+bAkohUKLpWHXrrWXM4s7oqfNxlxUpefqZG3qVktb3qMcyihBOuW4k0cnMonf6X4CaIhFcZW+r8753hQSL+lFa4/deHDpBKYzPIIQpdZEWo1vTqsXqe5kikIcehtytOGjCtU9luP5wN/yIYtPyqwSOhNStbFzYpnKnePSS4yjQy5IzMRXrYRKHIRidKU4zJrGow4sbKjRs2Oanj7TGZjzDO5hMAX2U2YuvBMFR8fviubWPRYe6Z6i3kyU1Xhnn1cx/KtzyYVelMzviL1PU9osvUXQqzVIt2I/ul7xacvVRHBRH/KXmxi6AmbrC6WMMtJnaUXAjQ2w/4v2/i5BjqH3wfYN/RZ+EAfq3YVV6YK+OlgaaGZGppmfNQEnR5q8vW9x/1MGhOcAY5+Z5Ntx4D+jpRLXKnSjwdWp5OVTjSpBjFCUKRhLWiKiqUMpKzqsrafXwvONc8lzeTVMrOUOeULJtj88kE1k5yXcA0QBJO0qQNgvnW0pTUKfNBbxisesKVISm5ve1idH9LGJdrPw== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: cde75c6d-b413-469a-fbf1-08dc20a2625f 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 08:14:59.0720 (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: RZlBnJB/xXTSDU51CdTDCMLS3v7ZoZCBsQPFWigTnmmCyfWoxYi2w3/EN+1RPFczRu9RDxElvMmCNHBO+WhvX8OsTI5EGDFVeGSOlhGa1ZI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0721 Received-SPF: pass client-ip=2406:e500:4440:2::61e; 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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, VirtMachineState *vms) g_array_free(its_idmaps, true); } +static void pptt_setup(GArray *table_data, BIOSLinker *linker, MachineState *ms, + const char *oem_id, const char *oem_table_id) +{ + CPUCaches default_cache_info = { + .l1d_cache = &(CPUCacheInfo) { + .type = DATA_CACHE, + .size = 64 * KiB, + .line_size = 64, + .associativity = 4, + .sets = 256, + .attributes = 0x02, + }, + .l1i_cache = &(CPUCacheInfo) { + .type = INSTRUCTION_CACHE, + .size = 64 * KiB, + .line_size = 64, + .associativity = 4, + .sets = 256, + .attributes = 0x04, + }, + .l2_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .size = 2048 * KiB, + .line_size = 64, + .associativity = 8, + .sets = 4096, + .attributes = 0x0a, + }, + .l3_cache = &(CPUCacheInfo) { + .type = UNIFIED_CACHE, + .size = 4096 * KiB, + .line_size = 64, + .associativity = 8, + .sets = 8192, + .attributes = 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, AcpiBuildTables *tables) 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); }