Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3127664pxj; Mon, 10 May 2021 19:46:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOuElEGH7O9+E15J4MoSwqT/5dcqynj7YUHYi8AaTRS+DSZH66MRkCql/UYh21B+62+wL/ X-Received: by 2002:a17:906:2557:: with SMTP id j23mr29526384ejb.153.1620701184989; Mon, 10 May 2021 19:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620701184; cv=none; d=google.com; s=arc-20160816; b=UEDvqkMdYwQOJ/1d917pnFR5SGcQFOISEJYiwk/f7LvDvDj4j/akuehzMlcQbBO/aC 8DfnhvP7rBm8UEM9XB777Cyciuu6agWv8gdoFIYHvnFsU2cQRssADoa08uH7jdMOW99x 1uL9wKqToqICSdevmDXpjoS+3OrLX3Nx8RZv2u1qID7XusRvQQzq9H9luHtXCnI28k/J AylXI5s0eVRk84A3YFGurQ4Ew1YWMVCa3jevaXNSKLzkqoK9hHg4Sp1Ptmmee+JWaDhW HeT7sM0Too6AdIn2Er+F7Ovh+LDXxcGpJwQ1tfAXzDW2IqEdkrBJ1PVPhz0/hCi4yztr DnkA== 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=cYObg9kiH59kNtubL5+mgdu9WxRlWMDw9bxdKGVkJFo=; b=zmGZzVK10cUynnO61HgFWPvHjP84cHiLl//LzqZGqsp4N+WP2JZYzgZTyUHldRB3QI 3fzYNR8OZO4T9QPx31Ru3hIbw5J9aFF2leBoCpH/zevGGniJGUrTRXaPpozPlY4c/dhP qw69O/rSUm/6/rOdySiDSkb/eitUeBQy1jv7uMziaotzcx4q6IiAvg+dgcVjHlQR0j7l 6fyrImLvGWlYQojJUcozbrVV7VdfHxWGd7hxViPTa3RVf2zLOo0G2BIiSb76QSWKiBZI t2u6K0OKM7gMKGfkd45Rabw7WbZSn2uTCMyfAJx1t1eqDpj1V3yuXIyoczcdAAfUUolV 4Apw== 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 i8si18566185ejj.196.2021.05.10.19.46.01; Mon, 10 May 2021 19:46:24 -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 S230388AbhEKCpG (ORCPT + 99 others); Mon, 10 May 2021 22:45:06 -0400 Received: from mga14.intel.com ([192.55.52.115]:39584 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbhEKCo5 (ORCPT ); Mon, 10 May 2021 22:44:57 -0400 IronPort-SDR: iw2yoRrB9avElMA+ouCvM6CjiaOGns6Rsehklnvd6kt7p4ssYWasTiSMkMGPHosrxppI7DkSAr ek47pyhYklJQ== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="199015637" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="199015637" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2021 19:43:51 -0700 IronPort-SDR: gfkhSxh9I0leKjWYG9u6VSW4Cap09WkiVaaGULKE9EhcZqK+bsyb1zLatH+TO/jwuuWzHZZaQK xdWHlbOskjeQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="468592014" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga002.fm.intel.com with ESMTP; 10 May 2021 19:43:48 -0700 From: Like Xu To: Peter Zijlstra , Paolo Bonzini Cc: Borislav Petkov , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, Kan Liang , ak@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Like Xu Subject: [PATCH v6 12/16] KVM: x86/pmu: Move pmc_speculative_in_use() to arch/x86/kvm/pmu.h Date: Tue, 11 May 2021 10:42:10 +0800 Message-Id: <20210511024214.280733-13-like.xu@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511024214.280733-1-like.xu@linux.intel.com> References: <20210511024214.280733-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 1af86ae1d3f2..ef5b6ee8fdc7 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.31.1