Message ID | 20230515054928.2079268-14-sunilvl@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6694849vqo; Sun, 14 May 2023 23:06:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bGObMwqFyYznIWKaiXV2r/O+e2TUiIBAw+zB/K6djR7twoSXt6sHS6603Sm0aWImrDczc X-Received: by 2002:a17:90a:bf16:b0:252:7f17:b0e9 with SMTP id c22-20020a17090abf1600b002527f17b0e9mr14559566pjs.41.1684130778364; Sun, 14 May 2023 23:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684130778; cv=none; d=google.com; s=arc-20160816; b=JzkZPbcVFdnWNu7byhk7Y+YAXh7lnpYmynCNANPLaMJ8lHaWkE5zNUjKQ174fj9xTD FhZLiFf4OXerLAuxuSDrTXW3QZphLcvIbuVYSCOL1YYWjHHVozJYJHQxYxOev9pAkM5A HY6m1o4M/Vw5wmcvh8AY2ithMvJIipTYhlwGoKYctqj8SGQarH7GjoQr2mKzUr5/ueiX 3WEyPHdCaTxnXPduNJ3ZOTWy6fryJX5PTMyEYAvVkIFCZTu6557eeZmVZDFh5QhMXtli g9TZhTA36mGoEGB/PVkc1kSyc7+m+EanMsTyypuWZkTwlhx44DEqOqPcDwIImwsjM9ZD i4Ww== 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=/XDEVfXqS4FP0KdGTx6jL5yfIe6/oO8gDCIQfJ1eWZE=; b=EVzmc0oj6LvaUJgOdiYxpE+GmILwzxWrsw6qJ1VOoIrgeh/wQt7QVP+xS4kHQsUv9z bNntQFN2qK4vlV+UcwXuXXJoT3/iaKwCjV5QapaKaiQuvCe5oxldgcOLIMhjzObkNz3B WMjPT6DQfDosB4iGwPSbwaJG6GtoYA4RtHgBP9S3k8Pris39aSo6Ss9nzTdGIZT6QcQv YHsEd4sM3mt1t8dzpmYECdBwTsuYgJNlTKDcQRrWjYB4EbRCQcAAJpR2f8ShIB4aFTeT rG3G8XpQtFrdtzflgzt8nBEL6LQrJF5/ts/XfLd6Wc83311QOwr6VlJRFDmqzUN3VIw6 jpYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=eo+hRK3Y; 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 d12-20020a63734c000000b00502fdce9dcasi14935465pgn.114.2023.05.14.23.06.05; Sun, 14 May 2023 23:06:18 -0700 (PDT) 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=eo+hRK3Y; 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 S238850AbjEOFyV (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Mon, 15 May 2023 01:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238603AbjEOFxF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 15 May 2023 01:53:05 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E383226B9 for <linux-kernel@vger.kernel.org>; Sun, 14 May 2023 22:51:05 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1ab267e3528so87455305ad.0 for <linux-kernel@vger.kernel.org>; Sun, 14 May 2023 22:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1684129865; x=1686721865; 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=/XDEVfXqS4FP0KdGTx6jL5yfIe6/oO8gDCIQfJ1eWZE=; b=eo+hRK3Y6dFcpXE+MFhCwXrUsWBWvgOpcG+KbYVEc0DqQgCL+swnaKrDmIfoDh8TRe 2hKgFyvx9N6JbNkAa121GRj+WzhpUml5rUfGm4nN89OoFCceHUiKktEO6no31ZDHA2dm vu3aQ2Y0qbCdrwrMHzB7oxlpvZnl0+wjHjhF38ju8yd5O4GM0lgTnoBN+QhEt2YgYAuB KjX/ebuvlXou1OgUYvoC4/ceYoRbK1BF7oG+yD58urPPEfekTeQmm4yGKdqbhbhdgo+K kxQbbm5n3OpfAAOFYRtjP0l883SnrIMgXvEQGPn8Amcd3XQA8zjuIuvbINQVit0iuDax vrTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684129865; x=1686721865; 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=/XDEVfXqS4FP0KdGTx6jL5yfIe6/oO8gDCIQfJ1eWZE=; b=JQheitOJ4bR797VK9PD57U026ZUriHn//Hlm5vHA4f7ym22+/7jjFQFHR3SXlgpaVm q5IqHGp6qkGgQT2SILsO2XUlBAVShYktCuHN+oPQP9o+igEhTMXs/KFVE0j/0nl0Pb8r 8tpSaA84eH4I6tC72ysxL7VdpOwae8yTlMEsysG7wZpNq4TNPBmcjSGjYB9Lhd/3MdKZ TkWGZBAwJwowmVvN7JsNRQRcw4/umKL6fwknE/5dtM13hKQijMxZ0j57tv4NDu231Ib+ xBhrfvhEqciZ7xXYmNe/xK8nC2nOB6zsMUM0ZBBslne3lkmrt3v5gu4s78UAlxKTdTy3 SWyA== X-Gm-Message-State: AC+VfDzEWZSEfdtsd8NkXIFaXLCuIcP3KtUOyXeC8X5pVrZ3dJx4S3bn uqzCsXLkRyeHixhyx3WrHC9LFA== X-Received: by 2002:a17:902:eb46:b0:1a6:5487:3f97 with SMTP id i6-20020a170902eb4600b001a654873f97mr31149745pli.64.1684129865387; Sun, 14 May 2023 22:51:05 -0700 (PDT) Received: from localhost.localdomain ([106.51.191.118]) by smtp.gmail.com with ESMTPSA id f10-20020a17090274ca00b001ab28f620d0sm12423277plt.290.2023.05.14.22.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 May 2023 22:51:05 -0700 (PDT) From: Sunil V L <sunilvl@ventanamicro.com> 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 <corbet@lwn.net>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, "Rafael J . Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Sunil V L <sunilvl@ventanamicro.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Thomas Gleixner <tglx@linutronix.de>, Weili Qian <qianweili@huawei.com>, Zhou Wang <wangzhou1@hisilicon.com>, Herbert Xu <herbert@gondor.apana.org.au>, "David S . Miller" <davem@davemloft.net>, Marc Zyngier <maz@kernel.org>, Maximilian Luz <luzmaximilian@gmail.com>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Conor Dooley <conor.dooley@microchip.com>, Andrew Jones <ajones@ventanamicro.com> Subject: [PATCH V6 13/21] RISC-V: only iterate over possible CPUs in ISA string parser Date: Mon, 15 May 2023 11:19:20 +0530 Message-Id: <20230515054928.2079268-14-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230515054928.2079268-1-sunilvl@ventanamicro.com> References: <20230515054928.2079268-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765939115241707997?= X-GMAIL-MSGID: =?utf-8?q?1765939115241707997?= |
Series |
Add basic ACPI support for RISC-V
|
|
Commit Message
Sunil V L
May 15, 2023, 5:49 a.m. UTC
During boot we call riscv_of_processor_hartid() for each hart that we add to the possible cpus list. Repeating the call again here is not required, if we iterate over the list of possible CPUs, rather than the list of all CPUs. The call to of_property_read_string() for "riscv,isa" cannot fail either, as it has previously succeeded in riscv_of_processor_hartid(), but leaving in the error checking makes the operation of the loop more obvious & provides leeway for future refactoring of riscv_of_processor_hartid(). Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Co-developed-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> --- arch/riscv/kernel/cpufeature.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index b1d6b7e4b829..c607db2c842c 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -12,6 +12,7 @@ #include <linux/memory.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_device.h> #include <asm/alternative.h> #include <asm/cacheflush.h> #include <asm/cpufeature.h> @@ -99,7 +100,7 @@ void __init riscv_fill_hwcap(void) char print_str[NUM_ALPHA_EXTS + 1]; int i, j, rc; unsigned long isa2hwcap[26] = {0}; - unsigned long hartid; + unsigned int cpu; isa2hwcap['i' - 'a'] = COMPAT_HWCAP_ISA_I; isa2hwcap['m' - 'a'] = COMPAT_HWCAP_ISA_M; @@ -112,16 +113,20 @@ void __init riscv_fill_hwcap(void) bitmap_zero(riscv_isa, RISCV_ISA_EXT_MAX); - for_each_of_cpu_node(node) { + for_each_possible_cpu(cpu) { unsigned long this_hwcap = 0; DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX); const char *temp; - rc = riscv_of_processor_hartid(node, &hartid); - if (rc < 0) + node = of_cpu_device_node_get(cpu); + if (!node) { + pr_warn("Unable to find cpu node\n"); continue; + } - if (of_property_read_string(node, "riscv,isa", &isa)) { + rc = of_property_read_string(node, "riscv,isa", &isa); + of_node_put(node); + if (rc) { pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); continue; }