Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4321967rdb; Thu, 14 Sep 2023 20:42:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHf9lflmfgdjy6ShsQU6NpaULzTEKNttJnExgIS/rJgqqAqIuWmAef4gVlh9OcqgGPeq5Fe X-Received: by 2002:a05:6a21:33a4:b0:111:a0e5:d2b7 with SMTP id yy36-20020a056a2133a400b00111a0e5d2b7mr737185pzb.4.1694749366617; Thu, 14 Sep 2023 20:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694749366; cv=none; d=google.com; s=arc-20160816; b=MXnZ2Kqg5tPxxnOoP4RjzovK0E9B29aapqchnKqu0Wlmjr0XGlIFS1xGcO8iBVCmZL UMsDlhKLo81s3zA0la1lhjZEIMLwxJxLBKZRp3SosHyxmgxUa5Ab4U/eiAIK7zQfO3YL 3uvtm9kqXOKCMNmZOvSMgWTw1x5LD1/9p/2Jl8tHGA64A2cNSzahJPG9JY8SQLZEKXge TgdRsiMSg0PX1y0Mj5w+ZTbCB2ZnYpc9Aui16Hf/0t1T7ynVwQsLNNL00wPgyI2T9/mW wdTq/L4FeMv0olho5bQiX5Sm04k0Qo7UsaCLZUY6JNJ/9u6tqVmIBWO+z/nfQZ+1V12E lFqg== 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.b=lgtKJacl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t17-20020a63d251000000b00573f8a5337esi2571905pgi.461.2023.09.14.20.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 20:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; 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.b=lgtKJacl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 3749582F27E2; Thu, 14 Sep 2023 04:27:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237852AbjINL1V (ORCPT + 99 others); Thu, 14 Sep 2023 07:27:21 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:27:25 -0700 (PDT) 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 */