From patchwork Mon Feb 21 08:49:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 545001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6064AC433FE for ; Mon, 21 Feb 2022 08:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346567AbiBUI55 (ORCPT ); Mon, 21 Feb 2022 03:57:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346506AbiBUI5A (ORCPT ); Mon, 21 Feb 2022 03:57:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AABD24F3A; Mon, 21 Feb 2022 00:54:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EF5D3B80EA5; Mon, 21 Feb 2022 08:54:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A424C340EB; Mon, 21 Feb 2022 08:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645433646; bh=AovC+t2MnHuCX0ndjB/Skwurxy39IYuMANZuvykWO4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/jtUM4Uwo7jmbsaZ9BsK1W6OOwFTWt6yo15tIJnaJOVTA80Vg6ArR41HwOpIa4HC kGCIbp7FR0t+Keeq3RAW9jGwBgMoGrCK4IaTt0aBD4DvUeWjTofEvfLQ2KNxI2OAXC cOdLPUrQodaKMHYgmOF1Vh+TCi6+YKI0fCBAGNBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Mattson , David Dunn , Paolo Bonzini , Sasha Levin Subject: [PATCH 4.14 39/45] KVM: x86/pmu: Use AMD64_RAW_EVENT_MASK for PERF_TYPE_RAW Date: Mon, 21 Feb 2022 09:49:30 +0100 Message-Id: <20220221084911.726249988@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084910.454824160@linuxfoundation.org> References: <20220221084910.454824160@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jim Mattson [ Upstream commit 710c476514313c74045c41c0571bb5178fd16e3d ] AMD's event select is 3 nybbles, with the high nybble in bits 35:32 of a PerfEvtSeln MSR. Don't mask off the high nybble when configuring a RAW perf event. Fixes: ca724305a2b0 ("KVM: x86/vPMU: Implement AMD vPMU code for KVM") Signed-off-by: Jim Mattson Message-Id: <20220203014813.2130559-2-jmattson@google.com> Reviewed-by: David Dunn Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 1bca8016ee8ae..b1fde6a548403 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -171,7 +171,7 @@ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) } if (type == PERF_TYPE_RAW) - config = eventsel & X86_RAW_EVENT_MASK; + config = eventsel & AMD64_RAW_EVENT_MASK; pmc_reprogram_counter(pmc, type, config, !(eventsel & ARCH_PERFMON_EVENTSEL_USR),