X-Received: by 2002:a17:90b:4c50:b0:1b5:58fc:5f07 with SMTP id np16-20020a17090b4c5000b001b558fc5f07mr11912058pjb.94.1645663483670; Wed, 23 Feb 2022 16:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645663483; cv=none; d=google.com; s=arc-20160816; b=so3ZdPIjrzrJJAkXQ9Qee6/k9qGvDnGLjCdKnR1wJBDFhuE6LOJAa8wRe67JGmsUjy ESs8OtnkAH8tXkXqMRSl1aiYrK3vwcz0CaJgeac0pb1uv0paKr/IiSAiYjac1N3cAKPR G09DwmMX5VMhqFcSkGcz3evGUqFNXGwaoLiNHhercgsTPxBuhWiIqSmrUaMutCvSy3+z 3hqVRS4WbL+F3mng/JBYcGvtnHgNlPPkapcKE4axX/6qIS88NfxT3KvEg6cXWgeEgf77 zJ587ke9WPQQXYKgLoqaU9PGEvzECw3D0YPx7/eilIYIg6bRtNcQaw2uoGAZLlT5biRg YCpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bHUZnizunX2TSoYGtEizZ8Aqds8CJZnrASeREgry1/Y=; b=cXRzJ5oYGOMZWb2OcTzHTCC8lL4lctE4d7vS9eeTlhHZiS9CS8EGYibG6jFeWMUBkd WZsJPfrxXhq6tgiWRvpXkKiKyX+/aZc0pomCdyPPUMYKfkF3YxgHqCNWQ3qY2J0np/eA FYDgEPV8x01Lxbj995cOjawiJ2oSjDaaW3fYKjlIJ1WYdCIifCKuYOmINR1ux+eIyhy1 HLJaWS4w3YLBhBgYRkkVCIpiW+JoKFEFwpIqQW5W9VrD/PF+nc2aB65biRbjRwi0TTqn BMJI41dgcPkF0OVoxlrSsGEtqMi0mOqhSDZo5mo1SAnqEZ4b++oCRjupa30D6RDrClEp qO1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fvP1S9IC; 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 f17si1136775pgg.22.2022.02.23.16.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 16:44:43 -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=fvP1S9IC; 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 875A7E083; Wed, 23 Feb 2022 16:41:33 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239030AbiBWJWl (ORCPT + 99 others); Wed, 23 Feb 2022 04:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbiBWJWj (ORCPT ); Wed, 23 Feb 2022 04:22:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D8A3A71F; Wed, 23 Feb 2022 01:22:12 -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 A88AB61676; Wed, 23 Feb 2022 09:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13426C340F3; Wed, 23 Feb 2022 09:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645608131; bh=qr8aGN/GfpzREfWWEWfy67hMxOcd5xgEZdDkbd5B0Fc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=fvP1S9ICDfQF8hCsfx1j5bfZ8MyW/1rG6leAkItXfaKKhotabi5LJfUSgdtHnAs1e e//NBoK00IXi9zTUjPv7rNpA1RU7H3GNLpb9V1grfG21006D6HV2Tb4+Qk5tLh0HIo Y8xDpIW1XwC917uzpPR1esP/YuSq+XHVf/PTy1JzpDjvNBh8Jh8OysgZZO5Bjpcj+Q EJYwG2Z8BOyrYZNJ4iSfk1NrfuQSK+S4t7xQPNsmD2s/GQ8tcuq/JigD7ZEI9VXG1f eljgFZP39JEv9+yiNsBLF4dJImtQrUvYwdNENxl33kkrfAUIOs6Dsce/NuZ/ym9xNY WkfVAuCjEyWQw== Received: by mail-ua1-f43.google.com with SMTP id 10so1100160uar.9; Wed, 23 Feb 2022 01:22:11 -0800 (PST) X-Gm-Message-State: AOAM533GHSt2VO5OSbN+/PMx85QJ5OXAdQ125cZm9ZqDIt+0V7ZFSAZ6 sGYfO00CUeafNlgt1z+1b/gNa4WNVJ+uoaUYCOU= X-Received: by 2002:ab0:5543:0:b0:33c:9e1c:a30d with SMTP id u3-20020ab05543000000b0033c9e1ca30dmr11349278uaa.97.1645608129880; Wed, 23 Feb 2022 01:22:09 -0800 (PST) MIME-Version: 1.0 References: <20220201150545.1512822-14-guoren@kernel.org> In-Reply-To: From: Guo Ren Date: Wed, 23 Feb 2022 17:21:59 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V5 13/21] riscv: compat: process: Add UXL_32 support in start_thread To: Palmer Dabbelt Cc: Arnd Bergmann , Anup Patel , Greg KH , 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" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 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 On Wed, Feb 23, 2022 at 9:42 AM Palmer Dabbelt wrote: > > On Tue, 01 Feb 2022 07:05:37 PST (-0800), guoren@kernel.org 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..1a666ad299b4 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 lon= g pc, > > } > > regs->epc =3D pc; > > regs->sp =3D sp; > > + > > +#ifdef CONFIG_COMPAT > > + if (is_compat_task()) > > + regs->status |=3D SR_UXL_32; > > Not sure if I'm just misunderstanding the bit ops here, but aren't we > trying to set the UXL field to 1 (for UXL=3D32)? That should be a bit > field set op, not just an OR. You are right, I would modify like this: + if (is_compat_task()) + regs->status =3D =EF=BC=88regs->status & ~SR_UXL) | SR_UXL_32= ; + else +. regs->status =3D =EF=BC=88regs->status & ~SR_UXL) | SR_UXL_64= ; > > > +#endif > > } > > > > void flush_thread(void) > > Additionally: this isn't really an issue so much with this patch, but it > does bring up that we're relying on someone else to have set UXL=3D64 on > CONFIG_COMPAT=3Dn systems. I don't see that in any spec anywhere, so we > should really be setting UXL in Linux for all systems (ie, not just those= with > COMPAT=3Dy). --=20 Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/