Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2071529pxm; Sun, 27 Feb 2022 10:27:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjaBUOTaJsjJx3hoasgFDPYu2Bg+Htd5CC9J5Z3G9qsvikTuGxQaGEUbWK2lMf8TK13YSk X-Received: by 2002:a17:907:68f:b0:6cd:3843:508 with SMTP id wn15-20020a170907068f00b006cd38430508mr12697212ejb.156.1645986457557; Sun, 27 Feb 2022 10:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645986457; cv=none; d=google.com; s=arc-20160816; b=Ql4hNwOnziAgZEzBpJJyJ84qZmLn/gonyvh2cPSC5zxXiMnw3Mspbv2XbdsbdxIOyw Nx+EK0sBiJo/CAODKVKVbRZfq7gqZdQeh8tKzwdcpdcb8YLcKncgucccUtUEwLjIaQ9N f88q5NLL6NloutqVGhFAF7YTIsEq3m6HJ5mSvXf3GQSEK40uyCPUXsErPO5X0v2n+WDl Ve2OSngrWPkvDs4Q9paeT/0tcv1pGL+ruRqb3CbV607K6RF31E5kq/uZeOuAHD4oQhLY /7iuxpoYOON/V3MMH6AxP4HQte0CQbSf3Ck2sbkjZGzGf9ovbO4zzH0oFcP05SCINAxi /CXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NvHNUkFHDXWmsdpLnySNHuW9Rkmn/MtVPw8bsdRtZPY=; b=CRt39UUdb4ZiuljE25LD2lGr1dgtsaqeRXN8rJtdzIDeXpNeQF1eUYbC51N5n7vam9 wil33Cn7dGsSfrVviqOeucWKp/dWBHQiAJFgZUQOS5BMIzbWvTlhgIrEEYXMV2OPJIge KCpdYgMpLT1ex4pSOwKsgRe+JU1N03EopbjM+V2XkxlapxwVL4lAotLwwktYxiJWgDtC 8ZhPDTDlXuRjY6B9ifE32uRfFaedr1uIWhEPFZ0sFSQKZlj+v0/lONO35ZGyJRmmb1// eKQUjRxBmg2wdITxFjqDbjLlYQw0oPCxgh+iRBSKvHK9ocRkdegSnoSSC87jJlokXqFc s/2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cR2wJgH+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq9-20020a1709073f0900b006d5eeea3de5si6129591ejc.889.2022.02.27.10.27.14; Sun, 27 Feb 2022 10:27:37 -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=@kernel.org header.s=k20201202 header.b=cR2wJgH+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbiB0QcQ (ORCPT + 99 others); Sun, 27 Feb 2022 11:32:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbiB0Qbm (ORCPT ); Sun, 27 Feb 2022 11:31:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07456D3AA; Sun, 27 Feb 2022 08:30:50 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6EA10B80CE8; Sun, 27 Feb 2022 16:30:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CBC8C36AE5; Sun, 27 Feb 2022 16:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645979448; bh=IJ7jR8mTvejG9VzZtr4+z5Hdjv3FHdsfGnEFZTtHWjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cR2wJgH+zoufDToYTUD+1USCs3uBgNk9Vu5T/Jsv51PXurzHTdpo3qnl8FCqqq4SZ pxVQ2A1oxJ2m5w4iZMJZdpAKiO7v9Aw6y9tSE7kOacf12sqBfPioXBNC3v5tqXutH6 V9oUL7mVEGNWbnKcAmKuL0q4g+VEejgLSprNwt+UqS5uKkihBHV88+BdalOH/2FILn DkJOF4RC5wwmNFWdQLkrh7D1P53c1Z4POdkI8rTcnZrzSrl4RQbQSVWTEgUVOjfYYF sd968+cQYROL61p0e7fyzZfbX3EY3CVXdW+9olIzZAyNfN8t/OvLH85pp3cre7Rrav 8RZusExHrrs4w== From: guoren@kernel.org To: guoren@kernel.org, palmer@dabbelt.com, arnd@arndb.de, anup@brainfault.org, gregkh@linuxfoundation.org, liush@allwinnertech.com, wefu@redhat.com, drew@beagleboard.org, wangjunqiang@iscas.ac.cn, hch@lst.de Cc: 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, Guo Ren Subject: [PATCH V7 20/20] riscv: compat: Add COMPAT Kbuild skeletal support Date: Mon, 28 Feb 2022 00:28:31 +0800 Message-Id: <20220227162831.674483-21-guoren@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220227162831.674483-1-guoren@kernel.org> References: <20220227162831.674483-1-guoren@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Guo Ren Adds initial skeletal COMPAT Kbuild (Running 32bit U-mode on 64bit S-mode) support. - Setup kconfig & dummy functions for compiling. - Implement compat_start_thread by the way. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann Cc: Palmer Dabbelt --- arch/riscv/Kconfig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 5adcbd9b5e88..6f11df8c189f 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -73,6 +73,7 @@ config RISCV select HAVE_ARCH_KGDB if !XIP_KERNEL select HAVE_ARCH_KGDB_QXFER_PKT select HAVE_ARCH_MMAP_RND_BITS if MMU + select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU @@ -123,12 +124,18 @@ config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT default 8 +config ARCH_MMAP_RND_COMPAT_BITS_MIN + default 8 + # max bits determined by the following formula: # VA_BITS - PAGE_SHIFT - 3 config ARCH_MMAP_RND_BITS_MAX default 24 if 64BIT # SV39 based default 17 +config ARCH_MMAP_RND_COMPAT_BITS_MAX + default 17 + # set if we run in machine mode, cleared if we run in supervisor mode config RISCV_M_MODE bool @@ -406,6 +413,18 @@ config CRASH_DUMP For more details see Documentation/admin-guide/kdump/kdump.rst +config COMPAT + bool "Kernel support for 32-bit U-mode" + default 64BIT + depends on 64BIT && MMU + help + This option enables support for a 32-bit U-mode running under a 64-bit + kernel at S-mode. riscv32-specific components such as system calls, + the user helper functions (vdso), signal rt_frame functions and the + ptrace interface are handled appropriately by the kernel. + + If you want to execute 32-bit userspace applications, say Y. + endmenu menu "Boot options" -- 2.25.1