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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A00FC4332F for ; Fri, 11 Mar 2022 14:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349024AbiCKOCM (ORCPT ); Fri, 11 Mar 2022 09:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238102AbiCKOCL (ORCPT ); Fri, 11 Mar 2022 09:02:11 -0500 X-Greylist: delayed 1376 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 11 Mar 2022 06:01:08 PST Received: from imap2.colo.codethink.co.uk (imap2.colo.codethink.co.uk [78.40.148.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E12B1C57D0; Fri, 11 Mar 2022 06:01:08 -0800 (PST) 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 Cc: linux-arch , Linux Kernel Mailing List , linux-riscv , linux-csky@vger.kernel.org, linux-s390 , sparclinux , linuxppc-dev , Parisc List , "open list:BROADCOM NVRAM DRIVER" , Linux ARM , the arch/x86 maintainers , Guo Ren 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 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org 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 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 6EC14C433F5 for ; Fri, 11 Mar 2022 13:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PNlwiX/A0TF0A+CUvDdlZawAWzvPwzb0Xo0eE74kiPw=; b=aSMbOmzg9MWF/q 5LS9zCRpHxK2tKoEQt//yWIulVFGYB1v97HdrY4qDA/I/DnyTEvPuriqPVQJHZjr9VKoAAX91WWYf 0bPHhxnWSuxbBVNraj1zBZcr3F3ihESZ4NmKiedkiqAG8FOgRRLlEM9yLAxwSTYARek/1yOc3NM1s ILqjy3Y+mKn+YGzWyKk4ky+5HSb0Qx7poQU97ifPKierwtZLz5LOXUJqm+ER9yp/5B1/tqXBTFeOa p2J2qzKYeCq5jBBJf1TPG9fcxXzWZd+yQ8wfCymxBU/E3/YoXOuJSwwJqit6xACLt1tO1yX3YbV2I St7gUU2iYLBhF/pNY10w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSfTK-00GYWq-7G; Fri, 11 Mar 2022 13:38:22 +0000 Received: from imap2.colo.codethink.co.uk ([78.40.148.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSfTF-00GYSk-41; Fri, 11 Mar 2022 13:38:21 +0000 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 Cc: linux-arch , Linux Kernel Mailing List , linux-riscv , linux-csky@vger.kernel.org, linux-s390 , sparclinux , linuxppc-dev , Parisc List , "open list:BROADCOM NVRAM DRIVER" , Linux ARM , the arch/x86 maintainers , Guo Ren References: <20220227162831.674483-1-guoren@kernel.org> <20220227162831.674483-14-guoren@kernel.org> From: Ben Dooks Organization: Codethink Limited. In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220311_053817_173626_C231C90B X-CRM114-Status: GOOD ( 17.45 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 09C72C433EF for ; Fri, 11 Mar 2022 13:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uj6H4mK4J93Fm+DroHLXSknRpS5VCC3zLgmKc8YqkBU=; b=M5DiLz1LcUtojY GhB7D9anwNJcx9oZCbPMUVy9ePNmt2YuubU6bhBqvZx5ks0ZPdXV4dXr7crgzCDco4YoDKFybwPCS WB5bc7X/5WvipUf190fgnSGRv8WTwo+EFOZMpOWD0+LkSbnpB4uXAGECW5npHwMq0UiVm4X9iy9Xr 8jX0V0bR7J9T+ZBESTWjoxL/zMmEc3eEpNp10e5gMS6BS+Vxp8aUa2XIIRYJgGpSN37JKVHkq+wJw 3pl6XTs95szWx3u9l9Wi4QGUzV0ZanZh8DET9xT4U/6PXV48p23ih/2kRiUtxRpNk3OlpxaNoLmDN HiHZ7m+55y1hw4qu4Bbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSfTM-00GYXT-Vr; Fri, 11 Mar 2022 13:38:25 +0000 Received: from imap2.colo.codethink.co.uk ([78.40.148.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSfTF-00GYSk-41; Fri, 11 Mar 2022 13:38:21 +0000 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 Cc: linux-arch , Linux Kernel Mailing List , linux-riscv , linux-csky@vger.kernel.org, linux-s390 , sparclinux , linuxppc-dev , Parisc List , "open list:BROADCOM NVRAM DRIVER" , Linux ARM , the arch/x86 maintainers , Guo Ren References: <20220227162831.674483-1-guoren@kernel.org> <20220227162831.674483-14-guoren@kernel.org> From: Ben Dooks Organization: Codethink Limited. In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220311_053817_173626_C231C90B X-CRM114-Status: GOOD ( 17.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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