From nobody Thu Nov 14 06:54:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1704877529; cv=none; d=zohomail.com; s=zohoarc; b=Xxft+xquUQRcxdY87CssP7ZjzXAhlFcGzrBe8bmEgFKAr3QEVcbXSAfq7IvBhUUH3vs91znQwLuDT6froOJVSl3nPKlvzXMN4eqh0Rn1YaAxPk7s4YANIe+ldPnCgYXbV0ZVCdste0bumXybh6/qb54zmkCwJ9tpzznekb+ope0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704877529; h=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=JZ9bTXqBkt19QVg+ZuwHJJdo6BuQnwqCbGwnr4DsUlg=; b=VTc556OukZGY27AtAFz4ylcxl9mUhectgbdjtZbesTW1aABpH52qxQhYKBlgB3AUFtQoTDNOPDc2Eud9DpEuZuKf6ahDfOJj3xNIMrL2F1mP51dhi7Hd+hhfrGUqbrNQ/OZtlImaBb9X7nygWOTJ8hR8gTdxQ27zmhhP9ruNCq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1704877529059935.8744117088048; Wed, 10 Jan 2024 01:05:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNUQV-0003Ou-O6; Wed, 10 Jan 2024 03:59:07 -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 1rNUQS-0003FD-It for qemu-devel@nongnu.org; Wed, 10 Jan 2024 03:59:05 -0500 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNUQQ-0003tV-0d for qemu-devel@nongnu.org; Wed, 10 Jan 2024 03:59:04 -0500 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3bbbd4d2b4aso3426600b6e.0 for ; Wed, 10 Jan 2024 00:59:01 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id t65-20020a628144000000b006d9879ba6besm3223814pfd.170.2024.01.10.00.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 00:59:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704877140; x=1705481940; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JZ9bTXqBkt19QVg+ZuwHJJdo6BuQnwqCbGwnr4DsUlg=; b=FoLQg7Z4HMzph4YUSLzYgiJehwsfEib581whxtPjmCTx3bfSARFvD5iljDFrXOhr/D v4AULGBdcwE8voa3fN5IFCaqLVYKe9V+qMh2RIdCW7qgoiINrud2aewwVw16N/uCf2jD 0l96jFp0RsH9xEmi5+zipqCVbhV7AdddWqPbztSRktRoM0oWGbkrH30H6W6uFt2M399q NsQ3YCoslMHKoJwmMf/DIswWkW0WOiT8umBiP9sFDxC5gAF2Iu771QtcXRgsOj/p9GRm 5Ifuka4ch2EQxd/sO/SCtny2adA1zboIwzaKWN/G96sFXuRyPsAW6qUQnmcdRXBj4PIY K+3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704877140; x=1705481940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JZ9bTXqBkt19QVg+ZuwHJJdo6BuQnwqCbGwnr4DsUlg=; b=OqoUsTYymD6vPiP9g+nnMbGOJcO2WXEwBBSwTdWiILQ0DkRCEslQ0GdPDpnodmkUmK hn9LkBTe2/CPIgEvdjSFe1YjRTs0GVMVDWfnfpAtPI+uJ3GNHUFgoApk5OKGbxPhBr9x oY2exJvUzW1jkaLUIlQ6ibfUk9FdrJtiVrkCbsOhYyOp8/ZJY37Z1+nMd+UMH2Nc5ssl KFw5wsD850ioM1dhaNPn0dheE3FXV2qzewe0Dq4RnA1KjjHp8RMM5UpmKUjsQiAMySQC /B/AzHOVet6VbEVVjkmOYudAJIBVWnQIuRpBGW0memjgxUl7bqngZijezDDcKdNJ+t3W ftAQ== X-Gm-Message-State: AOJu0YzlMjH2a5SEMCM9xdqaHJntIDRbk0bqjS3q3cTPaRAy5H4XALpU jZUOe9FPN75PfXwgzJg/jlxNGVCcLNilQzN2 X-Google-Smtp-Source: AGHT+IENk885248/ua4IBvdal9k7K57prMmQdnQW4RryE7I2i2AwGIe96jY+ExMgTaXVd+GbLwgAdw== X-Received: by 2002:a05:6358:9043:b0:172:f78c:137c with SMTP id f3-20020a056358904300b00172f78c137cmr687935rwf.8.1704877140691; Wed, 10 Jan 2024 00:59:00 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Sunil V L , Daniel Henrique Barboza , Andrew Jones , Alistair Francis , "Michael S . Tsirkin" Subject: [PULL 20/65] hw/riscv/virt-acpi-build.c: Add MMU node in RHCT Date: Wed, 10 Jan 2024 18:56:48 +1000 Message-ID: <20240110085733.1607526-21-alistair.francis@wdc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240110085733.1607526-1-alistair.francis@wdc.com> References: <20240110085733.1607526-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::22c; envelope-from=alistair23@gmail.com; helo=mail-oi1-x22c.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1704877530270100005 Content-Type: text/plain; charset="utf-8" From: Sunil V L MMU type information is available via MMU node in RHCT. Add this node in RHCT. Signed-off-by: Sunil V L Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Acked-by: Alistair Francis Acked-by: Michael S. Tsirkin Message-ID: <20231218150247.466427-10-sunilvl@ventanamicro.com> Signed-off-by: Alistair Francis --- hw/riscv/virt-acpi-build.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 784bbffead..b7db57b28a 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -152,6 +152,8 @@ static void build_rhct(GArray *table_data, size_t len, aligned_len; uint32_t isa_offset, num_rhct_nodes, cmo_offset =3D 0; RISCVCPU *cpu =3D &s->soc[0].harts[0]; + uint32_t mmu_offset =3D 0; + uint8_t satp_mode_max; char *isa; =20 AcpiTable table =3D { .sig =3D "RHCT", .rev =3D 1, .oem_id =3D s->oem_= id, @@ -171,6 +173,10 @@ static void build_rhct(GArray *table_data, num_rhct_nodes++; } =20 + if (cpu->cfg.satp_mode.supported !=3D 0) { + num_rhct_nodes++; + } + /* Number of RHCT nodes*/ build_append_int_noprefix(table_data, num_rhct_nodes, 4); =20 @@ -226,6 +232,26 @@ static void build_rhct(GArray *table_data, } } =20 + /* MMU node structure */ + if (cpu->cfg.satp_mode.supported !=3D 0) { + satp_mode_max =3D satp_mode_max_from_map(cpu->cfg.satp_mode.map); + mmu_offset =3D table_data->len - table.table_offset; + build_append_int_noprefix(table_data, 2, 2); /* Type */ + build_append_int_noprefix(table_data, 8, 2); /* Length */ + build_append_int_noprefix(table_data, 0x1, 2); /* Revision */ + build_append_int_noprefix(table_data, 0, 1); /* Reserved */ + /* MMU Type */ + if (satp_mode_max =3D=3D VM_1_10_SV57) { + build_append_int_noprefix(table_data, 2, 1); /* Sv57 */ + } else if (satp_mode_max =3D=3D VM_1_10_SV48) { + build_append_int_noprefix(table_data, 1, 1); /* Sv48 */ + } else if (satp_mode_max =3D=3D VM_1_10_SV39) { + build_append_int_noprefix(table_data, 0, 1); /* Sv39 */ + } else { + assert(1); + } + } + /* Hart Info Node */ for (int i =3D 0; i < arch_ids->len; i++) { len =3D 16; @@ -238,17 +264,25 @@ static void build_rhct(GArray *table_data, num_offsets++; } =20 + if (mmu_offset) { + len +=3D 4; + num_offsets++; + } + build_append_int_noprefix(table_data, len, 2); build_append_int_noprefix(table_data, 0x1, 2); /* Revision */ /* Number of offsets */ build_append_int_noprefix(table_data, num_offsets, 2); build_append_int_noprefix(table_data, i, 4); /* ACPI Processor U= ID */ - /* Offsets */ build_append_int_noprefix(table_data, isa_offset, 4); if (cmo_offset) { build_append_int_noprefix(table_data, cmo_offset, 4); } + + if (mmu_offset) { + build_append_int_noprefix(table_data, mmu_offset, 4); + } } =20 acpi_table_end(linker, &table); --=20 2.43.0