From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF7E123DA for ; Wed, 5 Apr 2023 14:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ACCAC4339B; Wed, 5 Apr 2023 14:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680705092; bh=zSAJvHpnJ4t5+N5rlPStNtw8kt3Pvqahl38JBpYY8G0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UA05BQCDFOlATRVQf6u1KpRp0bUorSfIjan7xcEWrovcLCtG6gNGf4096NaaFpr2s /NErwGnTgYtFy7ZdM1i3tquxq7hjpC7wmlV/TgnIJRKIV1zF9lu4CP5c8oe5KWAPHQ 77r0V/i0nWcoazrEjCoyt7/BUVuUxRkvmgtkAr2FDL554YVLCeL8LL8MAUxVvd56xW HSEjZG/XTAXMZ8qANPYHf87Ju78DBpuPGv0tiGZtDTnsJuQVELo9YGtEi7XFG0cTuO 7prRmTBPrYhuaCNo5CQeQaue1Clx1elgq7OvAyjF9XJ8U7qcdmsWp05Vs6w78hkng0 eI+P4ShYUl+zQ== Date: Wed, 5 Apr 2023 15:31:24 +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, "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: <20230405-compel-slinky-2fe11b4bf0b3@spud> References: <20230404182037.863533-1-sunilvl@ventanamicro.com> <20230404182037.863533-14-sunilvl@ventanamicro.com> <20230404-promotion-scarce-7c69ff7e5f99@spud> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="G5/7scijW3x9IuES" Content-Disposition: inline In-Reply-To: --G5/7scijW3x9IuES Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 05, 2023 at 07:05:42PM +0530, Sunil V L wrote: > 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. > > >=20 > > > 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(-) > > >=20 > > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufe= ature.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 > > > */ > > > =20 > > > +#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] =3D {0}; > > > + struct acpi_table_header *rhct; > > > + acpi_status status; > > > + unsigned int cpu; > > > =20 > > > isa2hwcap['i' - 'a'] =3D COMPAT_HWCAP_ISA_I; > > > isa2hwcap['m' - 'a'] =3D COMPAT_HWCAP_ISA_M; > > > @@ -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); > >=20 > > 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. > >=20 > 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? Yah, all 3 of us mistakenly thought that that was an unrelated cleanup on the last revision, but clearly it is not. Squash it back IMO, sorry for my part in the extra work generated. Cheers, Conor. >=20 > > I'd swear I gave you a (conditional) R-b on v3 though, no? > > Reviewed-by: Conor Dooley --G5/7scijW3x9IuES Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZC2GOAAKCRB4tDGHoIJi 0rnsAP0cgFLWkLbUrSntzAuLfoBAltCrodxxTLrayMe+WsSAOgEA0umoMwKzM2ox W+uIW/1axAfQExBp1IRIgO1BnHHRKAE= =CYcq -----END PGP SIGNATURE----- --G5/7scijW3x9IuES--