Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2994573rwd; Fri, 19 May 2023 13:14:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Cb8ZoAa7Lknajy8okvXK53d9xNprYmcWEdX/5kKtQdyO00imx2l8KUXC/Fjs0NNqV5/3W X-Received: by 2002:a05:6a00:10c4:b0:63b:1708:10aa with SMTP id d4-20020a056a0010c400b0063b170810aamr4264728pfu.34.1684527258782; Fri, 19 May 2023 13:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684527258; cv=none; d=google.com; s=arc-20160816; b=FuQIxHCEQLXPvSDBz8izOOO9q7CRMyHUOECuTXSS1yMfzwlq2ryB9WKavAH8qRR4Ml zNGZ69crsNzSSTCZb97VVjMqfi5iZv6/V2RG3pdvMKZFc+mP29xpC3gJ327TAk9YjVFN uu7deaYSuQeXYl210uPs7ALaz6x+NPKcqjcTUcfgIFcjC90E3YPUjNXI01hgg09FRZ2E CuaZpy+mo41BlhDWfLZ8TljDyX+R0WiWCTTCZAVe745jwR3tNrlYE06oRH6JGoJtQIhs nbjQnGNRQAZOKqm5oo1aLNjxcekwOMpm+IA8+UddVW4ynZqC1t0B2HkRgn5Tfyc87ihl /SSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=rJ97wOK9y8R6IUNAF/rjXg/Yg/GFMGWo4GcpCsNkWgg=; b=zqUQouMzgytAep+0I0ZjIYER2PvUo7IARe1YbSnDwwVdeu4dbXbjyG4wHtIxPFkXql Cm4HnV/CpX/njpuemCmD4xh4eeV4BghWaibR5wgK4DHkl+G0+IcKfItKTJNSyMgDiC8b 42E7iYWTFxzhTl9nIGnO5rWJ95MVbFuHOyM1zraDW95bAr2eLvwkgOpfBsce+kJ4FOgQ BIpsk4h8AqAhzzi6ddO1LYPL6XE0GPEEInV+66o2oDLYitslWjeGrHqUUPR3/sG79qnT GHBeums53sxBuCYMWiZcLA4seGbQ+wvs/eVjrfIrvn0o2KL16uLdeRmmjkIOIED59kbw qk9Q== 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 y24-20020aa79af8000000b0064d35afbf07si141392pfp.152.2023.05.19.13.14.06; Fri, 19 May 2023 13:14:18 -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 S229726AbjESUKu (ORCPT + 99 others); Fri, 19 May 2023 16:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjESUKt (ORCPT ); Fri, 19 May 2023 16:10:49 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEEE0101; Fri, 19 May 2023 13:10:47 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 30FFC92009D; Fri, 19 May 2023 22:10:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 2D5A592009B; Fri, 19 May 2023 21:10:47 +0100 (BST) Date: Fri, 19 May 2023 21:10:47 +0100 (BST) From: "Maciej W. Rozycki" To: Jiaxun Yang cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Bogendoerfer Subject: Re: [PATCH] MIPS: Fix MIPS_O32_FP64_SUPPORT for 64bit CPUs before R2 In-Reply-To: <20230519163023.70542-1-jiaxun.yang@flygoat.com> Message-ID: References: <20230519163023.70542-1-jiaxun.yang@flygoat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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 Fri, 19 May 2023, Jiaxun Yang wrote: > MIPS_O32_FP64_SUPPORT enables possibility of using all 32 FPRs on 32bit > kernel in case CPU implemented FR1. As FR1 is present on all 64bit CPUs > following R4000's priviliged spec, there is no reason to limit such support > to R2+ CPUs. I guess one can do it and still run FPXX software, but I fail to see what gain it provides. For FP32 it breaks things as accesses to odd-numbered FPRs will no longer get at the high part of a double value and for FP64 there are no MTHC1/MFHC1 instructions required to access the high part. What problem are you trying to solve? And how did you verify this patch? > --- a/arch/mips/kernel/fpu-probe.c > +++ b/arch/mips/kernel/fpu-probe.c > @@ -289,6 +289,23 @@ void cpu_set_fpu_opts(struct cpuinfo_mips *c) > c->options |= MIPS_CPU_FRE; > } > > + /* Fix up FIR for FPU earlier than R2 */ > + if (!cpu_has_mips_r2_r6) { > + c->fpu_id |= MIPS_FPIR_S; > +#ifdef CONFIG_CPU_R4K_FPU > + /* All known R4000 class FPU implemented double */ > + c->fpu_id |= MIPS_FPIR_D; > +#endif Currently all FPUs we support implement double and we require that, so no need to make this piece conditional (I would use IS_ENABLED otherwise, so as not to clutter the source with #ifdef), but `c->fpu_id' is also exposed to the user via ptrace(2), so this has to reflect hardware and not give a synthesized value. Maciej