Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3389864imw; Thu, 7 Jul 2022 00:31:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tds2j+QZifdTrmpg65NSXUsGIpE4+ZL6/+/rcSyh+QhE1eVz50/3dMQG5uBZhoGvnZ3poQ X-Received: by 2002:a17:90b:3502:b0:1ef:92a9:2b4c with SMTP id ls2-20020a17090b350200b001ef92a92b4cmr3445212pjb.65.1657179091468; Thu, 07 Jul 2022 00:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657179091; cv=none; d=google.com; s=arc-20160816; b=nrOEjBDU4yi47SCF1AOpbFrJNuDVuRyocFrbya2lHmikoRU6/ndm8afja0anuV1htH E8Qwc0bzQOnoX51gMEaD/HVh/FUjKkeHXKmEA4JI8lgwUnX4wrink4H9Qgaw4zDKdE9E 9ATax0LrIx7X/XpbRqCObzeuIz5cZHzqTiOQbKYpVddRORISBOT6LEm+99QScvpHdtUC M2R/msAaDbn1GlgkX+Ho5/EOi9Ni1g+WJft5/Kn3t7QFVhcjt1V1Vbf6vzEOppgRziWH ESrR8oJwnt64m2/aG8qsJHHRr4yecD5RokaVSnDkcVUj7AsCRSwl0ElKCV6meMLvEQ+3 k3Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cbfHbg59IvSwU1n1wamEgBBPGnKmD0hNzLQJ9L8IUAA=; b=z5QUmE3SxFk0CHit0IHC/7kUA1LmfORE2qzKFJgxktiTvM4rJmn/SmT95BJX2xkcGT 6nU21Wuj89BkHb7zXAltUXZdlYYh6XHt8+9GqmuDTWqX6Md4Afr9sJn/vKBO1pkBaWA0 Do9h72AI8vE9N+vCO30hEETNU4kApbOgoEGz85oSkmN8WYywWTsnsNBuOQk8Q5d27j0m 3FnZGrH53T2vpBAuTlxhqm1NmY8YWbl9gaqvObQuwDp3tDgCFqzyl6Qc7PPQdvq7dUp5 GZVTgv7WXBqzxat1PWpL6P2SC9KqUKJH3zviwd1bN9KY/W2vUg0X4/wpwCybuMIU6yL8 +35w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=WjRzEqDq; 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 d9-20020a170902654900b0016a6130129dsi50539048pln.416.2022.07.07.00.31.19; Thu, 07 Jul 2022 00:31:31 -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; dkim=pass header.i=@xen0n.name header.s=mail header.b=WjRzEqDq; 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 S234056AbiGGHNm (ORCPT + 99 others); Thu, 7 Jul 2022 03:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbiGGHNk (ORCPT ); Thu, 7 Jul 2022 03:13:40 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0089E2A719 for ; Thu, 7 Jul 2022 00:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1657178015; bh=ppbGeYOQcIvSTiYj6vLLsomHZRDhW2cFfKDbRX+db6U=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WjRzEqDqktrI48vPzdcQq4D3jO8oqbt3yBlDzJncnbSU02vXOLBjPFX1ry6B9sWbY YbjLkmNnZVOzxhohwQLsPS8EqcjB4qI+rY/a8dAsILcERzqqSaZ1TZH5G/lyd/KV5z sTlyWl6AetR6ULV/Ya3muCHhwzhG3gx3r/1Evr2s= Received: from [100.100.57.190] (unknown [220.248.53.61]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 3B6EB6010B; Thu, 7 Jul 2022 15:13:35 +0800 (CST) Message-ID: <0145342f-920a-0ce6-e50e-2b3285b5fb4f@xen0n.name> Date: Thu, 7 Jul 2022 15:13:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:104.0) Gecko/20100101 Thunderbird/104.0a1 Subject: Re: [PATCH v3] LoongArch: Remove vcsr in loongarch_fpu Content-Language: en-US To: Huacai Chen , huqi Cc: WANG Xuerui , Jiaxun Yang , loongarch@lists.linux.dev, LKML References: <20220706112937.1218573-1-huqi@loongson.cn> From: WANG Xuerui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,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 2022/7/7 14:45, Huacai Chen wrote: > Hi, all, > > I have rewritten the commit message. If no problem, this patch will be > queued for loongarch-fixes. > -- > The `vcsr` only exists in the old hardware design, it isn't used in any > shipped hardware from Loongson-3A5000 on. FPU and LSX/LASX both use the > `fcsr` as their control and status registers now. For example, the RM > control bit in fcsr0 is shared by FPU, LSX and LASX. FPU is a function unit while LSX/LASX are ISA extensions, they don't belong to the same category. "Scalar FP and LSX/LASX instructions all use ...", and "... is shared by FP, LSX and LASX instructions." sound better. > Particularly, fcsr16 to fcsr31 are reserved for LSX/LASX now, access to > these registers has no visible effect if LSX/LASX is enabled, and will > cause SXD/ASXD exceptions if LSX/LASX is not enabled. > > So, mentions of vcsr are obsolete in the first place, let's remove them. Works for me and the wording is objective enough. > -- > Huacai > > On Wed, Jul 6, 2022 at 7:29 PM huqi wrote: >> From: Qi Hu >> >> The `vcsr` is not used anymore. Remove this member from `loongarch_fpu`. >> >> From 3A5000(LoongArch), `vcsr` is removed in hardware. FP and LSX/LASX >> both use `fcsr` as their csr. >> >> Particularly, fcsr from $r16 to $r31 are reserved for LSX/LASX, an >> using the registers in this area will cause SXD/ASXD if LSX/LASX is >> not enabled. >> >> Signed-off-by: Qi Hu >> --- >> V3: >> - Modify commit message to conform to the format. >> V2: >> - Add more details in the commit message. >> --- >> arch/loongarch/include/asm/fpregdef.h | 1 - >> arch/loongarch/include/asm/processor.h | 2 -- >> arch/loongarch/kernel/asm-offsets.c | 1 - >> arch/loongarch/kernel/fpu.S | 10 ---------- >> 4 files changed, 14 deletions(-) >> >> diff --git a/arch/loongarch/include/asm/fpregdef.h b/arch/loongarch/include/asm/fpregdef.h >> index adb16e4b43b0..b6be527831dd 100644 >> --- a/arch/loongarch/include/asm/fpregdef.h >> +++ b/arch/loongarch/include/asm/fpregdef.h >> @@ -48,6 +48,5 @@ >> #define fcsr1 $r1 >> #define fcsr2 $r2 >> #define fcsr3 $r3 >> -#define vcsr16 $r16 >> >> #endif /* _ASM_FPREGDEF_H */ >> diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h >> index 1d63c934b289..57ec45aa078e 100644 >> --- a/arch/loongarch/include/asm/processor.h >> +++ b/arch/loongarch/include/asm/processor.h >> @@ -80,7 +80,6 @@ BUILD_FPR_ACCESS(64) >> >> struct loongarch_fpu { >> unsigned int fcsr; >> - unsigned int vcsr; >> uint64_t fcc; /* 8x8 */ >> union fpureg fpr[NUM_FPU_REGS]; >> }; >> @@ -161,7 +160,6 @@ struct thread_struct { >> */ \ >> .fpu = { \ >> .fcsr = 0, \ >> - .vcsr = 0, \ >> .fcc = 0, \ >> .fpr = {{{0,},},}, \ >> }, \ >> diff --git a/arch/loongarch/kernel/asm-offsets.c b/arch/loongarch/kernel/asm-offsets.c >> index bfb65eb2844f..20cd9e16a95a 100644 >> --- a/arch/loongarch/kernel/asm-offsets.c >> +++ b/arch/loongarch/kernel/asm-offsets.c >> @@ -166,7 +166,6 @@ void output_thread_fpu_defines(void) >> >> OFFSET(THREAD_FCSR, loongarch_fpu, fcsr); >> OFFSET(THREAD_FCC, loongarch_fpu, fcc); >> - OFFSET(THREAD_VCSR, loongarch_fpu, vcsr); >> BLANK(); >> } >> >> diff --git a/arch/loongarch/kernel/fpu.S b/arch/loongarch/kernel/fpu.S >> index 75c6ce0682a2..a631a7137667 100644 >> --- a/arch/loongarch/kernel/fpu.S >> +++ b/arch/loongarch/kernel/fpu.S >> @@ -146,16 +146,6 @@ >> movgr2fcsr fcsr0, \tmp0 >> .endm >> >> - .macro sc_save_vcsr base, tmp0 >> - movfcsr2gr \tmp0, vcsr16 >> - EX st.w \tmp0, \base, 0 >> - .endm >> - >> - .macro sc_restore_vcsr base, tmp0 >> - EX ld.w \tmp0, \base, 0 >> - movgr2fcsr vcsr16, \tmp0 >> - .endm >> - >> /* >> * Save a thread's fp context. >> */ >> -- >> 2.36.1 >> >> Apart from the syntactical nit: Reviewed-by: WANG Xuerui