Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp651918rdb; Fri, 26 Jan 2024 06:55:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyFJ7N35p+lPcKhiLGXXy/EftVmeFO+cWnu+0mm4gpJHgN40onCtNJv5byE9YvWUju0TTG X-Received: by 2002:a05:620a:30e:b0:783:b4f4:c76 with SMTP id s14-20020a05620a030e00b00783b4f40c76mr1605859qkm.64.1706280920262; Fri, 26 Jan 2024 06:55:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706280920; cv=pass; d=google.com; s=arc-20160816; b=IE3TcNhLA7/KOEmv0mn4hHd2F1U9cnSVeJTk2jzf84UcpKiTTasn3F09DfQAwC4e2/ z1xvKDqGge7YZ8gY6+Z2CXmQgln9NL38+hB+v3sqjGHNDd5MAZJJdwacuDku1lKVWi1O y3KplOyETpmkpTOtSHJJ5ofDCx5PKbfI49XAWh/0vwaWjAJViASV3VysMA7yO5t1DNGN yt8vbD/isrGs/sryOrLGLw4lgUoWnkSL+xMc9y/dVjy603ZaDV0DIlK36dWFxY7K3JQx q0aaqPlywfFP84/EFWFExvReVpQ0vsMYVMVyjBRwMFE8hbre1LC/juIYGfAdMpzV7Gk3 +K7Q== 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=35aOumNSQBoKMeUMu+4FlaqOYxPHx7umdo/ces4kDB8=; fh=ILHfJ0uLc1EruXziwgJ5p79BI7cXVVRZxn5LqOC7zKA=; b=KI12nPe5aO9Ks2r8zRQH4kI0YC0i2EH93ileRDK0atJVVsiUijMLEYDZ7Im5k+WTKR yzHDOJEOxRTP/wr6j4Vd9SgK1cgrp8DiZSseUk7EUfOcVfLcP1sS2i86KOkqLqZNfgXR 8/Y0ygyZXyCBDjq7ccjiZFMogRvTlgSEdz7tYFDYCPBl5lnRFpLwGO7GD6nVxsUFuUXA TUj97JN3yGVcZEn7aD8L0FKkvK+Xw5vit3zBLZavjCXMQn81AeY1t2BwDqkqEjeJlabQ LkAkycqFey7qVhmQPoF66hKaUMkKf2lXNDwWNC7gtzvH8mY3SfuJwRVzFA8IrgVmod2j R74g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Tqs/wwmI"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39854-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. [147.75.199.223]) by mx.google.com with ESMTPS id f25-20020a05620a20d900b00783cf54be25si1277714qka.168.2024.01.26.06.55.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:55:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Tqs/wwmI"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-39854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39854-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 815D31C2ADED for ; Fri, 26 Jan 2024 09:46:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6530714F52E; Fri, 26 Jan 2024 08:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tqs/wwmI" 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 505BA14F522; Fri, 26 Jan 2024 08:58:29 +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=1706259510; cv=none; b=N5fO1D5w2UYpBWA4Kau7P9lweL1y8LQ9TNesS5V4Kvp96R5M2rcYH46oCSgQlZKHHG9AL6+oRX33cQ6iUFVFgtKrsm12MnvEgnVPTjJowbkqyLxPflp8XI8Mrx+q7oqT+9F2rWljxRB9hZVcwIi/jaVbVE4bWxIQ9Fr3OxMepvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259510; c=relaxed/simple; bh=lc30mIArQmDYKUSrlU3o4au3+PWflrmT0YtX99/0sZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ui6KgKgyiId+kJhREXcvhWdF7gjRrET5I8SCniKuXhzmI+k+NbgYAR+lpOXy+zIJxlJ+fsQA+LuSy3PA+urmFs86vH0V+YY57zMnezQz9W3apZkQM43BvEKAm0cLX4ZzykQV056Z/MfJA1dfBEbejpEOqUxroOYHa0JLd4s4uSs= 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=Tqs/wwmI; 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=1706259509; x=1737795509; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lc30mIArQmDYKUSrlU3o4au3+PWflrmT0YtX99/0sZg=; b=Tqs/wwmI/OtgM+D4eRC89H0NlNzkGUf2/DJBkSPz8xIRB82NBE2gdZ11 Apev+K97+dDZngSX1Z+NBkzlVfIUzx96U0hXoI+vOo0O6WRg3n5GXizdJ ZwnyBdFRuu3ohHEKDn4TJJYf6Z+4FOhFWLYfnOkkgzxEP9ZCI+ASrWIZu yyyXDeDzYkLR/zxNlVyjgvfkc5maIgG4eZvgUvxgA3hYSv12H0hW8e9h8 1lklOh567mz/Md2oktPd2jsIGDJ4cjqmuSbHznkr8Oysmaezj3p9gp7MQ /nu6f9H25YrRWqplrr7J7YuJjrNDqNo+YnzVul7941YHQctTmOUgzg1Uq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="9792978" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="9792978" 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:58:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="930310425" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="930310425" 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:58:23 -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, Xiong Zhang Subject: [RFC PATCH 34/41] KVM: x86/pmu: Intercept EVENT_SELECT MSR Date: Fri, 26 Jan 2024 16:54:37 +0800 Message-Id: <20240126085444.324918-35-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: Xiong Zhang Event selectors for GP counters are still intercepted for the purpose of security, i.e., preventing guest from using unallowed events to steal information or take advantages of any CPU errata. Signed-off-by: Xiong Zhang Signed-off-by: Mingwei Zhang --- arch/x86/kvm/vmx/pmu_intel.c | 1 - arch/x86/kvm/vmx/vmx.c | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 9bbd5084a766..621922005184 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -809,7 +809,6 @@ void intel_passthrough_pmu_msrs(struct kvm_vcpu *vcpu) int i; for (i = 0; i < vcpu_to_pmu(vcpu)->nr_arch_gp_counters; i++) { - vmx_set_intercept_for_msr(vcpu, MSR_ARCH_PERFMON_EVENTSEL0 + i, MSR_TYPE_RW, false); vmx_set_intercept_for_msr(vcpu, MSR_IA32_PERFCTR0 + i, MSR_TYPE_RW, false); if (fw_writes_is_enabled(vcpu)) vmx_set_intercept_for_msr(vcpu, MSR_IA32_PMC0 + i, MSR_TYPE_RW, false); diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d28afa87be70..1a518800d154 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -698,7 +698,6 @@ 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: -- 2.34.1