Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3208314iob; Fri, 6 May 2022 22:34:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiCzBMClt5IabBDlVtnBvImIrVRErJoU1OFmR8taG9UXAWrdX8dYQj0/rxvEP7Tm7E5RN4 X-Received: by 2002:a05:6830:53:b0:606:3240:6155 with SMTP id d19-20020a056830005300b0060632406155mr2260378otp.256.1651901679069; Fri, 06 May 2022 22:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651901679; cv=none; d=google.com; s=arc-20160816; b=PXWLZXBuq/dPjK9xlj05VtFTQjOpSG9iLCXpPI318D9BqfuMGOZsb3BuNCZCebvkHj eqoubSQdhJGudTTOJRHcpLqVbUQBq1FIFKfzvVboh6nwFNvNMKBqK7iJ6rXAx7eDp7iy EuHldBcq7zQD4aGGftPxCGJ5p/OKQ2fOoFDh4ohDfEZtpnmgj25WNAClrHCUGwx6/QjA kT1ZHj3RERcvCNxEuop6bB7C079cWUoGydSukD6LB21AykdszAi2uyzGAoBnfgC/qQXM 9JQrs9GYhGP4UvdU/MEtS5P6rEVSE/V3aO0+cRvaRGs3oe8itW0xNzHWzGi4/e+lwgct wXVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GYhka3ZB7rJYpXPnweiNkLudSF54Qj7USt3fFvQsOQo=; b=lGlnMr3wRR5pZ4K5SLfpB77K/MBCO8CecgDmBRqGhAP+2hk59yUMVJhqibnZ/iv2Dk kt7odVCiKuoPJe3e/S/RWwlJaDWsQn28TqEBmhhM477SN6MsNm7+Gn48ggP6V0T124l7 B7oebznPmEK6pQPI7FGJk94MLERH42IP+sJB9GVWBMy68XbFPSn8JLTVYMzD//M8ZdIT JRw5JhnONMRJEe9zfamPvW8Gq81RHwrbsNAtmY6FRsvlUlPR+dGOEqZ0zRax0u24I/HU ZG8sRfmMCHp2Z1yDsYexBy2T6f44kksHWR30QfI1ubsoYGuk114H9cLmpgp+LhTWL/hG jB+A== ARC-Authentication-Results: i=1; mx.google.com; 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 z2-20020a056870514200b000e5dc6134aesi3879162oak.133.2022.05.06.22.34.25; Fri, 06 May 2022 22:34:39 -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; 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 S1378110AbiEDUgp (ORCPT + 99 others); Wed, 4 May 2022 16:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378082AbiEDUgh (ORCPT ); Wed, 4 May 2022 16:36:37 -0400 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8EA04FC6B; Wed, 4 May 2022 13:33:00 -0700 (PDT) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1nmLg3-0003MI-01; Wed, 04 May 2022 22:32:51 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 61086C01D0; Wed, 4 May 2022 22:28:22 +0200 (CEST) Date: Wed, 4 May 2022 22:28:22 +0200 From: Thomas Bogendoerfer To: Stephen Zhang Cc: macro@orcam.me.uk, liam.howlett@oracle.com, geert@linux-m68k.org, ebiederm@xmission.com, dbueso@suse.de, alobakin@pm.me, f.fainelli@gmail.com, paul@crapouillou.net, linux@roeck-us.net, anemo@mba.ocn.ne.jp, zhangshida@kylinos.cn, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: Re: [PATCH v4] MIPS: adding a safety check for cpu_has_fpu Message-ID: <20220504202822.GB23391@alpha.franken.de> References: <20220502032002.840029-1-starzhangzsd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220502032002.840029-1-starzhangzsd@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, May 02, 2022 at 11:20:02AM +0800, Stephen Zhang wrote: > From: Shida Zhang > > There is a chance 'cpu_has_fpu' would still be overridden when the > CONFIG_MIPS_FP_SUPPORT configuration option has been disabled. So > add a safety check for 'cpu_has_fpu'. > > Suggested-by: Maciej W. Rozycki > Signed-off-by: Shida Zhang > --- > Changelog in v1 -> v2: > - Choose to redefine cpu_has_fpu to solve the problem silently. > > Changelog in v2 -> v3: > - Choose to point out the error instead. > > Changelog in v3 -> v4: > - Make the check work for 'nofpu' option. > > arch/mips/include/asm/cpu-features.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h > index de8cb2ccb781..c0983130a44c 100644 > --- a/arch/mips/include/asm/cpu-features.h > +++ b/arch/mips/include/asm/cpu-features.h > @@ -133,6 +133,9 @@ > # define raw_cpu_has_fpu 0 > # endif > #else > +# if cpu_has_fpu > +# error "Forcing `cpu_has_fpu' to non-zero is not supported" > +# endif > # define raw_cpu_has_fpu cpu_has_fpu > #endif > #ifndef cpu_has_32fpr > -- > 2.30.2 applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]