From patchwork Mon Jul 31 22:09:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilly Anderson X-Patchwork-Id: 1815278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=anarchist.gay header.i=@anarchist.gay header.a=rsa-sha256 header.s=mail header.b=R26aK2pH; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFCRc6ZJwz20G3 for ; Tue, 1 Aug 2023 08:22:50 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQbGo-0006uR-5m; Mon, 31 Jul 2023 18:21:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQb5s-0005jK-7Q; Mon, 31 Jul 2023 18:10:24 -0400 Received: from box.anarchist.gay ([178.62.216.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQb5q-00023m-E9; Mon, 31 Jul 2023 18:10:23 -0400 Received: from authenticated-user (box.anarchist.gay [178.62.216.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.anarchist.gay (Postfix) with ESMTPSA id 9E8D97EA91; Mon, 31 Jul 2023 18:10:19 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=anarchist.gay; s=mail; t=1690841420; bh=BE3TpyORXTw1UsQ1yvio3SF6Xv3TxE6hxvtplIC1q24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R26aK2pHRwmtmvYmn/EJ4gqWxL+zNlFIIQo4sBXRuVqGNrXx8fBaaCTM3WTby8Y9g R3tSyNmychKbrrvbkI1FuVtoFUH3MOKU+flVOm0Xc8/4RmWmUfyL0GdEkykLDU7ASt R+id1PMgpDxQgk+rNu24JixpW1wr3AwgRwGtbpfDzLeWHvcfnaXw4rsFxcbBNJW5zn t6KhlWr+SpGsv/AHiRJ225qnhC/DX9J/efHeyYeG7gqPjNZQ7VoFfpPLNULMdTnS3M /du4fvy6XY1cRGm+V7IVMj6LY6CYDmX6KqIh/6N5Xi2GolqlOcvqfh1KADsdlYtVmh +OcoD7SpMegrg== From: Lilly Anderson To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Lilly Anderson , Sunil V L , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PATCH 1/1] Added support for the MMU node in the RHCT Date: Mon, 31 Jul 2023 18:09:59 -0400 Message-ID: <20230731220959.4142636-2-fermium@anarchist.gay> In-Reply-To: <20230731220959.4142636-1-fermium@anarchist.gay> References: <20230731220959.4142636-1-fermium@anarchist.gay> MIME-Version: 1.0 Received-SPF: pass client-ip=178.62.216.29; envelope-from=fermium@anarchist.gay; helo=box.anarchist.gay X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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-Mailman-Approved-At: Mon, 31 Jul 2023 18:21:39 -0400 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- hw/riscv/virt-acpi-build.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 7331248f59..cb36e52169 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -119,7 +119,8 @@ static void acpi_dsdt_add_fw_cfg(Aml *scope, const MemMapEntry *fw_cfg_memmap) /* * ACPI spec, Revision 6.5+ * 5.2.36 RISC-V Hart Capabilities Table (RHCT) - * REF: https://github.com/riscv-non-isa/riscv-acpi/issues/16 + * REF: https://github.com/riscv-non-isa/riscv-acpi/issues/18 + * https://drive.google.com/file/d/1sKbOa8m1UZw1JkquZYe3F1zQBN1xXsaf/view * https://drive.google.com/file/d/1nP3nFiH4jkPMp6COOxP6123DCZKR-tia/view */ static void build_rhct(GArray *table_data, @@ -133,6 +134,7 @@ static void build_rhct(GArray *table_data, uint32_t isa_offset, num_rhct_nodes; RISCVCPU *cpu; char *isa; + uint8_t mmu_type; AcpiTable table = { .sig = "RHCT", .rev = 1, .oem_id = s->oem_id, .oem_table_id = s->oem_table_id }; @@ -145,8 +147,8 @@ static void build_rhct(GArray *table_data, build_append_int_noprefix(table_data, RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, 8); - /* ISA + N hart info */ - num_rhct_nodes = 1 + ms->smp.cpus; + /* ISA + MMU + N hart info */ + num_rhct_nodes = 2 + ms->smp.cpus; /* Number of RHCT nodes*/ build_append_int_noprefix(table_data, num_rhct_nodes, 4); @@ -174,6 +176,15 @@ static void build_rhct(GArray *table_data, build_append_int_noprefix(table_data, 0x0, 1); /* Optional Padding */ } + /* MMU Node */ + build_append_int_noprefix(table_data, 2, 2); /* Type 2 */ + build_append_int_noprefix(table_data, 8, 2); /* Length */ + build_append_int_noprefix(table_data, 1, 2); /* Revision */ + build_append_int_noprefix(table_data, 0, 1); /* Reserved */ + + mmu_type = satp_mode_max_from_map(riscv_cpu_cfg(&cpu->env)->satp_mode.map) - 8; + build_append_int_noprefix(table_data, mmu_type, 1); /* MMU Type */ + /* Hart Info Node */ for (int i = 0; i < arch_ids->len; i++) { build_append_int_noprefix(table_data, 0xFFFF, 2); /* Type */