Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp128679pxm; Tue, 22 Feb 2022 18:39:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxb/+zQrmkdGeiirNQ9YaQ64DjuJaJDh2bBWz5opYXrC7Plwo1e4a5ksq4xbk/KShNhh+Us X-Received: by 2002:a63:fe4a:0:b0:372:e047:bc20 with SMTP id x10-20020a63fe4a000000b00372e047bc20mr21664896pgj.339.1645583976801; Tue, 22 Feb 2022 18:39:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645583976; cv=none; d=google.com; s=arc-20160816; b=D9QN6siPcCVKxpJvNE7effejX2h1wHm02hEy3ETl5jHwHaomBBag3XqgiWO4l9mU8o S9wsgj79IvkbgIgwyydLSOSC4ThFZBwFEoOUhg9LIZ35CNCtlYw6Nzw5E3DFDKBPNw9Z Ez4V6tLHw9aBcmq+hn8skzUeiKl5ZgpH1dQ0cE9TBhZ/xBaTQwu59KSv5TXmnox3DBni tdhTAhl6s+bV3ZbwnSen1E41detNxvzVcV3N6t08lhlKcBYHrnRviudLOYBf9uJoigrX gu8oyeWPiWmOPLIjeOEoU/t/xO3ESqpC5ohPFitXkREidj+Vz0BF5T5DJAzJ0yYBsFPo SDnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=N2UCfbLp79h/dkfWTGY4WIVSQeEuINCqmpbos16sW34=; b=xW7d/zjrCcA2u5ZQzhfgYtqTH2n6taxlQJjO4hE+EWjL+6lM/xnnfVBEpJ8EEJCF/l zGPpAXvBzkBerD/iH2NKcsoumSee0GIuZlt04fM6nP9PmNOTn6V1lklIVcyASKlpPP1Q LtwFHKysyEmF3h1FnP3RNUz85zTFWx0mlPcrbIrw/mjLusjFFdD7JkmY1yF9M5+qz+Mz trk+zl1gwyOCg6f0HqYNwfqSJ5Yq9Mgc23xgp/41jehrK1BfRaVGqme1chdi8hOi4avh cmgF1Zt4BzWjBWLS1nsuElI4GT1Bq+Kj9ooYzBgaGZ/GFU21o4HqXR5qHJEIKYzXhZQT bOWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=4LFj9bz4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ns11-20020a17090b250b00b001bc2c2d87easi956873pjb.167.2022.02.22.18.39.01; Tue, 22 Feb 2022 18:39:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=4LFj9bz4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236656AbiBWBn0 (ORCPT + 99 others); Tue, 22 Feb 2022 20:43:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236629AbiBWBnQ (ORCPT ); Tue, 22 Feb 2022 20:43:16 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B08506F0 for ; Tue, 22 Feb 2022 17:42:49 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id q8-20020a17090a178800b001bc299b8de1so1307714pja.1 for ; Tue, 22 Feb 2022 17:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=N2UCfbLp79h/dkfWTGY4WIVSQeEuINCqmpbos16sW34=; b=4LFj9bz4NwjfZrhnHEdaivZOeq/+lWRcuq5Y1wzU2pkH5M1EbGGH+iS2dAWte4zzK0 uhfsYDkF8v/YwKD4UrkItpNjka+Xnb5VDUm1+nNaSTfiwLfufG7rXr/ximrBJWWJ3I98 SVPPLrKIpK7zmmK0mTw99x5pVOqdEe7hcOHvTEa4Vd3384rUHgzjAjmsWfjUCq+/kFkH LdIKEFlWMPZJtDKZwldMNodHN+jWw5yu0bDJ44NRvdh2aClgYR4rkjeegQmMBQE1UbfI CHqHwSMlqOGdpTnIqkYZYWyNY/pga1f2aIBpTtYLUdCay8XLPTHf+igsHER5SXIaDjrF Bjmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=N2UCfbLp79h/dkfWTGY4WIVSQeEuINCqmpbos16sW34=; b=ZfD3fh3wCQEfA4O9KZkSbw42eXU70Kx/m5CGOIcSlYZCPk7p7pc6Qib2ivh2A02NVR +92ngzWm9KiQGFV7t0L62UoJ7lWgeq6FyJABuaL6SQpShg6LVeSDQgyI6rLWzcqGBRp0 RktKzQcB3Ymonov5TjXUguptvuo6HS4AnNnxKDF0guAMPGZw8rSJffSDwL1AgN7fVeWw pw6GY6Z12qJZBkIcI3NIUHPiCpegicWqbTQmMf6jq9J425pH1NNWV0Ebd8qTwQ4bJ/Ja JG08QBPAXwM3VnDpcAoqOBi4LutcsxKgpFgx6NQYzjcawurBWzM5glrqcTqwQtUiqNE+ WDcQ== X-Gm-Message-State: AOAM533SrYk1absJhefFpWXo6tPcykcxTy+ikCRVV1pFyj+Fcy3YhxMd 88Fz+a/EMThi1H6t1LQItt76tg== X-Received: by 2002:a17:90a:a502:b0:1bc:8dd6:a859 with SMTP id a2-20020a17090aa50200b001bc8dd6a859mr2404594pjq.46.1645580569193; Tue, 22 Feb 2022 17:42:49 -0800 (PST) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id bd13sm4528769pfb.60.2022.02.22.17.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 17:42:48 -0800 (PST) Date: Tue, 22 Feb 2022 17:42:48 -0800 (PST) X-Google-Original-Date: Tue, 22 Feb 2022 15:29:49 PST (-0800) Subject: Re: [PATCH V5 13/21] riscv: compat: process: Add UXL_32 support in start_thread In-Reply-To: <20220201150545.1512822-14-guoren@kernel.org> CC: guoren@kernel.org, Arnd Bergmann , anup@brainfault.org, Greg KH , liush@allwinnertech.com, wefu@redhat.com, drew@beagleboard.org, wangjunqiang@iscas.ac.cn, Christoph Hellwig , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, guoren@linux.alibaba.com From: Palmer Dabbelt To: guoren@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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 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 long pc, > } > regs->epc = pc; > regs->sp = sp; > + > +#ifdef CONFIG_COMPAT > + if (is_compat_task()) > + regs->status |= 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=32)? That should be a bit field set op, not just an OR. > +#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=64 on CONFIG_COMPAT=n 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=y).