Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp827378rwi; Thu, 20 Oct 2022 05:51:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OelYFVEBNBaBDw2yeflxBnFYzsqHXzRl+W6h5RzZN0KoduODYI6YMdp+tWgBCC+9awcRv X-Received: by 2002:a05:6402:1604:b0:458:b2b7:bd5a with SMTP id f4-20020a056402160400b00458b2b7bd5amr11578420edv.73.1666270310223; Thu, 20 Oct 2022 05:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666270310; cv=none; d=google.com; s=arc-20160816; b=efSYv0fmWRd9pwm146U2FMGEFJ+LXuIXKoBiFm7G0i/s2ggCFH7W6qYEcXGCVmSH7U DVvPXmIjLp/I9vl5Y3KfsOvBTS9MQ/jzSJlgGhXXup2jr+nwE3d+XFMh71Fsyn/MOgbW DO1wy2LJfebWJ62Nn/sGfHWpMggpMKdDOJbIAVH+jroECDTkJ6A6yk4aTTw1oLUiO/3X uGNIyJ58a0ICdSW+zuIiXYaR/j9qLrkXrXCgXUT2GfPQwHKa71zkTrGerjqz4YDtoBpF 3iTqHVTR0UbaQ3KIE6cKkeJb9f1UC5okicaqkKGiEAuA3akzOuavID2z7PGMunTWkuiG 7urg== 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:date:subject:cc:to:from:dkim-signature; bh=KHnL53pJczBHTqmZO1LrKItRzowSRHTkckS9BjAXjoE=; b=l7jkH9BN9Vby5GFnR6RAJ74Moq22YAoIsd1D8Q+QXUbv/X7LIZuCOFn7dDOh64JxW2 UMAyT4ojWxZLBreWj47z/0cDieCjD/2iIrP+xQrVtZJa9zomqRwhjl0Zn1/lEYF+hWAi hfGv510lmLaayEdrkSh3n1GoEwDNxSRj+0gbIYVh7jeUom77D9SFWnqEy+xRAYlRhNie TptdlaXMW9DGP7u8ebR762/QgE3NdkfSwnd3qoFdGNpI5d7vZRnkTZi29ZlOzOr3D5Nv gZ6H795mRfnmtkaKGPLwF8xq2woo7NJRzChMLAWxvpXhczBlDJ9UbrvSvkQItg9jVTq9 M2Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=lYmD0CMx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js22-20020a17090797d600b0078dcfe6a000si19226274ejc.727.2022.10.20.05.51.24; Thu, 20 Oct 2022 05:51:50 -0700 (PDT) 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=@suse.com header.s=susede1 header.b=lYmD0CMx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbiJTLgq (ORCPT + 99 others); Thu, 20 Oct 2022 07:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231372AbiJTLgb (ORCPT ); Thu, 20 Oct 2022 07:36:31 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 981A81DD889 for ; Thu, 20 Oct 2022 04:36:23 -0700 (PDT) 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-out1.suse.de (Postfix) with ESMTPS id 9DAB72187E; Thu, 20 Oct 2022 11:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666265781; 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=KHnL53pJczBHTqmZO1LrKItRzowSRHTkckS9BjAXjoE=; b=lYmD0CMx11/mhtHCnBMiU+WOl6vGhTpj/AiSjI9Y+eV6rL+Dhg8BSZjQG7421+kDbaFA0U CWHhBrzKzEkziGciqXPpbYv4fDQ3jH6dX3UkmdjaRulsa6RdNE4FvubOZnffhyyS/Px4vG IzZ7CeB9/zCegnAa22lBFdmlAaSAuZo= 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 4D0EB13494; Thu, 20 Oct 2022 11:36:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Jr9bEbUyUWPWBQAAMHmgww (envelope-from ); Thu, 20 Oct 2022 11:36:21 +0000 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] x86/xen: simplify sysenter and syscall setup Date: Thu, 20 Oct 2022 13:36:19 +0200 Message-Id: <20221020113619.17204-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot. Signed-off-by: Juergen Gross --- 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..0f33ed6d3a7b 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) void xen_enable_sysenter(void) { - int ret; - unsigned sysenter_feature; - - sysenter_feature = X86_FEATURE_SYSENTER32; - - if (!boot_cpu_has(sysenter_feature)) - return; - - ret = register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat); - if(ret != 0) - setup_clear_cpu_cap(sysenter_feature); + if (boot_cpu_has(X86_FEATURE_SYSENTER32) && + register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat)) + setup_clear_cpu_cap(X86_FEATURE_SYSENTER32); } void xen_enable_syscall(void) @@ -934,12 +926,9 @@ void xen_enable_syscall(void) mechanism for syscalls. */ } - if (boot_cpu_has(X86_FEATURE_SYSCALL32)) { - ret = register_callback(CALLBACKTYPE_syscall32, - xen_entry_SYSCALL_compat); - if (ret != 0) - setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); - } + if (boot_cpu_has(X86_FEATURE_SYSCALL32) && + register_callback(CALLBACKTYPE_syscall32, xen_entry_SYSCALL_compat)) + setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); } static void __init xen_pvmmu_arch_setup(void) -- 2.35.3