From patchwork Mon Jan 30 18:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 50415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2332851wrn; Mon, 30 Jan 2023 10:30:55 -0800 (PST) X-Google-Smtp-Source: AK7set9FaFRM+R/6qiUhjNbH2EYHK9rHfcFyXjqW9+qI9ly1Ryl8AOaSt31rNzNxhW9wMFUbny+3 X-Received: by 2002:aa7:9011:0:b0:593:903a:17fd with SMTP id m17-20020aa79011000000b00593903a17fdmr8392028pfo.0.1675103455006; Mon, 30 Jan 2023 10:30:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675103454; cv=none; d=google.com; s=arc-20160816; b=zxyTBO4tE+rO/Fj/AbhsRhaFdc7pnsL9zT6xJwfcLmoTkP19tEm4OhxnTijBJ2uOca vlwKsrp03jfYuxAOy4JzQVeeZ2I+IJHlZPVMgMD73m82iMPEE/xTBIJMCYMjSakqOeVL +waltNGwUI3b8+7NX01CNuGRvfkXFX2aBvvp2eCVj+NBAZjnR34bLiEtjnXeci27y8TC aSZw8Cun07QBHhVClEAGlHcHWprN6ugho/xEf8nPs1m6qFzWCHV5ATVU37rlVF/ALkNP zw4bHgG37Xjgv/bRgvuXwXVeJAzxvfDq29nheC6vGEKtvIrMo1FFIxZOwASzyqFqw3tW llUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nLT6YVjIMhggeUGxbDKRIEVD6SSgY7IRMPNBstFbaBA=; b=Tul+fiLUKSIyuW0IR7qnFEJjOUJnFT+4KzVSGhNDRm2JxDnVoMG/MxU0me8HQ9/zvB KWpYV0YQlp9IEGDmsh682GxedK7g170fvZk/D9AHdv+EC0URhWYpJs5JUjmoB1Vg0il7 TsXef2JRhvZpWNXP0CE7IYCrZBacUBBo0hQcxaEFRJ+svd6h1fK8MHan6FRMdqDDoxul Vuqd8W34+szulS2Sj2SztwhOKIC4/FiVUWQ3bK4NTxqlcAD/RLB+rZYmLHR08E1LxZcQ orNrpx5Zl8uKzsebYvCIMA5mE2EpGyUFB9spMIait6tKU+A48AjKMpEo24l7XA+q8bvO TDZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=M1QDDILc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v66-20020a626145000000b0058e23ca0d55si13197375pfb.248.2023.01.30.10.30.40; Mon, 30 Jan 2023 10:30:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=M1QDDILc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238162AbjA3S0S (ORCPT + 99 others); Mon, 30 Jan 2023 13:26:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238123AbjA3SZm (ORCPT ); Mon, 30 Jan 2023 13:25:42 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB1846717 for ; Mon, 30 Jan 2023 10:24:08 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id r8so5688699pls.2 for ; Mon, 30 Jan 2023 10:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=nLT6YVjIMhggeUGxbDKRIEVD6SSgY7IRMPNBstFbaBA=; b=M1QDDILcAog1w3pkeRDILsJlkHNAkEovkLKmqgFMVaps8Cs6u32gIaQ4jXpF54kr3e /idr6inoUm4ymQXW925LUn0a+drjUAueo6ZnYTxeP51jwjtrT7UYHw0Ewrj0wRhh9278 zJBen3mN417wHhDdSuG8+HATLZq/PCHVZq4vgxFEPai5RppQWR+MM9RJ6ZD1TT6LsDbJ juLg2Rm+I0D4+woO6y3c3YPydLtB1urRROE06sSTT9am5BMtM36Se7kFFl/AVmbPaO3N BCmm+TruD8JNnHLfSHQXgtSZmcRtMxuvikBSlSRSCep3yX3boFA5NpgbHpJt9Z1XdzGa wKkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=nLT6YVjIMhggeUGxbDKRIEVD6SSgY7IRMPNBstFbaBA=; b=saH5T6SwwOXtevw8d5kizhwIb0Hb7EdoB38Ln7dewbz1ggxPVTEah1ASI/vOUsTnLB VTaXZupKCLucoFd7RE2Uyp3iEDQSESdYc7MnIsGywzykSo+M5gjWu9nN517eLOeHttta avRGr+60reXWRJADqdhkg9m81K92VoPJXBFbvGzitIoqAU8P7MBlAke+pxwT5nP+clmK YC28p3WjsehTNc4TK2KL7PJcHFpIw1meFRaq2DVg5D4tl6XUvBZwXVyA8pkGcuuZAvzw /kXXmaP/4EgczBTgEPFGgICgM/D/U23C8v2mB/TY+qJYLMwJzfpQ5+n4laZvjpT1/jj/ Cgrg== X-Gm-Message-State: AO0yUKUoF5OeAMkAK5U+zIaG4SBMlUIwaQbrSLMAgLZQMF7lFOo4Hf0f SCYn7tCUBQyDTYHEsIQUHPLx9g== X-Received: by 2002:a05:6a21:789a:b0:be:9fff:48d8 with SMTP id bf26-20020a056a21789a00b000be9fff48d8mr2772632pzc.49.1675103045999; Mon, 30 Jan 2023 10:24:05 -0800 (PST) Received: from kerodipc.Dlink ([49.206.9.96]) by smtp.gmail.com with ESMTPSA id j193-20020a638bca000000b00478162d9923sm7000291pge.13.2023.01.30.10.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 10:24:05 -0800 (PST) From: Sunil V L To: Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Thomas Gleixner , Marc Zyngier , Daniel Lezcano , Jonathan Corbet Cc: linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Anup Patel , Andrew Jones , Atish Patra , Sunil V L Subject: [PATCH 20/24] RISC-V: ACPI: cpu: Enable cpuinfo for ACPI systems Date: Mon, 30 Jan 2023 23:52:21 +0530 Message-Id: <20230130182225.2471414-21-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20230130182225.2471414-1-sunilvl@ventanamicro.com> References: <20230130182225.2471414-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756473280664917954?= X-GMAIL-MSGID: =?utf-8?q?1756473280664917954?= On ACPI based platforms, few details like ISA need to be read from the ACPI table. Enable cpuinfo on ACPI based systems. Signed-off-by: Sunil V L --- arch/riscv/kernel/cpu.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 1b9a5a66e55a..bd6c0fcfe4ce 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -3,6 +3,7 @@ * Copyright (C) 2012 Regents of the University of California */ +#include #include #include #include @@ -256,26 +257,47 @@ static void c_stop(struct seq_file *m, void *v) { } +#ifdef CONFIG_ACPI +void acpi_print_hart_info(struct seq_file *m, + unsigned long cpu) +{ + const char *isa; + + if (!acpi_get_riscv_isa(NULL, get_acpi_id_for_cpu(cpu), &isa)) + print_isa(m, isa); + +} +#endif + static int c_show(struct seq_file *m, void *v) { unsigned long cpu_id = (unsigned long)v - 1; - struct device_node *node = of_get_cpu_node(cpu_id, NULL); struct riscv_cpuinfo *ci = per_cpu_ptr(&riscv_cpuinfo, cpu_id); + struct device_node *node; const char *compat, *isa; seq_printf(m, "processor\t: %lu\n", cpu_id); seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hartid_map(cpu_id)); - if (!of_property_read_string(node, "riscv,isa", &isa)) - print_isa(m, isa); + + if (acpi_disabled) { + node = of_get_cpu_node(cpu_id, NULL); + if (!of_property_read_string(node, "riscv,isa", &isa)) + print_isa(m, isa); + if (!of_property_read_string(node, "compatible", &compat) + && strcmp(compat, "riscv")) + seq_printf(m, "uarch\t\t: %s\n", compat); + of_node_put(node); + } +#ifdef CONFIG_ACPI + else + acpi_print_hart_info(m, cpu_id); +#endif + print_mmu(m); - if (!of_property_read_string(node, "compatible", &compat) - && strcmp(compat, "riscv")) - seq_printf(m, "uarch\t\t: %s\n", compat); seq_printf(m, "mvendorid\t: 0x%lx\n", ci->mvendorid); seq_printf(m, "marchid\t\t: 0x%lx\n", ci->marchid); seq_printf(m, "mimpid\t\t: 0x%lx\n", ci->mimpid); seq_puts(m, "\n"); - of_node_put(node); return 0; }