From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DAFF3B27E3 for ; Tue, 25 Aug 2026 19:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787685603; cv=none; b=L5U7PU1PlC/qJRiNprFfJwjJrpaDKI6wi/IN9H/ccqG+uA2aX1+R+mEJ1QiNQY8nTGgD3wpDISJ8TwxDYVdmbRwKJ+GLB6PYTpfc0YyKsSHQ1kcH6rHfKjHzcqQovo/7PzggieYm408i1F6v7hvlr31QXhrsEtjGZ+z2KJLjF1k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787685603; c=relaxed/simple; bh=JYyiI4+8vh/t8WdYhjIovbZznbFEuIEqWloXW61cy30=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cdyt8HttOf4uq6WXfm5aYmdZ8cjgTpTZeFBDnQ9QoaXMyc5YEH7TfUmkyDUwIEyl8Q8YvPwg2nXS+uUCpJLoi2Cl2RtKuxLaax4l1+x9UBb4+cnjgSIO3OogNz/0ixnFnWojjcMqsQE8mBSVv1ukO53NqD9Kcte9MLq1cQAkAhg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nof95QT9; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nof95QT9" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-383b4a3755fso264387a91.3 for ; Tue, 25 Aug 2026 12:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787685602; x=1788290402; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=w9yn1AZpSNU3LN3f5fzRLjyvga7IU+AXqKHS+6/yZ0w=; b=nof95QT9+EfDUQ6Msrl60aHserk4p4JNqFxMiARTtWSi8AMzr71mfh6poXB9dTQw/a oEwyTiHfYk5KyJmxDAQPDEvQ8/z/HvQ90FEnbBiuGPasFjfcqcWbPeLyyZkQPqRrLlJ/ ocL11VlVjhQ4lQjPVydcTs8jpajntnNDXG4cDFgkgCcXlR6HW40UZ+UCRTB4U//HM18m qboU6K+18QiCTPnCvj83hGhxhyV8NCabit/R8X1S8ac9fisR04rvNwYNgr/tWzprDHK9 CxnhHbC87Ez3e3gwQL7wrZmsXRd7H8yYx4wWLOxeiTojG3i6R4JHvUz7uKOZmXmqiRgN s0jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787685602; x=1788290402; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=w9yn1AZpSNU3LN3f5fzRLjyvga7IU+AXqKHS+6/yZ0w=; b=JizjNfda+kjJ0JMfpr5RwXj7LndotvKdPMzk1NH2jE7ywMJx7eTFavJVlMxI3kxt5Q wyRwXuyBHb5TUHFacQA+rM7zC03vepAV7gmW68vd8tklhky9hd915HVqHQJUCOD5sALe AH2smYG/nIeHlHCUVJ13GSweRDK8kSuK6UZ4QyyYFjCjiYoty/Y6RvZ2C7c3zfZ2+w8a 6d+UNhiywDOEyKcU0j9+8sg7leMMm8SSkfDTwblZVnaZ1aw+jdYU0kiI55Qvog/b3oZH noA4yW8JjN0IzyUFNQ1MnaQ/xx5xsJ1kGP3CE0Be91uT8Ezz5745g8fjKSxjapp+z70z ZETA== X-Forwarded-Encrypted: i=1; AHgh+RqrYRIhSfkJXDv4RnRz6nkv9EjXtA3VM77DAPbMhENCw4FXi2xTdyzrJbmx/3+lPzoOSQ62xZN19q1eRps=@vger.kernel.org X-Gm-Message-State: AFuF++l4dHlwOAT28b60o8Inu6WLSU/RYbiYYWQABdYcRMIJpM++QhWG TaG5AQC07BTG836DdUtu19scmqXBQ9Y5MyQ/s0Hp/ED2niFKb2NjDlBu X-Gm-Gg: AR+sD13I2C+H+M/BUprooO9ntiYQ/jc4FGh7e9rRWUNuzKayUheItE2+R8ovtdnt858 UzsjY1tgFodvaTxYtiQ3LQ8i5/KA4XzjAvVk+A+Qa6OXfH3TLmHXKQBcmDYeSC1Durg9AeTbfka UZdrIzDMm7DrXsUt16xVCA0NHClEZ63G/6X3/IO+2LVP7gfaOYaiCtMY+1ZF6NgN6ubefFjZQCx SHkeyytZiQ8SLsSXud7HYiap8XjY6Rynqn7D9TTDLEB6u6hJufCh2x2TycUxvONsTNZ3pau/9+Z pIg+2H6YLZm3tBIa/avmKPrwKpvY0QD1mlH+zRZDcksCEJilP7wuROWVeFwFQKaGFbyzfs3GvuE /v8jjmSum0b/nPOSb75isCHlwp89y/dP5Sw2/bf32Nt8vP3LrcVxLZer7EXmfFpctLKm8Nk8LNG neEZFZ0ieJy5YVaMB4Zhc29coPULqsd6BGpmwkrDNrvyeblxinjVwXMcY= X-Received: by 2002:a17:90a:e70f:b0:38e:49c0:75a7 with SMTP id 98e67ed59e1d1-3966d43471cmr2894089a91.8.1787685601723; Tue, 25 Aug 2026 12:20:01 -0700 (PDT) Received: from bloom.localdomain ([2604:3d09:178e:e100::6868]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39645d31f44sm4765782a91.10.2026.08.25.12.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2026 12:20:01 -0700 (PDT) From: Ivy Lopez To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: alex@ghiti.fr, andrew.jones@oss.qualcomm.com, conor.dooley@microchip.com, schwab@suse.de, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ivy Lopez Subject: [PATCH v3] riscv: hwprobe: fix has_fpu() to require D extension only Date: Tue, 25 Aug 2026 13:19:50 -0600 Message-ID: <20260825191950.42614-1-skunkolee@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The kernel never supports F without D, since D depends on F. As such, has_fpu() checking either extension with '||' is incorrect: it reports FPU support when only F is present, which is not sufficient for D-dependent state save/restore, and weakens RISCV_HWPROBE_IMA_FD semantics to "F or D" instead of "F and D". Fix has_fpu() to check D only, which is equivalent to requiring both extensions given the dependency. sys_hwprobe.c already calls has_fpu() and needs no changes. Link: https://bugzilla.kernel.org/show_bug.cgi?id=221874 Suggested-by: Conor Dooley Suggested-by: Andreas Schwab Signed-off-by: Ivy Lopez --- Changes in v3: - Drop the sys_hwprobe.c hunk entirely: it already calls has_fpu(), no change needed there since v1 was never merged. - This is a new thread per maintainer request, not a reply to v1/v2. arch/riscv/include/asm/switch_to.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/switch_to.h b/arch/riscv/include/asm/switch_to.h index 0e71eb82f920..8186cda88e17 100644 --- a/arch/riscv/include/asm/switch_to.h +++ b/arch/riscv/include/asm/switch_to.h @@ -60,8 +60,8 @@ static inline void __switch_to_fpu(struct task_struct *prev, static __always_inline bool has_fpu(void) { - return riscv_has_extension_likely(RISCV_ISA_EXT_f) || - riscv_has_extension_likely(RISCV_ISA_EXT_d); + /* D extension depends on F, so checking D alone is sufficient. */ + return riscv_has_extension_likely(RISCV_ISA_EXT_d); } #else static __always_inline bool has_fpu(void) { return false; } -- 2.55.0