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 85A22C433FE for ; Sat, 12 Mar 2022 02:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbiCLCOk (ORCPT ); Fri, 11 Mar 2022 21:14:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiCLCOf (ORCPT ); Fri, 11 Mar 2022 21:14:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DD90CEA07; Fri, 11 Mar 2022 18:13:30 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 32AE3616FF; Sat, 12 Mar 2022 02:13:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96180C340EE; Sat, 12 Mar 2022 02:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647051209; bh=iRWRs787HfJQ4SmemjGupG5ATeZbj3chEC+s846rFUI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dzXW6D8a2fZcblys/QjCjL1M/69kjw27NQiwmxnI6v3Ty+JBSWuIwfIfHMmel2imr vGu03UC1vkaZOz0pVbvbaJ9VjatjyUMXrOjzw24dIgQIhPT2twm3Y7jpIEc+Sz1sZv xbefw+amYIJbHgLb9GrTrmKiMUF0Kh9g0oRa9QtveWDvFd6jsFRy9NIp4DXV0Ut1IQ qOhqK6ZRwENFgrFfhjtXN1OmpfCbVK48hQDU1kPXHAQlBTM9+QsrxqThgGkRXzKr2N vavIpsLAOCj0FM0mLCPoFRDvSj/f0Tjjlyok2eBV73W6cwj6H+ndb0VRdsWuF97g+/ fjPsQcegOyixw== Received: by mail-vs1-f47.google.com with SMTP id a186so11438325vsc.3; Fri, 11 Mar 2022 18:13:29 -0800 (PST) X-Gm-Message-State: AOAM532FGz9ujwjqJuwNQBFVM5/3NTtFzxwhIVOqfjAMfz6+Xu2z4ClP pFKOX+FYA0hrePt2W9/cSw1JS1yOTi9rzqar40I= X-Google-Smtp-Source: ABdhPJzCzz+Egly7/GI0fNYhw4sbiCEhUuQJ2YUO3cGoxYtVTwt+tqnmQKqPh36WSK6cQ0MJdLShbyuO/M99QnpoqW0= X-Received: by 2002:a67:fc17:0:b0:320:b039:afc0 with SMTP id o23-20020a67fc17000000b00320b039afc0mr7125264vsq.2.1647051208526; Fri, 11 Mar 2022 18:13:28 -0800 (PST) MIME-Version: 1.0 References: <20220227162831.674483-1-guoren@kernel.org> <20220227162831.674483-14-guoren@kernel.org> <509d2b62-7d52-bf5c-7a6c-213a740a5c00@codethink.co.uk> In-Reply-To: <509d2b62-7d52-bf5c-7a6c-213a740a5c00@codethink.co.uk> From: Guo Ren Date: Sat, 12 Mar 2022 10:13:17 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V7 13/20] riscv: compat: process: Add UXL_32 support in start_thread To: Ben Dooks Cc: Palmer Dabbelt , Arnd Bergmann , Anup Patel , Greg Kroah-Hartman , liush , Wei Fu , Drew Fustini , Wang Junqiang , Christoph Hellwig , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 11, 2022 at 9:38 PM Ben Dooks wrote: > > 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? I don't think, seems #ifdef CONFIG_COMPAT is more commonly used in arch/* > > >> } > >> > >> 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 -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/