From patchwork Thu Sep 14 11:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 139548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp314825vqi; Thu, 14 Sep 2023 05:35:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhpkvaSHQJ23dep574oHO3/wahiZeWepUFajI45QVO7Z8xCnE9wHvSsou5Ppqx64vouYD7 X-Received: by 2002:a05:6a20:6a0b:b0:153:b245:50ff with SMTP id p11-20020a056a206a0b00b00153b24550ffmr5822467pzk.40.1694694927678; Thu, 14 Sep 2023 05:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694694927; cv=none; d=google.com; s=arc-20160816; b=me7NMnrQv4LQRtIaAHW/XVYP7lGb1Ld6Gh/el4duZMkiSo6HDX3wipMS46pAtRssQp Jas1PsyyZm3A7vXj5BiEYQ2Dj+n4E1Jf+vZlSVP3SCoEl2zUUcnCp2UM5CqRhAnAb87q 6/jJzYkaby8TcQ/Zvbodh1uJneyTjykBVsG8J9sPQCfDROU7Wzg0dcOjXxFUoUmjgBf/ 3mGqT5nZOvWnmP7FVG4DLy9EOAqNeiS1Sz6TR4DowMZOw9OZ2w7R2hPil1bRv2I6Dhys NLkTuDSX05aYKCroOsjm0CB+N84XdMKrXg6UzF57xD4NxRO1XSlP9Cgri2XYhWeBreiW maxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=8HdXGUSJKQbHfnEXB2jRQSQa/65gSLcEGBjb3RqZL44=; fh=n7fF7QC0RNRn6F3FQu0v+CrFD4hMTQOXYoV2ln8SMUQ=; b=aAXoDoiOnOqRWS4r6MIs44L2P5V76B3ktWqTpYebZl1CJfYsRIA5hVo9gQcyL0NS0S AuNyFCjNgT6Blpu/U7vFMTcXY3rpkQbJ0vAxHeBV5hWQL/l0S6q4HOvPfHba20Jaf50f mbqDnSG5KfncNAWnoWRvgRe45GO0FpXu2HTOMSGihkRPh0Zn3vhinByuLnk1FYo0zJ+7 AB0DC76vG4mSO5CZJpNhlugbqNcgBrp9v4yZLkjZ8PFS7jfY0otC/4JewE+HM1noPC9q uzzPFiFkYCvpo4kQofqU1m9nWZcnyftfPzzYqy6po0IIKFbC9fTFk0+m85FrBT4kISy/ KbRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1LQNxdTU; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lgtKJacl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id u62-20020a638541000000b00565e67df82asi1415102pgd.437.2023.09.14.05.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 05:35:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1LQNxdTU; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lgtKJacl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 25A5D81F346F; Thu, 14 Sep 2023 04:27:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230512AbjINL1W (ORCPT + 35 others); Thu, 14 Sep 2023 07:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236561AbjINL1K (ORCPT ); Thu, 14 Sep 2023 07:27:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B158FE3; Thu, 14 Sep 2023 04:27:06 -0700 (PDT) Date: Thu, 14 Sep 2023 11:27:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694690825; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8HdXGUSJKQbHfnEXB2jRQSQa/65gSLcEGBjb3RqZL44=; b=1LQNxdTUjWiGLgXQlkJET2MljmbHWE2l+akz8PrlfepF7/AFpIhjxUM79f8GyTw9TLxCYt fBVNnOMgm3o3TO+7fWULi76C6BhihZ4pJFT7gEXiDviraxm0cUBB22JmLM7TwR61WFWkEn Y39fwBnH/JyKU1uBA5gOF1CA56ndP4QQydVmB1IuZT+ZgMhs4kwQ3nHr55Rt4QDGsV3gWi zGvBIB73QsQ81clCDqpRZuU6wjiTEaBNk9IPVNWQODMs7AwMsEY23eKveemOgbxu31d37h g6VpdaKJKANwyyvW6cLdSUFhr3JKYkfH1HNnTE4Y0h9EfwUtMvr4YWz8vq/KFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694690825; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8HdXGUSJKQbHfnEXB2jRQSQa/65gSLcEGBjb3RqZL44=; b=lgtKJaclaFfIvSNdckQgY2lL9LItv259m5pg+Hl4jZnVgm+gIiADyLvPOwSgbiYyp3RZFk C75nuh/7EnARaWAQ== From: "tip-bot2 for Nikolay Borisov" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/entry] x86: Introduce ia32_enabled() Cc: Nikolay Borisov , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230623111409.3047467-2-nik.borisov@suse.com> References: <20230623111409.3047467-2-nik.borisov@suse.com> MIME-Version: 1.0 Message-ID: <169469082483.27769.779107571531413575.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:27:27 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1769492688225577697 X-GMAIL-MSGID: 1777016428674977275 The following commit has been merged into the x86/entry branch of tip: Commit-ID: 1da5c9bc119d3a749b519596b93f9b2667e93c4a Gitweb: https://git.kernel.org/tip/1da5c9bc119d3a749b519596b93f9b2667e93c4a Author: Nikolay Borisov AuthorDate: Fri, 23 Jun 2023 14:14:04 +03:00 Committer: Thomas Gleixner CommitterDate: Thu, 14 Sep 2023 13:19:53 +02:00 x86: Introduce ia32_enabled() IA32 support on 64bit kernels depends on whether CONFIG_IA32_EMULATION is selected or not. As it is a compile time option it doesn't provide the flexibility to have distributions set their own policy for IA32 support and give the user the flexibility to override it. As a first step introduce ia32_enabled() which abstracts whether IA32 compat is turned on or off. Upcoming patches will implement the ability to set IA32 compat state at boot time. Signed-off-by: Nikolay Borisov Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20230623111409.3047467-2-nik.borisov@suse.com --- arch/x86/entry/common.c | 4 ++++ arch/x86/include/asm/ia32.h | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 6c28264..cfbd3ae 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -96,6 +96,10 @@ static __always_inline int syscall_32_enter(struct pt_regs *regs) return (int)regs->orig_ax; } +#ifdef CONFIG_IA32_EMULATION +bool __ia32_enabled __ro_after_init = true; +#endif + /* * Invoke a 32-bit syscall. Called with IRQs on in CONTEXT_KERNEL. */ diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h index fada857..5a2ae24 100644 --- a/arch/x86/include/asm/ia32.h +++ b/arch/x86/include/asm/ia32.h @@ -68,6 +68,20 @@ extern void ia32_pick_mmap_layout(struct mm_struct *mm); #endif -#endif /* CONFIG_IA32_EMULATION */ +extern bool __ia32_enabled; + +static inline bool ia32_enabled(void) +{ + return __ia32_enabled; +} + +#else /* !CONFIG_IA32_EMULATION */ + +static inline bool ia32_enabled(void) +{ + return IS_ENABLED(CONFIG_X86_32); +} + +#endif #endif /* _ASM_X86_IA32_H */