From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 77E9042D763 for ; Mon, 17 Aug 2026 14:15:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976147; cv=none; b=kuivXqX2pJMQnxqvYrGETVZOihZ2l9wZIASFlS+3dkusO7HGz2c4vFGdf7f+uMevAGrjsy9gWYQRcdhimMVZrM/ez5aOmZM1XftN7kmOdAv99RD7e0FQoOwrFI296o+VqyttF3MZ4n8qdjTESirFGjMQJlf6xZRJ7d2+Z102RFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976147; c=relaxed/simple; bh=SUNRs3ekH9d7tIDCE+FLtqvCJk4MOw0Hpq23FcS6BcM=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=d1ni8yRgafKIdZdUauVxFPy0rFCecPvIGrp7q4onL70BZeH7UhOBPC5mV/l0wYfEq6xiny+IjQxGH5DnDODts2oseqEvMi1fR9Ji2hOMxxLrrz/WzO1ji4vMZ2U5opWEIpfpGOuNNpVLVlj299/kSUWlRkyeB4LaiFLLuAQcQqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=Eex3jmIX; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Eex3jmIX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786976146; x=1818512146; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=SUNRs3ekH9d7tIDCE+FLtqvCJk4MOw0Hpq23FcS6BcM=; b=Eex3jmIXt2Kdcg8kqv/G4n1azmsigqZd9AQ6OmWohP67S7xr1Yq7r8ar DoTmDg7CC1M19XK+iODhwxDjAtn9WW0ZCJAl0mKfeQ2quM0qIQH7OFF89 g9UXo7CoD7DK1tPLKG+HSqLGqd4tmYVZDtLNhYhQgjP1xizf0nwikk+of rA3FnfFntqgY30f1GFTkIO8u8EdpqWvSj6wUbF3snmiPF56TiTZnJYYHi e2S1CumxkqFDYqT1enj4Mv461a1tKs5+6Uo1H0m3CQkFxcoHQ3blsKmW9 jJGGq161jmjwnNQ49pAv4WyP7k5pmTsYWX3Bgk4dfFpQuTQWuRcCVM6hE A==; X-CSE-ConnectionGUID: XzMd5B7sTriYVChL9cryQg== X-CSE-MsgGUID: Cfx/b3YCQ+GVPhdxeXEX2g== X-IronPort-AV: E=Sophos;i="6.25,229,1779174000"; d="asc'?scan'208";a="62555110" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2026 07:15:45 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Mon, 17 Aug 2026 07:15:45 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58 via Frontend Transport; Mon, 17 Aug 2026 07:15:43 -0700 Date: Mon, 17 Aug 2026 15:14:36 +0100 From: Conor Dooley To: Ivy Lopez CC: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Andrew Jones , , Subject: Re: [PATCH] riscv: hwprobe: require both F and D extensions for RISCV_HWPROBE_IMA_FD Message-ID: <20260817-unmade-dyslexic-4bb4acf535af@wendy> References: <20260816003216.22534-1-skunkolee@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n7SigRToBKy0m259" Content-Disposition: inline In-Reply-To: <20260816003216.22534-1-skunkolee@gmail.com> --n7SigRToBKy0m259 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 15, 2026 at 06:32:16PM -0600, Ivy Lopez wrote: > Documentation/arch/riscv/hwprobe.rst states that RISCV_HWPROBE_IMA_FD > means both the F and D extensions are supported. However, the > implementation uses has_fpu(), which returns true if either extension > is present, since that's sufficient to determine whether FPU state > needs to be saved/restored. Reusing it here silently weakens the > hwprobe semantics from "F and D" to "F or D", giving userspace no way > to know which extension is actually present when only one is. The kernel never supports F without D, so this cannot occur. riscv_isa_extension_available(NULL, f) always returns false if D is not also present. If anything, the code in has_fpu() should be changed to only check D and not F to match expectations elsewhere, or F and D for the same reason. >=20 > Check both extensions explicitly with riscv_isa_extension_available(), > matching the pattern already used for the neighboring C and V checks. >=20 > Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D221874 > Signed-off-by: Ivy Lopez > --- > arch/riscv/kernel/sys_hwprobe.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwpr= obe.c > index 1659d31fd288..7f91beb82a1c 100644 > --- a/arch/riscv/kernel/sys_hwprobe.c > +++ b/arch/riscv/kernel/sys_hwprobe.c > @@ -85,7 +85,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, > u64 missing =3D 0; > =20 > pair->value =3D 0; > - if (has_fpu()) > + if (riscv_isa_extension_available(NULL, f) && riscv_isa_extension_avail= able(NULL, d)) > pair->value |=3D RISCV_HWPROBE_IMA_FD; > =20 > if (riscv_isa_extension_available(NULL, c)) > --=20 > 2.55.0 >=20 --n7SigRToBKy0m259 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCaoMXSAAKCRB4tDGHoIJi 0r33AP9xvTpVhoNyjAY90W4COwASd1mqNfOe9G3m5dpok0xXnAEAvta/WYrgdiJS ph9ufnFx3dNQEarmIui3TUPaJMjtEgs= =JOkw -----END PGP SIGNATURE----- --n7SigRToBKy0m259--