Message ID | 20230923094212.26520-4-xin3.li@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp354057vqu; Sat, 23 Sep 2023 13:17:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmyaCgR53jBxx9Qtn/zaW7PXYgjE6aPEBMdrFq0DC9VDIbIWiXWIeCMDvAqusoqicwD9f4 X-Received: by 2002:a05:6358:c1d:b0:142:eb11:b0b8 with SMTP id f29-20020a0563580c1d00b00142eb11b0b8mr4171204rwj.1.1695500227546; Sat, 23 Sep 2023 13:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695500227; cv=none; d=google.com; s=arc-20160816; b=VRw3T6TKghsvfIyDWzkr+luzXQLuLSHselgTcb/pjb9ORB3aTv/WMbd5OBToqa2bWk /0keeoKK/H8+tAv2p3fu+mObtVltIB8B+zp/QAO8T5xfSI8hwAh+01LHEkIe7Fe/sn+e x6btbFHdsF1hatdg++vg7hOvmjTwbE/CY68T6wyCkOUTcaeotQNG8BxSGKCuk36zZwv2 UN7dJ/jAZ6UboRXU6iSdGzmwIiitsauCxvHT3EUPHz1HWnSvy/IP8pQK42kDJgcDRVAa cwu/otJY0z7+tjRrOJrLFC+uQENw0x8QjOJyld8OXdXsBLbpO6ji6bqqIIaDFVR5y3ui UJvw== 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=xG97vMcGypvclr6yOfUWfM/r9FH+1JlNHHDd3KQor8o=; fh=Tb1p8S3iOxe/kX/WSNC3xEJzSVgGJ5DaxSrKb+pzH+4=; b=Vt36SBxHiAia29HMx5vKRC79EWHnPHklr4sD9Ifu4Abv1Dzpx8/T1oQZM3BbHlCbmA Sa0Jp+Qk6wL+CfLQbYuVw/o+dYe2uciBrGiANNakpz4yvsbuR1X0mqxId/Ny0BxNBlNy zPywMOdhpXVP+5h0NbTP9X7NW8C+Kqpts2hgdfl4+dlq7oFVGHY2bXkv+S0+MAWo2g/k BwD0uCyU7kD4a12PyMYSUvmah4na9EoRkI3MgXeK4tanwCqulj25KGS4ft5eY7y5XiCG Xzen8d54NMXh1ME62862Nqbq7/bXESXq8RjtTtuwlzJg3rt9XQaco5Xw3hiU6aliofh9 B5jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m8D4g9jt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id w29-20020a63161d000000b00563ee04bbafsi6576543pgl.837.2023.09.23.13.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 13:17:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m8D4g9jt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E02DB83AC5FE; Sat, 23 Sep 2023 03:12:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230488AbjIWKLy (ORCPT <rfc822;chrisfriedt@gmail.com> + 29 others); Sat, 23 Sep 2023 06:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbjIWKLq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 23 Sep 2023 06:11:46 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 180001A5; Sat, 23 Sep 2023 03:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695463900; x=1726999900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9qsPaAmdkqHl0KD85EKfAfnheAb+UY4gBzEbjksg7Tw=; b=m8D4g9jtEHVZyc/7yeQid5UQkI622OUGXu6C5QqNnc0g8oGtbCnle+b5 DZR6YObIOQRklpoowjD/e61vfFyAedBfMsmtKHP+dAZf99oQ0Ys8cSZhq ywCv+aN/nJ9onOt/mTeMP8cOryJVkm102LyO1UoyYjcQu2Wdwap0xpBpc 9UkYzkpcfm+1Aoih3s2sHV8u15e0hMH/T7yjE3RTpXEW/BymECwW0qIOK AIc028z6VTjUPatT9lN/f+u4DWlkWss24UroYh3TMp/qlI1SF9Nc+xsis QiTluArivWyLVQTSGrjEsENXXNuUs1l6284/pBKhjCQ/k+fCO2Ecxk5sh A==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="447492106" X-IronPort-AV: E=Sophos;i="6.03,171,1694761200"; d="scan'208";a="447492106" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2023 03:11:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="813388107" X-IronPort-AV: E=Sophos;i="6.03,171,1694761200"; d="scan'208";a="813388107" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga008.fm.intel.com with ESMTP; 23 Sep 2023 03:11:37 -0700 From: Xin Li <xin3.li@intel.com> To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, pbonzini@redhat.com, seanjc@google.com, peterz@infradead.org, jgross@suse.com, ravi.v.shankar@intel.com, mhiramat@kernel.org, andrew.cooper3@citrix.com, jiangshanlai@gmail.com, nik.borisov@suse.com Subject: [PATCH v11 03/37] x86/msr: Add the WRMSRNS instruction support Date: Sat, 23 Sep 2023 02:41:38 -0700 Message-Id: <20230923094212.26520-4-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230923094212.26520-1-xin3.li@intel.com> References: <20230923094212.26520-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 23 Sep 2023 03:12:07 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777860846602661654 X-GMAIL-MSGID: 1777860846602661654 |
Series |
x86: enable FRED for x86-64
|
|
Commit Message
Li, Xin3
Sept. 23, 2023, 9:41 a.m. UTC
Add an always inline API __wrmsrns() to embed the WRMSRNS instruction into the code. Tested-by: Shan Kang <shan.kang@intel.com> Signed-off-by: Xin Li <xin3.li@intel.com> --- arch/x86/include/asm/msr.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 65ec1965cd28..c284ff9ebe67 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -97,6 +97,19 @@ static __always_inline void __wrmsr(unsigned int msr, u32 low, u32 high) : : "c" (msr), "a"(low), "d" (high) : "memory"); } +/* + * WRMSRNS behaves exactly like WRMSR with the only difference being + * that it is not a serializing instruction by default. + */ +static __always_inline void __wrmsrns(u32 msr, u32 low, u32 high) +{ + /* Instruction opcode for WRMSRNS; supported in binutils >= 2.40. */ + asm volatile("1: .byte 0x0f,0x01,0xc6\n" + "2:\n" + _ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_WRMSR) + : : "c" (msr), "a"(low), "d" (high)); +} + #define native_rdmsr(msr, val1, val2) \ do { \ u64 __val = __rdmsr((msr)); \ @@ -297,6 +310,11 @@ do { \ #endif /* !CONFIG_PARAVIRT_XXL */ +static __always_inline void wrmsrns(u32 msr, u64 val) +{ + __wrmsrns(msr, val, val >> 32); +} + /* * 64-bit version of wrmsr_safe(): */