Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp974813pxx; Thu, 29 Oct 2020 20:58:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1uaGccZ53kLPUnis0+tUvoaF1ldaeOFy3ezJOm3LITFU/2qYQxgCtSHsNdqqGTOi1YO2j X-Received: by 2002:aa7:c704:: with SMTP id i4mr245869edq.51.1604030306748; Thu, 29 Oct 2020 20:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604030306; cv=none; d=google.com; s=arc-20160816; b=0zH6L0wFFefm91rhdgrM5OM2kwr0OPlJDVP1W7kwXOktxdyb0S/qqBGWt8lhOIqpD4 aVssncFBRlP44itmfZbo76SrMJLbxE6RW8GK4PjYT2va3fdcuzyGOTeq+ghLWvsgperj KWAhvXLUQTAcwTJ3RyxDOyRVYc3teSFy27BYA86r2eJo3zPvrSAMlVmYpANMCIEkgGwc 5jqTCheBy1MnW1va1d0SoYvA98TyfyKHQ+vPK19zyTk2myqdMLei3VBSAhi5W4zBjMrL y6RJZvs3sjHvSYe1r1AfW3nVTGbQNPPn3r+j6Podd16hz5HML0CEZSMdGzVar7wy1WKO S5EQ== 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 :ironport-sdr:ironport-sdr; bh=+KS2JchWNiqx+wWff+h7stRjsypLyQaFeeuBPF0YNg8=; b=aBtfDFpur5ICQClokGcCRYl3nMtAM2CxFJrOrPb9wdNuIm5rjYzzExF8/aR1iXzWbX 9J1xNuLDSSTwoRAbi3g/rke8a9wj3UsKoAhxWZlIzNVp2UinWaxDH0eyDwUxDbH6tNk/ T+v5E84Bo7+QSmAqHiZcjhqQtJk9CEoWYykJh2huU2Ek+u3rumqdX5lPlc1cHt18s5lj +ynnv1rQ6gd1Ia8xQopHGm16MFpbUpftm5G8z/ZXJe2BI9prmvqs/yfAZcfPy6vTNoVw AwD0qb3S8F0Uw4Rq4kWlQli62RfaKsg4+Zh3WgD1r0dtzo6imvwaRTfEX6LHAp0m3llm d73w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si3483696edr.183.2020.10.29.20.58.04; Thu, 29 Oct 2020 20:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726384AbgJ3D4o (ORCPT + 99 others); Thu, 29 Oct 2020 23:56:44 -0400 Received: from mga09.intel.com ([134.134.136.24]:4238 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbgJ3D4n (ORCPT ); Thu, 29 Oct 2020 23:56:43 -0400 IronPort-SDR: cn+X+mMRBdsXM3H7JPHE1aRuTU99+VUQ+wWK1m6cy3cvLeY/hO/svT7T4Asar1tbSePFi7Up5O hq16o0jVeTWQ== X-IronPort-AV: E=McAfee;i="6000,8403,9789"; a="168685735" X-IronPort-AV: E=Sophos;i="5.77,432,1596524400"; d="scan'208";a="168685735" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2020 20:56:42 -0700 IronPort-SDR: QOnp9+w/Jn9qEmdAlU/HRL1fIh3DwDlK4H7NjgvjMNnYR4zhy71OLIMyns+Pav1nn6j4pkyw8C KtmTSCOjwg8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,432,1596524400"; d="scan'208";a="525770411" Received: from sqa-gate.sh.intel.com (HELO clx-ap-likexu.tsp.org) ([10.239.48.212]) by fmsmga006.fm.intel.com with ESMTP; 29 Oct 2020 20:56:39 -0700 From: Like Xu To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND v13 02/10] KVM: x86/vmx: Make vmx_set_intercept_for_msr() non-static and expose it Date: Fri, 30 Oct 2020 11:52:12 +0800 Message-Id: <20201030035220.102403-3-like.xu@linux.intel.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201030035220.102403-1-like.xu@linux.intel.com> References: <20201030035220.102403-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To make code responsibilities clear, we may resue and invoke the vmx_set_intercept_for_msr() in other vmx-specific files (e.g. pmu_intel.c), so expose it to passthrough LBR msrs later. Signed-off-by: Like Xu --- arch/x86/kvm/vmx/vmx.c | 2 +- arch/x86/kvm/vmx/vmx.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index c12faeebd390..4085c90c8fc2 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -3788,7 +3788,7 @@ static __always_inline void vmx_enable_intercept_for_msr(struct kvm_vcpu *vcpu, vmx_set_msr_bitmap_write(msr_bitmap, msr); } -static __always_inline void vmx_set_intercept_for_msr(struct kvm_vcpu *vcpu, +void vmx_set_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type, bool value) { if (value) diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index f6f66e5c6510..cf9d27f1e122 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -341,6 +341,8 @@ void pt_update_intercept_for_msr(struct kvm_vcpu *vcpu); void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp); int vmx_find_loadstore_msr_slot(struct vmx_msrs *m, u32 msr); void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu); +void vmx_set_intercept_for_msr(struct kvm_vcpu *vcpu, + u32 msr, int type, bool value); static inline u8 vmx_get_rvi(void) { -- 2.21.3