Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3350340pxf; Sun, 28 Mar 2021 22:53:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWFUisRGU4EncxaayktRszV6YokLxZbZd7ilRmG+GJCLgSS9WuVb14vjFM/q9dvlr88tdL X-Received: by 2002:a17:907:7651:: with SMTP id kj17mr26907836ejc.127.1616997207068; Sun, 28 Mar 2021 22:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616997207; cv=none; d=google.com; s=arc-20160816; b=xklP08IpmFZ7wq/qspKcUHtMjtIUEuCukR9jtkUwXZOJ0jhJLG+5D4ciSXIJ2KG09d CBuSWNeVRbHPSkc0nscRnZi800ZGFxcLPu6EesrJmylfJX/FGUBeM0IPBYNL5WhVVVkz t5vRL6RLVimtwsJ71A1tQ9LVKm+k5wMmwebeVrs0/YbJg89CwUHOph5AAEqeqllB30JN bYGWOOrjUEysrokPy/It2mQ8W0hWKwBVutkeyvY1HxnhmuDZ+IfSDqsm/KNaSTukViYb 66ROdhtrIMuvhfYXlQ2iEqkzAUBaUr49mBg1uva3mQ0A7cV6DgDI3bBXz7i82UkBi0QK mCDQ== 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=q6ELr4t4/a2bAqSBOffE6UkxZ90cBfqU4edH7LkDTrE=; b=yuvyKDb6gM9ZMMseqzV90URWCxW3/XeYPOw4hrMbEmdEdcdvuaMzT7topZGWiYOhV/ xTvdYkNfSJmJ1jgTYS0I7/XKc+coaRj+/yx9Y//pNSZYTd2VpflBXwojEOXefc0n75tm mOPBPKkajFuxDyO11hmgw8c83MH0ZYk+wdATJYh9g8vzUyudAo9Z3JCVjDWASTgdSXtX gZtaLPdkN2Czysj8nKVyL9qioK0W6/S/Uz6AC/7ah86Z6RJQZZ595auKpFMeoz1K/8Qj uP4f775GSRnYbusJDWDsjbqfrKcTaVJJG3leBbuZ9tlUKRS8vRSve56dOh8LRdAsIx0t ajjg== 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 n12si11778974edo.340.2021.03.28.22.53.05; Sun, 28 Mar 2021 22:53:27 -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 S231508AbhC2Fuo (ORCPT + 99 others); Mon, 29 Mar 2021 01:50:44 -0400 Received: from mga07.intel.com ([134.134.136.100]:15632 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbhC2FuK (ORCPT ); Mon, 29 Mar 2021 01:50:10 -0400 IronPort-SDR: QRjePKb2aiIbuSFF0GGpN+83OK2PLTrl+cp0bgE7qQm2jEGmeMRap/mKzCKfC8GHNlcQnsYXK5 gPgbuMxr3YZw== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="255478760" X-IronPort-AV: E=Sophos;i="5.81,285,1610438400"; d="scan'208";a="255478760" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2021 22:50:10 -0700 IronPort-SDR: 0RsMMBRdIHj1TX5nrYvA99xF+xI1tn3zn8p+ReAPw6LveHeV8NJoEcGe8lZFt8/rSjXpXNBl8E p6MpEHQiA/XA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,285,1610438400"; d="scan'208";a="417507014" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga008.jf.intel.com with ESMTP; 28 Mar 2021 22:50:06 -0700 From: Like Xu To: peterz@infradead.org, Sean Christopherson , Paolo Bonzini Cc: eranian@google.com, andi@firstfloor.org, kan.liang@linux.intel.com, wei.w.wang@intel.com, Wanpeng Li , Vitaly Kuznetsov , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v4 12/16] KVM: x86/pmu: Move pmc_speculative_in_use() to arch/x86/kvm/pmu.h Date: Mon, 29 Mar 2021 13:41:33 +0800 Message-Id: <20210329054137.120994-13-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210329054137.120994-1-like.xu@linux.intel.com> References: <20210329054137.120994-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 It allows this inline function to be reused by more callers in more files, such as pmu_intel.c. Signed-off-by: Like Xu --- arch/x86/kvm/pmu.c | 11 ----------- arch/x86/kvm/pmu.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 8d2873cfec69..0081cb742743 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -476,17 +476,6 @@ void kvm_pmu_init(struct kvm_vcpu *vcpu) kvm_pmu_refresh(vcpu); } -static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc) -{ - struct kvm_pmu *pmu = pmc_to_pmu(pmc); - - if (pmc_is_fixed(pmc)) - return fixed_ctrl_field(pmu->fixed_ctr_ctrl, - pmc->idx - INTEL_PMC_IDX_FIXED) & 0x3; - - return pmc->eventsel & ARCH_PERFMON_EVENTSEL_ENABLE; -} - /* Release perf_events for vPMCs that have been unused for a full time slice. */ void kvm_pmu_cleanup(struct kvm_vcpu *vcpu) { diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index d9157128e6eb..6c902b2d2d5a 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -149,6 +149,17 @@ static inline u64 get_sample_period(struct kvm_pmc *pmc, u64 counter_value) return sample_period; } +static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc) +{ + struct kvm_pmu *pmu = pmc_to_pmu(pmc); + + if (pmc_is_fixed(pmc)) + return fixed_ctrl_field(pmu->fixed_ctr_ctrl, + pmc->idx - INTEL_PMC_IDX_FIXED) & 0x3; + + return pmc->eventsel & ARCH_PERFMON_EVENTSEL_ENABLE; +} + void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel); void reprogram_fixed_counter(struct kvm_pmc *pmc, u8 ctrl, int fixed_idx); void reprogram_counter(struct kvm_pmu *pmu, int pmc_idx); -- 2.29.2