Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6362996rwl; Tue, 4 Apr 2023 11:25:42 -0700 (PDT) X-Google-Smtp-Source: AKy350bk2nvr2sRJ/tgMiP++bs4J1Ee7+3lhNfHkbcdxcOI93QY+9LLqvEknNEd7mZiblhx39xKj X-Received: by 2002:a17:90a:7b86:b0:236:7144:669f with SMTP id z6-20020a17090a7b8600b002367144669fmr471425pjc.2.1680632742082; Tue, 04 Apr 2023 11:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680632742; cv=none; d=google.com; s=arc-20160816; b=aXxhjGia6F4AUoDATfVoucZEefdNUd0z3CDgi28W5QL58SQY6n4i3W0RTRM+frbR6H WJdggMsko0VgUKDdQ60W/nQ02UjzNXBArUlwPnRNQerGn9RR5zH4x7IPMYHRwVNRmuvO v1KkpwhJdAm5IualWLne4Fz/1FECUZz4vcXeLJdwdBLesTjYempcbUFvOtigWvfYeEHv G5VGeVr3W+XvkILsFGOWpyiWYrLGURCysUu9wZii8IP6UNu8mg22ayL58J86uwIKl9Q9 9fZMisWeWfyU+0VfT2sRVoPlxuUXZTG71TYgtKDMvqZu1h9CEVPjLBZKLIBgxl2fXbbB VEXQ== 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=xu/Iz4Gys9b28icQ+yc3gYklUvfwHJ9XRG8B+aoThpM=; b=QSbnHh/v0wT02oH9fmcdPgdN6dgv80qvLN+4xS3FlJ2vqi89jrpF/a1cuT1j+KRnpu BTxEtz1xQiE5ri3DauV09GqJfujdy2J/5qlcxRwwhzjvYQq5GT/AI00u79S2SPCa+Myh +tc67wE0+K46YvrFmgHP5LDCovxfAqC7NQsODO609DU2jQ7aE7417UWJ4F85xv9HMcBH FS+Tfcm/AXDxYsDLC7lZn0e3yw8q/YJARfMAsNPBfne9++FXr+YbNLyIbTNOF14ZCFKF go8Oe0+ZYA3/e/2v5JmYJyZLleWZTlSXZNkWGp+yP7q0jCXQqCNJhlNnHvaSVBDJuTer T13w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=JAHpEivL; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020a170902db1200b001a1e867f287si10862065plx.460.2023.04.04.11.25.29; Tue, 04 Apr 2023 11:25:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=JAHpEivL; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234947AbjDDSYY (ORCPT + 99 others); Tue, 4 Apr 2023 14:24:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235610AbjDDSX1 (ORCPT ); Tue, 4 Apr 2023 14:23:27 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A14236A76 for ; Tue, 4 Apr 2023 11:22:25 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id q102so31473092pjq.3 for ; Tue, 04 Apr 2023 11:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1680632545; 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=xu/Iz4Gys9b28icQ+yc3gYklUvfwHJ9XRG8B+aoThpM=; b=JAHpEivL9I/hqCw5D7j0mXEZAxKh4ujny1mEGmpBbRIxybrn39V0gQUlAcsalhKo0j DmCiPnahoqflsNeHLjt954DEvkZLVEOyUaETUrUGy7Apz4Pmy5mnBKd5Q2Td+oduXEUW gm5C1C7yfD7vKtL5v7JIUvvBYBF1Y9x5eucLKrwtXh+kjVtvr3NG7LSkgfJ1JBT4OQyZ 82Ua9PZK4uDHx6vGaE++tMWrsovOH9XjleEqS/+sTt4DY+KzbPfySBA4hMLzhMvwoRm8 0qE/qIk54OKw04ln/sEiBsJsENPa0WtwYQcYi5x8G0lAtBo6gQQt67n8mmeK7/W+hA6b C2vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680632545; 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=xu/Iz4Gys9b28icQ+yc3gYklUvfwHJ9XRG8B+aoThpM=; b=hYhu63SmWQl8ottmxpKLS2b5HtsAHHyXVUHQ3CozMIaY1DKN6YLzWbccOHZFYa9KLK SqfI5BtPxx8UOccr1HrcMNtndutzHazwnYX0gpZ20qzX8hyICz8zQ2Zazu1NhM4EESU5 vGc7Kxe6sB5Q9b4Qgluvdg2yNTjwyHmX57iw/bY6Ri6g6WB90fCgTXSj4A9oLh1UbF4y 26v4c7jy+CjQ1NvYX4L0SHPocsFj0lHAx5hLAXX5cbZYUNLsIVVKYRK6PiuwrMLeC5pr TvAjx6w1FXIZaybJG61+NuMPKKZ6Xde6rH4uCqhYX7M0UvD+pB5XEEu2VDEgXJUhuuR8 pBdw== X-Gm-Message-State: AAQBX9dhmFVQnUnNHWF55m3OqKkPJ2f2mmHGbvFWmiVpqZMF3zgFw+nB wUROIRB8SvD7IbGbVRDQR7vD/YHOuZ6KgUwnKpM= X-Received: by 2002:a05:6a20:6d2f:b0:da:db55:4a35 with SMTP id fv47-20020a056a206d2f00b000dadb554a35mr148628pzb.4.1680632544910; Tue, 04 Apr 2023 11:22:24 -0700 (PDT) Received: from localhost.localdomain ([106.51.184.50]) by smtp.gmail.com with ESMTPSA id o12-20020a056a001bcc00b0062dcf5c01f9sm9018524pfw.36.2023.04.04.11.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 11:22:24 -0700 (PDT) From: Sunil V L To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-crypto@vger.kernel.org, platform-driver-x86@vger.kernel.org, llvm@lists.linux.dev Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Len Brown , Daniel Lezcano , Thomas Gleixner , Weili Qian , Zhou Wang , Herbert Xu , Marc Zyngier , Maximilian Luz , Hans de Goede , Mark Gross , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Rafael J . Wysocki" , "David S . Miller" , Sunil V L , "Rafael J . Wysocki" , Andrew Jones Subject: [PATCH V4 14/23] RISC-V: cpu: Enable cpuinfo for ACPI systems Date: Tue, 4 Apr 2023 23:50:28 +0530 Message-Id: <20230404182037.863533-15-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230404182037.863533-1-sunilvl@ventanamicro.com> References: <20230404182037.863533-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-crypto@vger.kernel.org On ACPI based platforms, few details like ISA need to be read from the ACPI table. Enable cpuinfo on ACPI based systems. ACPI has nothing similar to DT compatible property for each CPU. SBI calls must be used to get vendor/arch/imp ID for any errata. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones --- arch/riscv/kernel/cpu.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 8400f0cc9704..ace4752516d8 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -3,10 +3,12 @@ * Copyright (C) 2012 Regents of the University of California */ +#include #include #include #include #include +#include #include #include #include @@ -283,23 +285,35 @@ static void c_stop(struct seq_file *m, void *v) 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); - print_mmu(m); - if (!of_property_read_string(node, "compatible", &compat) - && strcmp(compat, "riscv")) - seq_printf(m, "uarch\t\t: %s\n", compat); + + if (acpi_disabled) { + node = of_get_cpu_node(cpu_id, NULL); + if (!of_property_read_string(node, "riscv,isa", &isa)) + print_isa(m, isa); + + print_mmu(m); + if (!of_property_read_string(node, "compatible", &compat) && + strcmp(compat, "riscv")) + seq_printf(m, "uarch\t\t: %s\n", compat); + + of_node_put(node); + } else { + if (!acpi_get_riscv_isa(NULL, cpu_id, &isa)) + print_isa(m, isa); + + print_mmu(m); + } + 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; } -- 2.34.1