Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp499777rdb; Fri, 26 Jan 2024 02:01:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlFUTQXUFSSpk/wIEIPri+SrY4HMUzpyC0m7lriystyq8eRDywpH5JkiVNaqovRiPxMS2w X-Received: by 2002:a2e:7a0d:0:b0:2cf:2a3e:d1b1 with SMTP id v13-20020a2e7a0d000000b002cf2a3ed1b1mr682029ljc.102.1706263312498; Fri, 26 Jan 2024 02:01:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706263312; cv=pass; d=google.com; s=arc-20160816; b=OEhEeJGJc0/YXoJkzUU7UGKgrI+oy9mxGYX1vHfqMxMA7SxveuYrRsvc4Dge6fM6SQ EcgzvD9tiWZ9QOrlnJmI61JD6CxQUQTsrlu7QEosKSSXUBq1+/Gjw5ho2QpnaZJ1Riag PwFc+t0Cf1nNsSSd4nVMjGI2r1nzLASKyyBccPgyYP06mk5a/pej7qzLL/lDrz3g8Af0 VQv5lrVHYrQZ3Q7CF7TxVkSyjpa7Vb1Ge8r2ao5SWxJ/4K6A7xV9XL2OK52UwUu9R88A zBi9lUygFPANWfVCZh+xq67/ESR/9sDjnf4/6o+AiIK9Pw+Oz1GSSYm8yuHfqtTmylzZ NPVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n33NjUBdVqdTH/BGyLeW5jRCVyf3fDItwf805VWHuWk=; fh=fKQXo0qMcal6BogvSG9bxyWEWsAUcPVWLMmdMql1Nx4=; b=sPqB7ygA8Mx5mGg0ETmBHtQHc759m2j0K1EkmDN2F2rerKYrcprw8cACAM/jdYUJ76 FEWwZCOPGuTslj85gMJczt0epCj0Y9gPkmv/pv/67KKyWqxgVVy1sJGQtXOZ4Gn+DASU 7ai9WwjTzKgIFbEYOhZKHcW4/X+EkTCt7r3mXrPth4gepTQPuB8nqDzwJk7DyfFVoX3a DAVhsZSwsMNsCr4a58CTj7DiP9Z3zezC31jle3qNoiSNOBj28cFPAd5nLwwbPDDSPc8f 1e0pc4RUtsV0HlFgIYuAkRfJ1JWym9/B2TCtbE/m6xHyJ7gsZVpITDo7FOuEidvNQY0b k3QQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aMlBu1CE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39836-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f18-20020a056402151200b0055972f6452asi457109edw.576.2024.01.26.02.01.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 02:01:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39836-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aMlBu1CE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39836-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 93A021F2CDE6 for ; Fri, 26 Jan 2024 09:39:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6D0614690F; Fri, 26 Jan 2024 08:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aMlBu1CE" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A590F2CCBA; Fri, 26 Jan 2024 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259443; cv=none; b=EDcB2aDflmrmz1EQQeqVydv+dm792GUXP/kdJHFLr/oGfnArGeWqnVkfDCUqpPB0s+I7mIOKoQ2oFOCBApZhjBpfYvpJHk+4EnE30C5vi9LgWOx8pr831PvXtYSzb/1dxtkpeSoTUoT4m2B6CdNEdJILQJEXlR+mJFXOcEI2050= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259443; c=relaxed/simple; bh=V0id36e60eND+On5Khb7B6IqZw2Pup4EU6AuAcO37IM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KLRTwCAwze99ts7mhquFelYlim1oFB9FXV4XLk/NbSr2Y77rBa7h9DeA4FWa2Sg/HvUOczDL1dQfPCJ4J5NZJ3r9QbIdv/dn7hBA4k7zgcon4fX8JWPGMdUIaDh6o4dQ9v1jEXFv5DVSWtqv/dTL/zyzxEHObdMPmWeNywIPskQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aMlBu1CE; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706259443; x=1737795443; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V0id36e60eND+On5Khb7B6IqZw2Pup4EU6AuAcO37IM=; b=aMlBu1CEf7X00XIfXqywfqWgnrtGq4Nj6ZQx62OlZR4fQR+iHimjND7U G1UhXEVkaDIukeAS111U+MxB62qN7unjYFknCiwm0ud0XFPZfPIikAohm JJgTJ84umBFNOc/Vz0RWYyYofeVbdhujSNHtjVhdwlvLV1FlO3eLq3C0X lfiDT56bw10Ea2wFyQJEKzTpIH+DVAKY2/NaN9iDdMWbyuYp/6M3oOqZk O607sYmFryaKS7Km3HBqT00DDaj5uacr5u3vI8YXSZESgHaKGHxuJ0xwx /pPouLzv2S37/FI+Bg0GMWhVajIVRLjr7Z48gQCRvYvg6C2NbMHEpowIp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="9792649" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="9792649" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 00:57:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="930310116" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="930310116" Received: from yanli3-mobl.ccr.corp.intel.com (HELO xiongzha-desk1.ccr.corp.intel.com) ([10.254.213.178]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 00:57:17 -0800 From: Xiong Zhang To: seanjc@google.com, pbonzini@redhat.com, peterz@infradead.org, mizhang@google.com, kan.liang@intel.com, zhenyuw@linux.intel.com, dapeng1.mi@linux.intel.com, jmattson@google.com Cc: kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, eranian@google.com, irogers@google.com, samantha.alt@intel.com, like.xu.linux@gmail.com, chao.gao@intel.com, xiong.y.zhang@linux.intel.com Subject: [RFC PATCH 21/41] KVM: x86/pmu: Introduce function prototype for Intel CPU to save/restore PMU context Date: Fri, 26 Jan 2024 16:54:24 +0800 Message-Id: <20240126085444.324918-22-xiong.y.zhang@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> References: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Mingwei Zhang Implement a PMU function prototype for Intel CPU. Signed-off-by: Mingwei Zhang --- arch/x86/kvm/vmx/pmu_intel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 49df154fbb5b..0d58fe7d243e 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -821,6 +821,14 @@ void intel_passthrough_pmu_msrs(struct kvm_vcpu *vcpu) vmx_set_intercept_for_msr(vcpu, MSR_CORE_PERF_GLOBAL_OVF_CTRL, MSR_TYPE_RW, false); } +static void intel_save_pmu_context(struct kvm_vcpu *vcpu) +{ +} + +static void intel_restore_pmu_context(struct kvm_vcpu *vcpu) +{ +} + struct kvm_pmu_ops intel_pmu_ops __initdata = { .hw_event_available = intel_hw_event_available, .pmc_idx_to_pmc = intel_pmc_idx_to_pmc, @@ -836,6 +844,8 @@ struct kvm_pmu_ops intel_pmu_ops __initdata = { .deliver_pmi = intel_pmu_deliver_pmi, .cleanup = intel_pmu_cleanup, .passthrough_pmu_msrs = intel_passthrough_pmu_msrs, + .save_pmu_context = intel_save_pmu_context, + .restore_pmu_context = intel_restore_pmu_context, .EVENTSEL_EVENT = ARCH_PERFMON_EVENTSEL_EVENT, .MAX_NR_GP_COUNTERS = KVM_INTEL_PMC_MAX_GENERIC, .MIN_NR_GP_COUNTERS = 1, -- 2.34.1