From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4969C77B7C for ; Sat, 29 Apr 2023 10:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230466AbjD2Kbc (ORCPT ); Sat, 29 Apr 2023 06:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbjD2Kba (ORCPT ); Sat, 29 Apr 2023 06:31:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 935D61BE8; Sat, 29 Apr 2023 03:31:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27A2D61610; Sat, 29 Apr 2023 10:31:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28794C433EF; Sat, 29 Apr 2023 10:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682764288; bh=0GbmBMGiNiQlIdnACBgahvtc+QtoJehbHv6nICycqIU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tFhPkZUDutv1XqNNNayYgpxTWhqBsGyicP5ZE+0P5aZPM1SFgNwGsYutMDbjAeX7r JoIbcHIL0grDinAv1Xen+AI6GLJDOeK7oulXXWtq6Af2EkCNZQ+Mv+TGKx4KpPj8HN o37YI2ZiY580d9dsHNxhOy0NYV9xON8ceNNwkVCsu8Ru8dxYj+hqpK5NDa69iCq5bv r9g9qfYstDE8+Mz8clTHSExMwWUjXwj04kTfT766VTMf5JEJoTxTu2UDU6msp9DTxf zniinNBnHQ9amnPS6KwooRNkDA8OaKb5fE7QYpuHGv+Jrcx6drNQ/sHkF9tOE8VPCP qPbfmrd2AbdWQ== Date: Sat, 29 Apr 2023 11:31:20 +0100 From: Conor Dooley To: Sunil V L 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, 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" , "Rafael J . Wysocki" , Andrew Jones Subject: Re: [PATCH V4 13/23] RISC-V: cpufeature: Add ACPI support in riscv_fill_hwcap() Message-ID: <20230429-voucher-tutor-715fd4f6c24e@spud> References: <20230404182037.863533-1-sunilvl@ventanamicro.com> <20230404182037.863533-14-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mD53ytQ30VQ4ln/R" Content-Disposition: inline In-Reply-To: <20230404182037.863533-14-sunilvl@ventanamicro.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org --mD53ytQ30VQ4ln/R Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Sunil, On Tue, Apr 04, 2023 at 11:50:27PM +0530, Sunil V L wrote: > @@ -103,14 +109,36 @@ void __init riscv_fill_hwcap(void) > =20 > bitmap_zero(riscv_isa, RISCV_ISA_EXT_MAX); > =20 > - for_each_of_cpu_node(node) { > + if (!acpi_disabled) { > + status =3D acpi_get_table(ACPI_SIG_RHCT, 0, &rhct); > + if (ACPI_FAILURE(status)) > + return; > + } > + > + for_each_possible_cpu(cpu) { > unsigned long this_hwcap =3D 0; > DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX); > const char *temp; > =20 > - if (of_property_read_string(node, "riscv,isa", &isa)) { > - pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); > - continue; > + if (acpi_disabled) { > + node =3D of_cpu_device_node_get(cpu); > + if (node) { > + rc =3D 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; > + } > + } else { > + pr_warn("Unable to find cpu node\n"); > + continue; I was poking at this the last few days and went back to look at the ACPI code again. Is there a reason we don't do early-return here? IOW: node =3D of_cpu_device_node_get(cpu); if (!node) { pr_warn() continue; } rc =3D of_property_read_string(node, "riscv,isa", &isa); of_node_put(node); if (rc) { pr_warn(); continue; } Cheers, Conor. > + } > + } else { > + rc =3D acpi_get_riscv_isa(rhct, cpu, &isa); > + if (rc < 0) { > + pr_warn("Unable to get ISA for the hart - %d\n", cpu); > + continue; > + } > } > =20 > temp =3D isa; > @@ -243,6 +271,9 @@ void __init riscv_fill_hwcap(void) --mD53ytQ30VQ4ln/R Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZEzx+AAKCRB4tDGHoIJi 0uDXAP0UihCqegQRGuBLnWtSMvMhsuIza2XwUNXv6Jsjw1EdNwD5AT1aXZpghWod R72zPlGiSaij2J867SuTR51j5SWNmQE= =7cU+ -----END PGP SIGNATURE----- --mD53ytQ30VQ4ln/R--