Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3767765rwi; Sun, 16 Oct 2022 18:08:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IVsJgDEKVVv8p4HVNVQq8/HZdiispcCba6XdpZke40oLqCD8aMz9DZwjPeHpd3EG6a5eG X-Received: by 2002:a50:fe85:0:b0:458:5562:bf1e with SMTP id d5-20020a50fe85000000b004585562bf1emr7876243edt.167.1665968936574; Sun, 16 Oct 2022 18:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665968936; cv=none; d=google.com; s=arc-20160816; b=tqrm2JsTU/ypJEU7dg2tQ+K3GBa3GPxenyK8Gj/hZ9NYDhgSrVq9xsFVvg5sMKKGk5 V60Vzv8IoLF2uQJXhBKXKJpgrrukZWTqzJFZvkBwMoB+B1l4s6NnPu20vfAFfDKh8L97 CSJpOdO1mteUwRLTa3/Kr9Wl0x3jeOU7Kf/jQ47dMB9KE71j950lyrvtz3y6G/z0DKYt Sp813b+PZZdkL0tRuCuii0jYsD78QXuZirLrUM7k3tVbGeLnYsXSxsNbRPxihhXQKBCv ZpWZNHqwwgrQYTgLNGnMBtGuBfMd1y4Nz6qRZb7vwnFvq1ubkQIfZAGSWFQtueDw/gYI Z/Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZgZF+/MkRhBmK1Cs/kdYUzMRETt6syvhHC//XXD1MF4=; b=vM8MatEZD1QKOQFU3/HulF1pX8nr1X1j7KhNlvQNaetwGLM15ioJ6s0vi7/W8SDZID LLw2l+9jDYqksMLtGLvEui2dEv9j1u+g8kFa2t171AP+E1W4wiqipLhzNpcOSeMRJNZZ ob/ek/HoTQ13kFgLsq0jpL04wZfvKSZpOkbyzMlMDIHCfx6hjvBJTGQzdL4SH66DKBV7 Dv/58dAvoC1J4ydrCSgYvp0M4rbPaGrHLGOvjQOxMv4OmspzWHF5943i1a/UjQGYn8s5 ERw+i/+aRq+hxLOzF7TOpVO5SILi0vI5Kkes6jbT2F6SCvmZKUPOZlmrqe/1K/4GNZOl 3D/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hY3Ay9re; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn20-20020a1709070d1400b0078d514ace6bsi9295855ejc.282.2022.10.16.18.08.31; Sun, 16 Oct 2022 18:08:56 -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=@kernel.org header.s=k20201202 header.b=hY3Ay9re; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229728AbiJQARK (ORCPT + 99 others); Sun, 16 Oct 2022 20:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbiJQARI (ORCPT ); Sun, 16 Oct 2022 20:17:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A15B12A252 for ; Sun, 16 Oct 2022 17:17:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 56E7EB80D5C for ; Mon, 17 Oct 2022 00:17:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F0CCC4347C for ; Mon, 17 Oct 2022 00:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665965825; bh=RmH0Em+mUEQfgXRh5FfsxTgViYVAlp+3YdZ6yupU9AY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hY3Ay9re6wdH1Vw2gLbE0W4v1pf1uPrkPKH8HCPj6S0td4xlVrxGDhrYl0ZCxP20d ESdaITopMB68ljfsqMtJs3BmOzpQ6BKbG9hZE4cNZY7ZVtrokQUuTh/HGYUY8hPTvY JuqCvTlLVCihZeZdUqwXrs0410UbhOM5ZGKHiuy0knh6VwkKT7fyig/KJ3+dJmPkdu Z/bxYn6V4MCMPRjVWMKmeVp0yaaVHlpR6QzrOZ7ByaqZH+pcneV5OZUhp7iowxIM+l K+9vn8S6uEddDK6a+sO/U4kNE2aqeF5CZME/6uuP3rfwatuuRdmgwJd5+9LyxPlM2F UCYNcL+HLnx6Q== Received: by mail-ed1-f52.google.com with SMTP id a67so13801139edf.12 for ; Sun, 16 Oct 2022 17:17:04 -0700 (PDT) X-Gm-Message-State: ACrzQf1cswvR7yDlXfxqul3+2DHTScr+M1G/nBxojhL7gLVKfcM/XMSF SODOocpxC0EpQPfACEJMeeC4qRazUq+EiE+uamY= X-Received: by 2002:aa7:d4d9:0:b0:45c:7eae:d8d8 with SMTP id t25-20020aa7d4d9000000b0045c7eaed8d8mr7975846edr.254.1665965823238; Sun, 16 Oct 2022 17:17:03 -0700 (PDT) MIME-Version: 1.0 References: <20221016133418.2122777-1-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Mon, 17 Oct 2022 08:16:53 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] LoongArch: Add unaligned access support To: Xi Ruoyao Cc: Huacai Chen , loongarch@lists.linux.dev, Xuefeng Li , Tiezhu Yang , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Hi, Ruoyao, On Sun, Oct 16, 2022 at 11:05 PM Xi Ruoyao wrote: > > On Sun, 2022-10-16 at 21:34 +0800, Huacai Chen wrote: > > > Loongson-2 series (Loongson-2K500, Loongson-2K1000) > > "2K1000LA"? "2K1000" is puzzling because of a name conflict with the > MIPS-based model. Technically this is correct, both MIPS-based and LoongArch-based Loongson-2K1000 have no hardware support. > > /* snip */ > > > +static inline unsigned long read_fpr(unsigned int fd) > > +{ > > +#define READ_FPR(fd, __value) \ > > +{ \ > > Unnecessary curly brace pair. OK,thanks. > > > + __asm__ __volatile__( \ > > + "movfr2gr.d\t%0, $f%1\n\t" \ > > + : "=r"(__value) : "i"(fd)); \ > > +} > > I'm not sure if this is a correct use of "i" constraint. Maybe we > should just concatenate the string? OK, thanks. Huacai > > "movfr2gr.d\t%0, $f" #fd "\n\t" > > > + > > + unsigned long __value; > > + > > + switch (fd) { > > I don't like this "very long" switch statement, but it seems we have no > way to make it better... > > > + case 0: > > + READ_FPR(0, __value); > > + break; > > + case 1: > > + READ_FPR(1, __value); > > + break; > > + case 2: > > + READ_FPR(2, __value); > > + break; > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University