From patchwork Tue Aug 25 08:50:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 7070251 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E05A09F374 for ; Tue, 25 Aug 2015 09:22:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21D6D208B5 for ; Tue, 25 Aug 2015 09:22:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02CE920890 for ; Tue, 25 Aug 2015 09:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755504AbbHYJDz (ORCPT ); Tue, 25 Aug 2015 05:03:55 -0400 Received: from mga14.intel.com ([192.55.52.115]:49203 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754548AbbHYJDx (ORCPT ); Tue, 25 Aug 2015 05:03:53 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 25 Aug 2015 02:03:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,744,1432623600"; d="scan'208";a="775152805" Received: from feng-bdw-de-pi.bj.intel.com ([10.238.154.58]) by fmsmga001.fm.intel.com with ESMTP; 25 Aug 2015 02:03:50 -0700 From: Feng Wu To: pbonzini@redhat.com, alex.williamson@redhat.com, joro@8bytes.org, mtosatti@redhat.com Cc: eric.auger@linaro.org, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Feng Wu Subject: [PATCH v7 05/17] KVM: Add interfaces to control PI outside vmx Date: Tue, 25 Aug 2015 16:50:08 +0800 Message-Id: <1440492620-15934-6-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440492620-15934-1-git-send-email-feng.wu@intel.com> References: <1440492620-15934-1-git-send-email-feng.wu@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds pi_clear_sn and pi_set_sn to struct kvm_x86_ops, so we can set/clear SN outside vmx. Signed-off-by: Feng Wu --- arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/vmx.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index d50c1d3..c4f99f1 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -860,6 +860,9 @@ struct kvm_x86_ops { gfn_t offset, unsigned long mask); u64 (*get_pi_desc_addr)(struct kvm_vcpu *vcpu); + + void (*pi_clear_sn)(struct kvm_vcpu *vcpu); + void (*pi_set_sn)(struct kvm_vcpu *vcpu); /* pmu operations of sub-arch */ const struct kvm_pmu_ops *pmu_ops; }; diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 81a995c..234f720 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -615,6 +615,16 @@ struct pi_desc *vcpu_to_pi_desc(struct kvm_vcpu *vcpu) return &(to_vmx(vcpu)->pi_desc); } +static void vmx_pi_clear_sn(struct kvm_vcpu *vcpu) +{ + pi_clear_sn(vcpu_to_pi_desc(vcpu)); +} + +static void vmx_pi_set_sn(struct kvm_vcpu *vcpu) +{ + pi_set_sn(vcpu_to_pi_desc(vcpu)); +} + static unsigned long shadow_read_only_fields[] = { /* * We do NOT shadow fields that are modified when L0 @@ -10471,6 +10481,9 @@ static struct kvm_x86_ops vmx_x86_ops = { .get_pi_desc_addr = vmx_get_pi_desc_addr, + .pi_clear_sn = vmx_pi_clear_sn, + .pi_set_sn = vmx_pi_set_sn, + .pmu_ops = &intel_pmu_ops, };