From nobody Sat Feb 7 05:30:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1666267222; cv=none; d=zohomail.com; s=zohoarc; b=QYgr31rqX33TxKoyeEd9kHnJ/zUvW6Ww7Na+uSyWtFfa8RdUrwaauxk0IpJVuuuP6xKFpAqJOzIi5TIgPZqxFMC1swcrkwX2VLrzQhO8jWPNsomLmobq1Xc2r8p5ObKTemnGJJzhfd7srGYM9WsnFh3e5V+3kJD+bRncygll1S4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666267222; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=oySpgM5g+r0WCk6Eq8kGRfyxgEAOWxWakiY/c8kh3qw=; b=JOdcNz1sIMuw4yrVw4xHBeL2R81zBpsPN8c+2bm2z6qaB4Q8Dzzg0a5RWtxzJkd1osw/lgEyNyLkS5Of8/YQPYa0oaBHQvndxEctjLi1NGIhxNTyjWu6qgb/sEst78yGpTKQTW61ZLDvNPVCcyURP+Va5o5+Lu7Etpoqj4Fc8lc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1666267222380960.0686386275586; Thu, 20 Oct 2022 05:00:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.426677.675276 (Exim 4.92) (envelope-from ) id 1olUDH-0002mc-45; Thu, 20 Oct 2022 11:59:51 +0000 Received: by outflank-mailman (output) from mailman id 426677.675276; Thu, 20 Oct 2022 11:59:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1olUDH-0002mV-1J; Thu, 20 Oct 2022 11:59:51 +0000 Received: by outflank-mailman (input) for mailman id 426677; Thu, 20 Oct 2022 11:59:49 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1olUDF-0002mN-MB for xen-devel@lists.xenproject.org; Thu, 20 Oct 2022 11:59:49 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id adf798bc-506e-11ed-8fd0-01056ac49cbb; Thu, 20 Oct 2022 13:59:41 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 53C0920A44; Thu, 20 Oct 2022 11:59:48 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1077413494; Thu, 20 Oct 2022 11:59:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zs6/AjQ4UWNSFAAAMHmgww (envelope-from ); Thu, 20 Oct 2022 11:59:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: adf798bc-506e-11ed-8fd0-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666267188; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=oySpgM5g+r0WCk6Eq8kGRfyxgEAOWxWakiY/c8kh3qw=; b=JGPhQj1ZV+Sm3I4LVtq4L2JrCJZGFxiejo9qvyBgS68IuVh2HOzZyizIwaITr4r3lBXAam rB78ZqWe8tgRiWX2mcORmHaemwL1xdxp0yjq8zNmUfeecmJtUvLa7dUoD6pFb8YPEHLFd4 /SlQGRy9MJC4I/CPIUhDGbvRjCNvmiM= From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , xen-devel@lists.xenproject.org Subject: [PATCH v2] x86/xen: simplify sysenter and syscall setup Date: Thu, 20 Oct 2022 13:59:46 +0200 Message-Id: <20221020115946.18772-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1666267223905100001 Content-Type: text/plain; charset="utf-8" xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot. While at it, switch to use cpu_feature_enabled() instead of boot_cpu_has(). Signed-off-by: Juergen Gross --- V2: - use cpu_feature_enabled() (Borislav Petkov) --- arch/x86/xen/setup.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index cfa99e8f054b..4f4309500559 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -910,17 +910,9 @@ static int register_callback(unsigned type, const void= *func) =20 void xen_enable_sysenter(void) { - int ret; - unsigned sysenter_feature; - - sysenter_feature =3D X86_FEATURE_SYSENTER32; - - if (!boot_cpu_has(sysenter_feature)) - return; - - ret =3D register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compa= t); - if(ret !=3D 0) - setup_clear_cpu_cap(sysenter_feature); + if (cpu_feature_enabled(X86_FEATURE_SYSENTER32) && + register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat)) + setup_clear_cpu_cap(X86_FEATURE_SYSENTER32); } =20 void xen_enable_syscall(void) @@ -934,12 +926,9 @@ void xen_enable_syscall(void) mechanism for syscalls. */ } =20 - if (boot_cpu_has(X86_FEATURE_SYSCALL32)) { - ret =3D register_callback(CALLBACKTYPE_syscall32, - xen_entry_SYSCALL_compat); - if (ret !=3D 0) - setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); - } + if (cpu_feature_enabled(X86_FEATURE_SYSCALL32) && + register_callback(CALLBACKTYPE_syscall32, xen_entry_SYSCALL_compat)) + setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); } =20 static void __init xen_pvmmu_arch_setup(void) --=20 2.35.3