Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp696363rwl; Wed, 5 Apr 2023 06:37:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Z+P8N1wcw/up4qrHoJGkdibv1hPwkYOtudJxrJIkDJjca6+UvmYJcOO4JI9sLKancoF09i X-Received: by 2002:a17:902:c9cb:b0:1a1:cd76:7880 with SMTP id q11-20020a170902c9cb00b001a1cd767880mr5290546pld.15.1680701858181; Wed, 05 Apr 2023 06:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680701858; cv=none; d=google.com; s=arc-20160816; b=evBjfC6n9xNvRC4dCKE7RY41CK+cMWIaV04WWGrUHlw/w5n7577GIiE/+Tbf4lxst1 FMdc3uIxoX4GjmFQ3vF/Mc0wUMSNoNri6PR1VWS1TVOT+KZj/0vMstLkkVcsmKr4D7TU 6/ocBWt8WzxWzGD5YedaWOPlR97NLS+K8Cq9qFzvRVIeh/1WA88ErkImINmT46QOXX5v frA1HtYs+S2CqSnewv7A4ynsGHTIFJLTo1Hbj5Fb35Z8NFf1yg98GWN8rOKb66emoAfd ObqCoSUlj+MRVdFCneXwBBq3R1chY9KYSdNSlNO10lcpZ/77hn+xOi0EkvI/km9UMEqA JC9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JIHDYxgUdzzSqTP2brP/Gv5M90CrOXKIjgMsPWUPa3E=; b=Fmu+fjVbh+ZYGkO/0rzRhU/ga3aq7CE+eX3Fx/2/ExEt/Ci8BnuuT224vytZZq4hiH 9GhArp3h6Zu9F9SufSMjZjb80zDfl2s+egEhfZsh2W59NfxS1bc9qGb7RCAFLEMGrSMc fV5tNZI8JF83DY9jXc3NSQmmZ77tzSw3vsXdDDNJQZFxs1S/UQPiZH3EXR9+TVCYsem5 NmRj4THpYKZAKKA7MU4gFHRUtXtm9x1u5zffGCMl71BDVK7L3HCRUEt0QnzKY8Aa9yJP wo6rJ09PH8WeUvEn+Qxa4FEK6W1vSUoJvON68dPCtPp2XdezqP/hBQck8xTI+I7cul0T 8Blw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=CKTKF4kp; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b004fb7e7ef77dsi12347395pgq.693.2023.04.05.06.37.25; Wed, 05 Apr 2023 06:37:38 -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=CKTKF4kp; 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 S238256AbjDENf6 (ORCPT + 99 others); Wed, 5 Apr 2023 09:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238266AbjDENf5 (ORCPT ); Wed, 5 Apr 2023 09:35:57 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622084C17 for ; Wed, 5 Apr 2023 06:35:55 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id l9-20020a17090a3f0900b0023d32684e7fso3781216pjc.1 for ; Wed, 05 Apr 2023 06:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1680701755; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JIHDYxgUdzzSqTP2brP/Gv5M90CrOXKIjgMsPWUPa3E=; b=CKTKF4kpb7ZHTt5WzSMSNpO/YiANGdZvzrrD77G3R2AwcXrky8I6y4ejU+fBNRkbFN lryZ+EIvfsuH2rhE1cSkHr2YVlmsBsCIb8FDF1XSoF0GPIMefcCmWeKloUJDFICHi6eb 7MRvsY+ChHOJQlUMZypaYAaLEZHVZ0W99yx9LtAckYSxsCvWLVnwy22p6QBxC6+q6Wm5 UhgAmuMSveoY6oR2rnXWLS00Sqg1O+H6+VjZvXkfNBpXmNdo6GRt3ztEp6czta8goSwK oRSWcq7xRdYhdRHeqG+fJZwC0rkHEmiTgcIOzCeYaKuTbI1JTB78nUaYlT1a1CD4IDgf bc6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680701755; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JIHDYxgUdzzSqTP2brP/Gv5M90CrOXKIjgMsPWUPa3E=; b=S6Sf0nbn6BdR+nO+jNEXjGeFwMX+EyVo3m2TnRDKX1QMW5bGkxc7u7LyLuQAZwEz4E 52fhLnIfrT0jESTkdTzMyv2CG6MirYBgEAsFDmlVr+vgOjD+TYxIL1kft/HWt4ZoVIEP x83C+Z+JA+h6lgCwJVGy/C005EhPJWgCJsQW3SWNozmtDExxYx3wagnZvikUAV2XCsmD hVCXBPKS7tpanYt8cc/HyOllql4AvZCTQ4t8/uXVjrHsjH/mOogwelURglR+U/TtMjIi 4Ax94sppCduH6F5pDWmonJ3S/NVsKOh3Saq1kB90+BFmhdHvRuAwNDqt7lNtxXD05HLa wILw== X-Gm-Message-State: AAQBX9fw1jrVlMoU7DgN1wt+HYrcazEGlnoHpbhKl74CuwsXZECAFJlt pGrx6EvDm2OqBFW8N9nbldYR+A== X-Received: by 2002:a17:902:e891:b0:1a1:f413:70b1 with SMTP id w17-20020a170902e89100b001a1f41370b1mr7345803plg.18.1680701754753; Wed, 05 Apr 2023 06:35:54 -0700 (PDT) Received: from sunil-laptop ([106.51.184.50]) by smtp.gmail.com with ESMTPSA id 19-20020a170902c11300b0019cad2de86bsm10131129pli.156.2023.04.05.06.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 06:35:54 -0700 (PDT) Date: Wed, 5 Apr 2023 19:05:42 +0530 From: Sunil V L To: Conor Dooley Cc: 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, "Rafael J . Wysocki" , "Rafael J . Wysocki" , Tom Rix , Weili Qian , Herbert Xu , Jonathan Corbet , Marc Zyngier , Daniel Lezcano , Andrew Jones , Albert Ou , Mark Gross , Hans de Goede , Paul Walmsley , Thomas Gleixner , Nathan Chancellor , Nick Desaulniers , Zhou Wang , Palmer Dabbelt , Len Brown , Maximilian Luz , "David S . Miller" Subject: Re: [PATCH V4 13/23] RISC-V: cpufeature: Add ACPI support in riscv_fill_hwcap() Message-ID: References: <20230404182037.863533-1-sunilvl@ventanamicro.com> <20230404182037.863533-14-sunilvl@ventanamicro.com> <20230404-promotion-scarce-7c69ff7e5f99@spud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230404-promotion-scarce-7c69ff7e5f99@spud> 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-kernel@vger.kernel.org On Tue, Apr 04, 2023 at 09:57:19PM +0100, Conor Dooley wrote: > On Tue, Apr 04, 2023 at 11:50:27PM +0530, Sunil V L wrote: > > On ACPI based systems, the information about the hart > > like ISA is provided by the RISC-V Hart Capabilities Table (RHCT). > > Enable filling up hwcap structure based on the information in RHCT. > > > > Signed-off-by: Sunil V L > > Acked-by: Rafael J. Wysocki > > Reviewed-by: Andrew Jones > > --- > > arch/riscv/kernel/cpufeature.c | 39 ++++++++++++++++++++++++++++++---- > > 1 file changed, 35 insertions(+), 4 deletions(-) > > > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > > index 63e56ce04162..5d2065b937e5 100644 > > --- a/arch/riscv/kernel/cpufeature.c > > +++ b/arch/riscv/kernel/cpufeature.c > > @@ -6,6 +6,7 @@ > > * Copyright (C) 2017 SiFive > > */ > > > > +#include > > #include > > #include > > #include > > @@ -13,6 +14,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -91,6 +94,9 @@ void __init riscv_fill_hwcap(void) > > char print_str[NUM_ALPHA_EXTS + 1]; > > int i, j, rc; > > unsigned long isa2hwcap[26] = {0}; > > + struct acpi_table_header *rhct; > > + acpi_status status; > > + unsigned int cpu; > > > > isa2hwcap['i' - 'a'] = COMPAT_HWCAP_ISA_I; > > isa2hwcap['m' - 'a'] = COMPAT_HWCAP_ISA_M; > > @@ -103,14 +109,36 @@ void __init riscv_fill_hwcap(void) > > > > bitmap_zero(riscv_isa, RISCV_ISA_EXT_MAX); > > > > - for_each_of_cpu_node(node) { > > + if (!acpi_disabled) { > > + status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct); > > + if (ACPI_FAILURE(status)) > > + return; > > + } > > + > > + for_each_possible_cpu(cpu) { > > unsigned long this_hwcap = 0; > > DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX); > > const char *temp; > > > > - if (of_property_read_string(node, "riscv,isa", &isa)) { > > - pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); > > - continue; > > + if (acpi_disabled) { > > + node = of_cpu_device_node_get(cpu); > > + if (node) { > > + rc = of_property_read_string(node, "riscv,isa", &isa); > > Hmm, after digging in the previous patch, I think this is actually not > possible to fail? We already validated it when setting up the mask of > possible cpus, but I think leaving the error handling here makes things > a lot more obvious. > Yeah, do you prefer to merge these patches again since only in this patch, we change the loop to for_each_possible_cpu() from for_each_of_cpu_node() which actually makes riscv_of_processor_hartid() not useful? > I'd swear I gave you a (conditional) R-b on v3 though, no? > Reviewed-by: Conor Dooley > Thanks, Sunil