Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp501949rdb; Fri, 26 Jan 2024 02:06:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEiRUBCDzmmwyt3HrBIeUUJp0WSm2SCF3I/3IY9cS5c8oOxow45/kANcKBMNFMqsOKOcgSK X-Received: by 2002:a9d:7595:0:b0:6dd:eac2:fcd3 with SMTP id s21-20020a9d7595000000b006ddeac2fcd3mr1219806otk.69.1706263563285; Fri, 26 Jan 2024 02:06:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706263563; cv=pass; d=google.com; s=arc-20160816; b=F2gZYGVIJLnmmxV14Q18GgPjZ8GgwR+BJYAJ1Ugp0Dc5dczpF0W0cPOBh8O9gzYCEa x5VJaCJ8rwPX4Fg2uOpZCP3EjyZhdARIbxQEI0KqNJXYkCoVDkvruIGwz7QjaLvhI7Se jQvsoybE11s1g6mZNipgGaPGKnGZ/LmkgU16UFVjMuAHzWNgAASoGmG2qU0cFUw8+Nqm W+sFsHY77rIBIDJ7ZRNTCb/vldG5zkarQm3sWDhGaz0Ukzdb67ddNLqf6vWQIyXRR9hi ASnAzAIGa1Y6/ELB7CbqC0/O4t9w96Yr5jYzt7V6TnYhGsZe64t3ENnTFZeo01eJH+RK KSfQ== 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=/7Bm+MOwn+RQO52lHb2/+ZPHs6kJCOUl/yTPwsVaQn8=; fh=fKQXo0qMcal6BogvSG9bxyWEWsAUcPVWLMmdMql1Nx4=; b=D5/UFbmT2NRrEErK6Zo5a5yfDamsRyRXaMuTcPTVfdW1Ytr5wjUuQ0Jdir9u8YsGjb YU54r4E+XfictuCosunJAImSoK2r0ddrk1vhW820ZvCLr3UPgk+JkS1wBsHFDC0dGjqS 3uERIOou7ztKJ28b+8auG8tQVKHHeBi4Tl4YxJN3tlQO0eQf4QtO65vyJCDq5w0Y0ArN qRGy4cuJrCMapep/bAvUrNnIlIPCOrEHzHhkXlwde2W+bZPvxLPxKW5o+/s00aj1zGAF ll6PERrKuAhWkm+s5ZmWWWY3adAL6L0IBkKxwd/LAx/8ZxZSJ5bISIO5NP9yb8Px6aHr 1vyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UoqDZD1p; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39834-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39834-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jp13-20020ad45f8d000000b006819be5e0a4si943246qvb.418.2024.01.26.02.06.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 02:06:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39834-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UoqDZD1p; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39834-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39834-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9D5801C297E1 for ; Fri, 26 Jan 2024 09:38:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8555145B24; Fri, 26 Jan 2024 08:57:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UoqDZD1p" 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 B9D0E145B18; Fri, 26 Jan 2024 08:57:12 +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=1706259434; cv=none; b=Aoif5RM4Qf08IjoLw3sJIGtlZdsWOBCzIBgNiYnBXWLZnrBZdzv9neR9M/h6+2Fbmn2Y/enZvE/Xgi+2oG+JWbE9y6WmqZj/nSrI7AK4MCC+O2eO8mMgdN1xq1vNkgm0HP2Xgn+7Ck9kJmddNp3zkqt7T/T2JwF6An9HuyhR9+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259434; c=relaxed/simple; bh=QMfF6UVJKJmKe5Nw2yQkoJ61OilPXSnKASfHqVZmtoU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k0W+J7AIsk+gMBeEBvq88rVb0rTu8K+ncYrkH/TY8q60eOR8p2SzrYCQBzf+FQHTeVlrtqnSqm2I8sQx0vVhjHwRp3mXWchxnnJnNBYDmFWAsxhuahn4jSG9hpiyv5tmanBv+mzXR4Cjy2/AnLSE6ZJWBeVJ9XlqWLDULo0ghkw= 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=UoqDZD1p; 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=1706259433; x=1737795433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QMfF6UVJKJmKe5Nw2yQkoJ61OilPXSnKASfHqVZmtoU=; b=UoqDZD1pbIUPp8PX804v2qArGJw/+46FXv1LvaiVkeqwBDjTofYss+Kz q6CAFb9Ne1mYU5TkxbC1gTG7xVMr8WPrD/5tfbq1kc8ZoqnklcUsI5bbW yFSmc4aLbhl/YIDvLhlbJGggpqxK5HkQQWYUOUJlKL1EGXJ1NonJOGwTM UHEqQHo25JkGXC2Bd1lvGoXOjjLq0nj2uLsZN6ZZpi5QxvuyYSPMJVWmT 8pCZfT5+eFpNGNbqVIjWX5pDJcYDQBxQh0HJuGwx/jKxHhgaQAwiDiM0b nn8/4B1fJ5IdXTQ2T6F9weID8UBpN2siohFsBpeSDq/PzmKOk/g5ME3gP g==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="9792620" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="9792620" 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:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="930310107" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="930310107" 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:07 -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 19/41] KVM: x86/pmu: Whitelist PMU MSRs for passthrough PMU Date: Fri, 26 Jan 2024 16:54:22 +0800 Message-Id: <20240126085444.324918-20-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 Whitelist PMU MSRs is_valid_passthrough_msr() to avoid warnings in kernel message. In addition add comments in vmx_possible_passthrough_msrs() to specify that interception of PMU MSRs are specially handled in intel_passthrough_pmu_msrs(). Signed-off-by: Mingwei Zhang --- arch/x86/kvm/vmx/vmx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 8ab266e1e2a7..349954f90fe9 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -158,7 +158,7 @@ module_param(allow_smaller_maxphyaddr, bool, S_IRUGO); /* * List of MSRs that can be directly passed to the guest. - * In addition to these x2apic and PT MSRs are handled specially. + * In addition to these x2apic, PMU and PT MSRs are handled specially. */ static u32 vmx_possible_passthrough_msrs[MAX_POSSIBLE_PASSTHROUGH_MSRS] = { MSR_IA32_SPEC_CTRL, @@ -698,6 +698,15 @@ static bool is_valid_passthrough_msr(u32 msr) case MSR_LBR_CORE_FROM ... MSR_LBR_CORE_FROM + 8: case MSR_LBR_CORE_TO ... MSR_LBR_CORE_TO + 8: /* LBR MSRs. These are handled in vmx_update_intercept_for_lbr_msrs() */ + case MSR_ARCH_PERFMON_EVENTSEL0 ... MSR_ARCH_PERFMON_EVENTSEL0 + 7: + case MSR_IA32_PMC0 ... MSR_IA32_PMC0 + 7: + case MSR_IA32_PERFCTR0 ... MSR_IA32_PERFCTR0 + 7: + case MSR_CORE_PERF_FIXED_CTR_CTRL: + case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR0 + 2: + case MSR_CORE_PERF_GLOBAL_STATUS: + case MSR_CORE_PERF_GLOBAL_CTRL: + case MSR_CORE_PERF_GLOBAL_OVF_CTRL: + /* PMU MSRs. These are handled in intel_passthrough_pmu_msrs() */ return true; } -- 2.34.1