Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp748163pxp; Fri, 11 Mar 2022 14:05:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxepEsmJM8+g9TrRucgMah/wFjhFri0KAHTi+qXQEdzMyL+74fgKK04p5kgo/6YeLW5WCsf X-Received: by 2002:a17:90b:17ca:b0:1bf:6188:cb5e with SMTP id me10-20020a17090b17ca00b001bf6188cb5emr12884377pjb.89.1647036347980; Fri, 11 Mar 2022 14:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647036347; cv=none; d=google.com; s=arc-20160816; b=aJqW0a7GpAHcGTfCNah/II81ERwfwrWsP+vASTL7XflXoXc+rgPaL/Z1UrPgo/2CXm VkorENTKg0NFur5EFgbP9ZZmm2e2RieQ2agWTL7CXfP9x6pROOWDNIIV7uJYy9gtqNb0 05gHMA81w2chzcJcyNjnJbmqt5VcPl5dF1rh1LNnJpfC8JAYEamaCoDK4SWUhhwcqfqF rlNWIxBa5sbUOaUwxAoqUu3hKfpW1D5j/rhvoSYqKNB0gMzTyYL8f2WOw2j6lQQWzwO3 n1BqebasHejEKNIg3lwskUyMHajCNvCupjaDWpFKTvBaoMUsRKRz/dFIM5sxaLWJXmgQ jRdw== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=fLlnSFBo7p11DLw5p7NCLynaXk3GOqvr/4xsAhubQPU=; b=ZqYBcZBlEaxR0igb6oewYmhuwwF7hqwL4gGbz3ZpTuzka6fZ7rLp5BJ80bDNJF4bJj SKkAOPpj6fVAOES7aVi1VBh0P35EPC7ObDpVz+ofL5IaQnhOfLPCrm4zxz66c4DVFVwk 6eqrWUfk5L8hyJwic2RfG49NSf2829ETulZF0KNZEMS9mDCk/oxZUZbazWwtJK1LtDL2 bmUUAY8pReucC1ELzCIqhSxGXXT5vyVSnsaljYj1tD3ZHa7cv/Pt2w/VrlTElp/aYVes n9bVMxbOTsqypdjdW7rctfStCUToxg2Pm7ml3RxmD77OVTOOtYotbXVoX1090MKntZ0Z qiQg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bi12-20020a170902bf0c00b0014fd360c0e8si8453998plb.372.2022.03.11.14.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:05:47 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 48D962AD1F7; Fri, 11 Mar 2022 13:20:02 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348437AbiCKNjS (ORCPT + 99 others); Fri, 11 Mar 2022 08:39:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348755AbiCKNjQ (ORCPT ); Fri, 11 Mar 2022 08:39:16 -0500 Received: from imap2.colo.codethink.co.uk (imap2.colo.codethink.co.uk [78.40.148.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 568BD1C46B6 for ; Fri, 11 Mar 2022 05:38:12 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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