From patchwork Thu Nov 3 11:36:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 14832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp482717wru; Thu, 3 Nov 2022 05:02:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CQfL5+rAZsuUjJUO1E3eZ7+zbsY5MLAuPLRg5+hJMFfq5L3t0o2bHRDe+sgil3kKUX/03 X-Received: by 2002:aa7:8502:0:b0:56c:349e:c18b with SMTP id v2-20020aa78502000000b0056c349ec18bmr30012971pfn.1.1667476934601; Thu, 03 Nov 2022 05:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667476934; cv=none; d=google.com; s=arc-20160816; b=t9ipKNDY7iOqIHnnIRNe8KJMDvJv9D8aiLt51vDjGPUrreYV0rzUzbhcN7dBirl5ns lVIyd+dIhlYPPykH38IEJ6+gAS4M5HuYEsI1Ccpn2uWBZ9ZdyzVnrhzWFRUGvYrIF8ho me0WPoKLOUQ9qeVM5fN+DAftr6beqCX7MaEsTQI9k1WtZoa2Z8psGSn7cJIcPdXGVPKF y/ejssr9OplaoJ+QQ+2mQN+1uqWUzC89JncPUayr4pTNiUCTpa+Wl/MTVhJ9gYktFixX whBdC64mUIeZsFLyzPWRqoj742TU004dWa+aex5b/+vKyQdsxNFUvOor4XBZJwKynedW afcg== 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=ZIOvMf0VCiOOdx+pSynOR3iuEcnpBNHWVTTFgfhwJA0=; b=GCzhx0AchGyCh6FI14Q1xzPIs4NJ9IZVNAehfkFD1nv3YHJK92qRnBWJ97rw5XZMe8 MI808EUBsk3OCGuvaxN1jyUzHxdfCai6eHi3Lwx9d9JKphBPjn7rqmTo4EcjwYkmnf3y HFvDN4/3tXxDULVV6VE2k1x5eLRNVJtNlOzmJIktH8LikDUkZrJORUsMTUoljtwjca5g 2jpMdCo9Vo3g4UZQryeE8BujupGihwjyBIZhzt2uCR1RYcjPx3tsp6swtshGDwC00KlT 76Pf+bcnSkrBODX0iZNWlC6gP906EjNCShL2882QFd9QbjPcg1X8XqGxwuKd4Z7VQQ2s vTsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fO1ejgT0; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056a0008cd00b00561741403adsi813064pfu.182.2022.11.03.05.01.43; Thu, 03 Nov 2022 05:02:14 -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=fO1ejgT0; 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 S231395AbiKCLh3 (ORCPT + 99 others); Thu, 3 Nov 2022 07:37:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231394AbiKCLhF (ORCPT ); Thu, 3 Nov 2022 07:37:05 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 566861277B for ; Thu, 3 Nov 2022 04:37:03 -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 166CC21D0A; Thu, 3 Nov 2022 11:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667475422; 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: in-reply-to:in-reply-to:references:references; bh=ZIOvMf0VCiOOdx+pSynOR3iuEcnpBNHWVTTFgfhwJA0=; b=fO1ejgT0w/DmBPnCcekStE+j5Ba1MxipPnWjty4ItWonrZW8emL13QsK3CyLpMp7ti2ocl NPZwcfbd0UZyS8/Ymg+PB5tihoXT+b1ROeA1QuVQVER0mOInjZL2lvDz3TUAceDiQgIi/r 8OyYwe/f9Kxj1WP9EttpVfi85fRi2Jk= 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 C477313480; Thu, 3 Nov 2022 11:37:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3+lKLt2nY2MLHwAAMHmgww (envelope-from ); Thu, 03 Nov 2022 11:37:01 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH 3/4] x86: drop 32-bit Xen PV guest code in update_task_stack() Date: Thu, 3 Nov 2022 12:36:35 +0100 Message-Id: <20221103113636.25543-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221103113636.25543-1-jgross@suse.com> References: <20221103113636.25543-1-jgross@suse.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748476294114609335?= X-GMAIL-MSGID: =?utf-8?q?1748476294114609335?= Testing for Xen PV guest mode in a 32-bit only code section can be dropped, as Xen PV guests are supported in 64-bit mode only. While at it switch from boot_cpu_has() to cpu_feature_enabled() in the 64-bit part of the code. Signed-off-by: Juergen Gross --- arch/x86/include/asm/switch_to.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h index c08eb0fdd11f..5c91305d09d2 100644 --- a/arch/x86/include/asm/switch_to.h +++ b/arch/x86/include/asm/switch_to.h @@ -66,13 +66,10 @@ static inline void update_task_stack(struct task_struct *task) { /* sp0 always points to the entry trampoline stack, which is constant: */ #ifdef CONFIG_X86_32 - if (static_cpu_has(X86_FEATURE_XENPV)) - load_sp0(task->thread.sp0); - else - this_cpu_write(cpu_tss_rw.x86_tss.sp1, task->thread.sp0); + this_cpu_write(cpu_tss_rw.x86_tss.sp1, task->thread.sp0); #else /* Xen PV enters the kernel on the thread stack. */ - if (static_cpu_has(X86_FEATURE_XENPV)) + if (cpu_feature_enabled(X86_FEATURE_XENPV)) load_sp0(task_top_of_stack(task)); #endif }