From patchwork Thu Jan 12 07:20:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 42278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3748999wrt; Wed, 11 Jan 2023 23:48:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXtmo6vn1uSxWFn0pNmqC9hzwCDmYu1HYz1NXiHEptGopLUpB26/YtTSehsBzCe2nqqU0fP2 X-Received: by 2002:a05:6402:e0a:b0:46c:b25a:6d7f with SMTP id h10-20020a0564020e0a00b0046cb25a6d7fmr74736515edh.8.1673509719063; Wed, 11 Jan 2023 23:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673509719; cv=none; d=google.com; s=arc-20160816; b=1CHSSlxsQVssFw/32+08SimM9KLXw6iqLJ9OtWCcdJvAXg1w+uaUwT/tYNKdcRHov9 ocjkWDQeWnzw1Ijzj6H/ztE8+9EcjFz8TyB4sdQI32vFMk2x76TQt6FaSXRt4hCcxQzV SYoIjBCAt1RTkkZw1NIPTyDQZLR6rykOOckhZcy2ovhoQ9tlI9njU+N8JcDPCkQw0hW8 dp1IhsNwoHKb9pxyg9mopBDCtdGSbK9R4KeQYYuj0Qyy6j97L9iCtPUfwN5PuhfgpqNo yZpC0B/5nkqoBxYaKlKrAdrafKk+/BItMG6iWIWo6ED6Rmaq0X5WswhCHJ37BvXXSSfm 4H6Q== 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=o61mGWGF3CI7a4YSsBNgSFAAtmSOuQLpyKUcYQ2czGs=; b=EbUQh2OdAjg+su1eomGnWgpFm78rydWi85GoSkMXVgfOFdWQPPdITbyg7rkTbk3GAM gbGFCKBuijXZqlZ4nbyYCslLIKCpv76nm/hWd9wkeSPgX6wqrZQoLNjbo4XzQ0CcITjL gZVnXvcgY2QOdsepUAoRE8vuuK+pY+rq33QNHmngxSxntBuNMr/J6IXREBcw1R/tBIhr ZYbUcubyv39wyT7bPuTBowuHDo0qo98XLemOp4BkRDTx+oJk0gpe9JHVo+OoPR7WV6al Udu0XblkfdDBEYYoi5A/zpq4lUmCA19z/liaOZI4lLI4YbG/iSTzTMAjb2cRyzCv44eL VSWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="gc/JXR5l"; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a1709065d1000b0084ca32731dcsi18186899ejt.675.2023.01.11.23.48.15; Wed, 11 Jan 2023 23:48:39 -0800 (PST) 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=@intel.com header.s=Intel header.b="gc/JXR5l"; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236638AbjALHoh (ORCPT + 99 others); Thu, 12 Jan 2023 02:44:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238542AbjALHoY (ORCPT ); Thu, 12 Jan 2023 02:44:24 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6542540868 for ; Wed, 11 Jan 2023 23:44:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673509463; x=1705045463; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OY4mJD00oqqr2RtKHljKwaZ/6wONtTTVjhA0Ev1fnaU=; b=gc/JXR5ld2zLsbie2G+7xlg9QHANKReSHrb58iuWOZWXq5ROfqNJuAGn MexNFnCMACaODP5QL+1hm0FzwSYeWdvgiZEtVPeG6z6o0JaWONAHCn6/a wDdHwFQ5jZVE/yD8jhHVt5+W0HoaRfwxaeH5zFGeEW4xfyBRZcCjG/CF8 uBenFzEa4JTKgWiZEbIfiSX4zjiTZjHHWBys4xk0l8kLCb0rXKT05qtQv UMNsxPukwCKBO9V/EzE1ATLsRbTSGQp3hBWdAXeeUjiSRUF0FlTgLA9/i fJW++FJ5IuxJho1hrHKUT6718jOyVhRRoTcMi73nxpSb/uajc97k0oRrZ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="321328696" X-IronPort-AV: E=Sophos;i="5.96,319,1665471600"; d="scan'208";a="321328696" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 23:44:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="635283951" X-IronPort-AV: E=Sophos;i="5.96,319,1665471600"; d="scan'208";a="635283951" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga006.jf.intel.com with ESMTP; 11 Jan 2023 23:44:22 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, brgerst@gmail.com, chang.seok.bae@intel.com, jgross@suse.com Subject: [PATCH v6 3/5] x86/gsseg: make asm_load_gs_index() take an u16 Date: Wed, 11 Jan 2023 23:20:30 -0800 Message-Id: <20230112072032.35626-4-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112072032.35626-1-xin3.li@intel.com> References: <20230112072032.35626-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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?1754802127377749728?= X-GMAIL-MSGID: =?utf-8?q?1754802127377749728?= From: "H. Peter Anvin (Intel)" Let gcc know that only the low 16 bits of load_gs_index() argument actually matter. It might allow it to create slightly better code. However, do not propagate this into the prototypes of functions that end up being paravirtualized, to avoid unnecessary changes. Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li --- arch/x86/entry/entry_64.S | 2 +- arch/x86/include/asm/special_insns.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 15739a2c0983..7ecd2aeeeffc 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -782,7 +782,7 @@ _ASM_NOKPROBE(common_interrupt_return) /* * Reload gs selector with exception handling - * edi: new selector + * di: new selector * * Is in entry.text as it shouldn't be instrumented. */ diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index 35f709f619fb..a71d0e8d4684 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -120,7 +120,7 @@ static inline void native_wbinvd(void) asm volatile("wbinvd": : :"memory"); } -extern asmlinkage void asm_load_gs_index(unsigned int selector); +extern asmlinkage void asm_load_gs_index(u16 selector); static inline void native_load_gs_index(unsigned int selector) {