From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C066C433EF for ; Fri, 11 Mar 2022 14:01:41 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KFSKH5ZNCz3bf8 for ; Sat, 12 Mar 2022 01:01:39 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=codethink.co.uk (client-ip=78.40.148.184; helo=imap2.colo.codethink.co.uk; envelope-from=ben.dooks@codethink.co.uk; receiver=) X-Greylist: delayed 1371 seconds by postgrey-1.36 at boromir; Sat, 12 Mar 2022 01:01:13 AEDT Received: from imap2.colo.codethink.co.uk (imap2.colo.codethink.co.uk [78.40.148.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KFSJn3hzxz2yjS for ; Sat, 12 Mar 2022 01:01:11 +1100 (AEDT) Received: from [167.98.27.226] (helo=[172.16.103.108]) by imap2.colo.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1nSfSn-0000Di-Kl; Fri, 11 Mar 2022 13:37:49 +0000 Message-ID: <509d2b62-7d52-bf5c-7a6c-213a740a5c00@codethink.co.uk> Date: Fri, 11 Mar 2022 13:37:48 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH V7 13/20] riscv: compat: process: Add UXL_32 support in start_thread Content-Language: en-GB To: Guo Ren , Palmer Dabbelt , Arnd Bergmann , Anup Patel , Greg Kroah-Hartman , liush , Wei Fu , Drew Fustini , Wang Junqiang , Christoph Hellwig References: <20220227162831.674483-1-guoren@kernel.org> <20220227162831.674483-14-guoren@kernel.org> From: Ben Dooks Organization: Codethink Limited. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch , linux-s390 , Guo Ren , Parisc List , the arch/x86 maintainers , Linux Kernel Mailing List , linux-csky@vger.kernel.org, "open list:BROADCOM NVRAM DRIVER" , sparclinux , linux-riscv , linuxppc-dev , Linux ARM Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 11/03/2022 02:38, Guo Ren wrote: > Hi Arnd, > > On Mon, Feb 28, 2022 at 12:30 AM wrote: >> >> From: Guo Ren >> >> If the current task is in COMPAT mode, set SR_UXL_32 in status for >> returning userspace. We need CONFIG _COMPAT to prevent compiling >> errors with rv32 defconfig. >> >> Signed-off-by: Guo Ren >> Signed-off-by: Guo Ren >> Cc: Arnd Bergmann >> Cc: Palmer Dabbelt >> --- >> arch/riscv/kernel/process.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c >> index 03ac3aa611f5..54787ca9806a 100644 >> --- a/arch/riscv/kernel/process.c >> +++ b/arch/riscv/kernel/process.c >> @@ -97,6 +97,11 @@ void start_thread(struct pt_regs *regs, unsigned long pc, >> } >> regs->epc = pc; >> regs->sp = sp; >> + > FIxup: > > + #ifdef CONFIG_COMPAT >> + if (is_compat_task()) >> + regs->status = (regs->status & ~SR_UXL) | SR_UXL_32; >> + else >> + regs->status = (regs->status & ~SR_UXL) | SR_UXL_64; > + #endif > > We still need "#ifdef CONFIG_COMPAT" here, because for rv32 we can't > set SR_UXL at all. SR_UXL is BIT[32, 33]. would an if (IS_ENABLED(CONFIG_COMPAT)) { } around the lot be better than an #ifdef here? >> } >> >> void flush_thread(void) >> -- >> 2.25.1 >> > > -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html