From nobody Wed Nov 27 14:37:18 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 ARC-Seal: i=1; a=rsa-sha256; t=1698672145; cv=none; d=zohomail.com; s=zohoarc; b=nSbhI1Zt3NHSBBcIfwGt+tolnsvkjz2MRqwnzn9pBp1C+zdSbQFUNPl23ck8v6cEAlRri/h7qpqcLxRwhj9cAlQ+MyRz9m177YGHxeVrd/6jnvvNuppj591RQo1YoauhZsccwgyIY8nHgtI9KpmPxPdsGIsVETTgwou7hjjrTNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698672145; 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=KMqId8zOyBROAfCr/ApxNc76H4ky9nZ2QMykSoL/rsY=; b=iS3UCDHBVXw3NJpCRGbgjZP4uzKfZocQ5VdSpCqNqsuvKi5Ba3EHHnAqNXxulvBspcRxrNRdj7WgzHffn+dF1eIjOyTpzHSpi3jj5Y0Kdah+8Gm81bzoevBNTsaVhGH2vTJAOthFhjTDWhr30DgG5fPlt4txKOmmQhHRNzlkYiQ= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698672145274494.52670840733106; Mon, 30 Oct 2023 06:22:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxSDi-0007U9-PA; Mon, 30 Oct 2023 09:22:18 -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 1qxSDb-0007Kb-DC for qemu-devel@nongnu.org; Mon, 30 Oct 2023 09:22:11 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxSDV-0002wh-6J for qemu-devel@nongnu.org; Mon, 30 Oct 2023 09:22:09 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5b7f3f470a9so2785317a12.0 for ; Mon, 30 Oct 2023 06:22:03 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.188.78]) by smtp.gmail.com with ESMTPSA id 15-20020a17090a000f00b0027ced921e80sm8122412pja.38.2023.10.30.06.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 06:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1698672123; x=1699276923; 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=KMqId8zOyBROAfCr/ApxNc76H4ky9nZ2QMykSoL/rsY=; b=K8hSxs2adzuioHyQUmz3x01DYknUu/V+uO0xt66icezh/TPkwEdTYmOD06OHOndqmG E2vGfrbR2qHe+GouMnCLUBbvKqbtxkB+OdCJvO/LBW3jbSOfEESXt2a3zSK0uP2m7QGO yE4zXvoUqdzO3ywmFWUmCkY70puJMGF3f0y9D0jU/e1nWqH0lDxNl4lwHxvGq91ZkVnW MY1D7QUXh7R+MpvoKKcQoL/Ew/QwQrjZyB6Z2aC35eRCLBoSAsXHgVzQGH27TVVoB4S4 JESYu6R1JMKingqIU1xxfTJ1XzvBZZPgy7xITuq5LoBm8SI3QrilQtkgEc7R5Z/BhH7j XAVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698672123; x=1699276923; 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=KMqId8zOyBROAfCr/ApxNc76H4ky9nZ2QMykSoL/rsY=; b=vTGAkmUzOcGrm0Mk7AgNKKKoaOEAjLRin6YBS/glTX5a+WHyxycOzCT8Aj3LFr6mUu QDhuI8PpgMP5eawFejftiJV7zeL1nwKY9ZavBVGQODheuyrQLva8L/EEAnRcQ3I9lJSX sKNAjzl130plLIW46rjXsshyKZNHGv6UR7LTsP0m2bGQZwBSYljEsj4HrugMdLWAA8kC 3BngSLk/3v8pzZ9uLSJ1664OBvqb7DJHhkNM7i6GuI1rXELVh2ZsrXQklR1IRX7xGLbi G7CUrGcydGADKILyUMi52+X2vjlAeZP86r6k5JYNVlxAomj7/ZM1qnD6cjUGhpHS1eSn uUVQ== X-Gm-Message-State: AOJu0Yw1BFFAm6AWeNsKkeQacwRQsmWlO7CyiNkePQkRhJ57QqhK258x oAcFrz0JDlEbOFQeeqo/OOWfXQ== X-Google-Smtp-Source: AGHT+IFOiulnjgN0kd/fyC1foDXEvjOurWfnQyH2RfEyEK/ZsXeI8o1Bm8bcLDOhbxM65z2GlhKrEw== X-Received: by 2002:a17:90a:ff17:b0:280:53b2:4b9f with SMTP id ce23-20020a17090aff1700b0028053b24b9fmr1914561pjb.20.1698672123012; Mon, 30 Oct 2023 06:22:03 -0700 (PDT) From: Sunil V L To: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Peter Maydell , Shannon Zhao , "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Anup Patel , Atish Kumar Patra , Haibo Xu , Sunil V L , Andrew Jones Subject: [PATCH v5 09/13] hw/riscv/virt-acpi-build.c: Add MMU node in RHCT Date: Mon, 30 Oct 2023 18:50:54 +0530 Message-Id: <20231030132058.763556-10-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231030132058.763556-1-sunilvl@ventanamicro.com> References: <20231030132058.763556-1-sunilvl@ventanamicro.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::535; envelope-from=sunilvl@ventanamicro.com; helo=mail-pg1-x535.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @ventanamicro.com) X-ZM-MESSAGEID: 1698672146510100001 Content-Type: text/plain; charset="utf-8" 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 --- 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 506d487ede..86c38f7c2b 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.39.2