Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp744775pxp; Fri, 11 Mar 2022 14:01:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHH3lJDBpKvQyFU2rHCNMwZ4pu6HeQP30eK5tU5pDnH0lsa6xKKl8OKkY1EvRMDylcGu/j X-Received: by 2002:a65:604b:0:b0:378:7add:ec47 with SMTP id a11-20020a65604b000000b003787addec47mr9918941pgp.555.1647036085073; Fri, 11 Mar 2022 14:01:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647036085; cv=none; d=google.com; s=arc-20160816; b=WRFLLREwoJcXqtdELzEmoNYHBuBTA3VskErkQt21YspHHxxkKA2e4UB9tw4QpBTU3D vA58mJmOVVzLT67U6VCFpX6yzwll2h7LiwuvNlofxIDv80pQl8+umYaHUn5L0/jzTf+m z8iRHoCDrCF/I3+3vSf3r9EAGBFHHgGBmljN87+Z93GJAgi6cgUWR9offPNK5JOt9qAL mlAXkCFSmUTiCclmq0eL2AKKtzT/cmLwqYJYy6FjEPKRN6sWkxHfrf3u1OJnnJV/d7JR 7a/lL87SYrczpSR8OuVVcQQfhMf9GegoL1fB1NebsWf0Io7xkUL/sV5JCvcIUCXhi8Mc 7GnQ== 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=aCf9Q6UJTYvMrIA2J306e1sIs7gcQpLe5TO2CMSggHo=; b=RZPCmyJhUuvRvCG61AuwCEVRyN7B5M/KhoWRy1uS9zWzhokbre5NwQVPlk3BukXpgi v9tSC/dDtMIPg7K4xOl5GG9o7pEg01ANrrMF0Qeaf9FWGfC70YcUieEQVTG9pWFNOrdG C2gmja4SyQ217VGkdTL4p6InDayur4TQ3aTafUY+lBtBFjTCO8hzr7PSs7G3TcWqMHoZ 8H9JTobyMsRUcMBtC4WlpKNGTUykRBcml7p5M2Mwryd8gl+0ByzGKyRRwbUNWr7FkNDd ZnDsCUhMOFBnkCUl9vSiTiE5E4T4J8ZXvhXkDMkruWTcPn4VOWah2jWSP6FHtWC6Ac1h 4GUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lSDH6JbZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h7-20020a056a001a4700b004e1bb6519e7si9669167pfv.76.2022.03.11.14.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:01:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lSDH6JbZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D3C517B128; Fri, 11 Mar 2022 13:18:03 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345670AbiCKCj1 (ORCPT + 99 others); Thu, 10 Mar 2022 21:39:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbiCKCjY (ORCPT ); Thu, 10 Mar 2022 21:39:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D24EA108763; Thu, 10 Mar 2022 18:38:22 -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 6D373600BE; Fri, 11 Mar 2022 02:38:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAC43C340FC; Fri, 11 Mar 2022 02:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646966301; bh=Jl8zmUlue4qqSpvupSe770nwEDFbxuYU+7Bv15ArLNk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lSDH6JbZLjCrBKwhP5l06T0OkCO9oN/A8aEEjauCFSKrSGqZSLjhPkfyba8lYXT8b qYNbLTfBYoaFYS9/EdstBjbcmkW1UfcrGbXKAA3XzivX2N/X7M8/MG2dJGhgzUj1xe JwIgADZuHHJQV+vkPugE9tLJ05ZgR4K+s7Tqg3OYy0S0d/gkDWxZGRTQdcVyEyVTta XcdW+bJU/6F0zGvwFWhD4c7+eaOFthHqbXVWvY103F1BoVPLPmpdBFX9VrRB9dX0cQ RFdNXU0aoXtMTFwXmsyOd8jEdA/NcC/+rOGDrpxxb7LrGBkBTS5gvraGhc0yhF8ir3 59IUblFQhb99Q== Received: by mail-vs1-f48.google.com with SMTP id u124so8098304vsb.10; Thu, 10 Mar 2022 18:38:21 -0800 (PST) X-Gm-Message-State: AOAM531r+0RCSa1uP+4DxvpwfnmVIeolCIthRU6hs16y0vps/+RpTX7N HjMThTmSp9v4Mq//k9W35qDGb7jrYRzugH1eYPA= X-Received: by 2002:a05:6102:806:b0:31e:2206:f1c with SMTP id g6-20020a056102080600b0031e22060f1cmr3912870vsb.59.1646966300562; Thu, 10 Mar 2022 18:38:20 -0800 (PST) MIME-Version: 1.0 References: <20220227162831.674483-1-guoren@kernel.org> <20220227162831.674483-14-guoren@kernel.org> In-Reply-To: <20220227162831.674483-14-guoren@kernel.org> From: Guo Ren Date: Fri, 11 Mar 2022 10:38:09 +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: 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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]. > } > > void flush_thread(void) > -- > 2.25.1 > -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/