Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp433427pxb; Wed, 14 Apr 2021 20:23:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMw5pb3QWvrDyh6XRQ52Vc9RjmCJPyQdEHhkR2y2d4SGEOjwYPRsyw/lavZMufO0n2WCIK X-Received: by 2002:a17:907:3f22:: with SMTP id hq34mr1154388ejc.535.1618457017504; Wed, 14 Apr 2021 20:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618457017; cv=none; d=google.com; s=arc-20160816; b=BVu2+Q48IQgfToXjVQx/dT9/cMHDdV9tzlybNnsNqRzgEUM6hERKcMk2T1H/Wl76YG o2aR7vfTlvrX10U5cN0rwHQz4WiKoHYS+rHAdCzbtv+jAm4pv57R7i0vCb7YakJv0g7S EIxXEkZ5z4fYWWZ6Kt6WRY30bybdYQDvKeNWatc4hP0VnV4wGRKktF7pwCn8mqko9eff ohL98d1YNyeT3YP86C8GhLO4jk7lxn3qI2/yNoRKSlqPg/S3TifkOSSu6syVyDZVCgbf V3SSr9/LmODDYbVA+uVkS/Y6XsdGNpodm+IzdcWZj0OnfCztareRDeKxCXZZckjdSZcj Mx1A== 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=mrm6m3eVL6iIT7nPfcx9sFVV+17N3vhOK8gEaPjnqG0=; b=Oawvzd0eGAx7+XsrQoxvQiUPChhmsVZTqubfwUzzdD8vAAdRifVdAdq5E+epDKmU1h FExXuUyOVmNqCKCTNVXlmcVT9PP8LPNRi/u9aL0m4zE4eYexGKS9phGuJbAovn+P1WNE 6Dd4DVlBN0OtY/SZ70iaWM2Sr3wU53NOpbpyLDYApYWNssOQM98dsontrGW3YJv0hNKn Aw1ydrseOK5oOMcRKheMeOmtg7ZbwfEwkLzPoZoZSVzKM1Fu0luvt702kD8r+N01I8gI wDOXYe8OD/rFL/8yUNb2efRMSUPF73IkBqPw49z7BnfZMvWTB3TWN2i/JrjQJWX0iIm0 I3TA== 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 ds7si1217265ejc.534.2021.04.14.20.23.14; Wed, 14 Apr 2021 20:23:37 -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 S229996AbhDODVl (ORCPT + 99 others); Wed, 14 Apr 2021 23:21:41 -0400 Received: from mga01.intel.com ([192.55.52.88]:10604 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbhDODVe (ORCPT ); Wed, 14 Apr 2021 23:21:34 -0400 IronPort-SDR: 5CSX7fI/2lti08Cd5rk7iB5Jv3a13bc6IEyivLjT1b2oq4G6KCb8OCGuP6ys4rT2AZscVYe9lj 0wfUWwFzOvNw== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="215281582" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="215281582" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 20:21:12 -0700 IronPort-SDR: EnmolPtiJZv+8UBz8gKwXl0dleOdSj+e9InDrLsa0n7tabMLNEblOkd/or3g/QI6bLIUMVc0ET mOYR54lrJ1DA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="425014089" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga008.jf.intel.com with ESMTP; 14 Apr 2021 20:21:08 -0700 From: Like Xu To: peterz@infradead.org, Paolo Bonzini , Sean Christopherson Cc: andi@firstfloor.org, kan.liang@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v5 12/16] KVM: x86/pmu: Move pmc_speculative_in_use() to arch/x86/kvm/pmu.h Date: Thu, 15 Apr 2021 11:20:12 +0800 Message-Id: <20210415032016.166201-13-like.xu@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210415032016.166201-1-like.xu@linux.intel.com> References: <20210415032016.166201-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 d3f746877d1b..666a5e90a3cb 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -477,17 +477,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.30.2