Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp685559ybv; Thu, 13 Feb 2020 07:45:07 -0800 (PST) X-Google-Smtp-Source: APXvYqz2YLwQkIPJPqdH4pFSla1pRv2xQGtbBxYtd7q3rQ9ZdaLleDdDGQqj8xJDugN6SDBJC5xW X-Received: by 2002:aca:ab51:: with SMTP id u78mr3389097oie.21.1581608707204; Thu, 13 Feb 2020 07:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608707; cv=none; d=google.com; s=arc-20160816; b=ckqEpNWayX4BcT0lu+5PxJBAtkk3OUmJNhyWctTK/Nwy4SEK2MOO8l3pHrvgbGdFxu GcdCZFXyIhaAAI1gT8LgYES7QwLM2LUixb/yJhfRat75XfVinVzn3O5irvMnJvKUR2jW SticWu5Tjl+0wwo8YHNOOW6e8ebkcesVi65u1AyUOFrG4yu+8Slp97VpTtIy4JoqQB54 i1F7192AHyfhoYn7lYNJ87MggnhEdMKj4FUPlRZSpBg7nQK85+QWLr3AXQc/6YYH20CU W7OJgNLgiqXMONw+ol1OIVaRxdcuAv3m2W0ylXe8xAD9Uzf+tz6HoHlL3WuASLSnJkYp 8gUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=98V+sK3KYq/bI0ujBUvmVJYR0FF7T7eaVJB2Ku+Q7w8=; b=MSE12mqFAMhR3WHakCv2ZHyUQ4aMtd05pUdeMfSc1Wnix1leYTppZqkdL0zqh492AU XzfWIP+jd5HsYmrJ2NBaX+DNJnvBDHITCFpS5YIWM/ojit882SH4Orckf6vLPzznyPZE X+k+2Lqzu9YyKEWoieO9BpsFACTC21ydA29eUTFES4g0kAyrm2EwNdMBbll1WK7e5MMy O+80CkT1DD/DJ6kK1mQ3c324DrR6/rU5F8MwY6wYsr6Y/6jEatvYszbIB5/Tq9bvTUc5 v1zQRrRfIa+F7gC7kVQ9AU4r1pkM3x1y7GW96zF6Oxb+/HzhugdLtOhLiqLu6BICDmpx z/zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qah9WawN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si1282422otn.117.2020.02.13.07.44.54; Thu, 13 Feb 2020 07:45:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qah9WawN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729566AbgBMPov (ORCPT + 99 others); Thu, 13 Feb 2020 10:44:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:51528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729454AbgBMP1g (ORCPT ); Thu, 13 Feb 2020 10:27:36 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 317F824670; Thu, 13 Feb 2020 15:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607656; bh=fPB1iHhgeFpUPKsYjqf2vZYkXrit/70jiBZ3Dsfo/pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qah9WawN3PjLgiBRd5baoykMmNsh7wPzslr0jcH8H1c8M2DJWK6B2S5KT2R0yqmha tZhOksklqxdy9Nhf+QaLu40t2RQp7bXT2rAIbqog4IvtjPyb91kyraU9P+HFZKMJwa 6gEZF5uJsjrGDvQZlHh5moLU7mZd4WPbx1VySYho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Auger , Marc Zyngier , Andrew Murray Subject: [PATCH 5.4 71/96] KVM: arm64: pmu: Dont increment SW_INCR if PMCR.E is unset Date: Thu, 13 Feb 2020 07:21:18 -0800 Message-Id: <20200213151906.126388921@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Auger commit 3837407c1aa1101ed5e214c7d6041e7a23335c6e upstream. The specification says PMSWINC increments PMEVCNTR_EL1 by 1 if PMEVCNTR_EL0 is enabled and configured to count SW_INCR. For PMEVCNTR_EL0 to be enabled, we need both PMCNTENSET to be set for the corresponding event counter but we also need the PMCR.E bit to be set. Fixes: 7a0adc7064b8 ("arm64: KVM: Add access handler for PMSWINC register") Signed-off-by: Eric Auger Signed-off-by: Marc Zyngier Reviewed-by: Andrew Murray Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20200124142535.29386-2-eric.auger@redhat.com Signed-off-by: Greg Kroah-Hartman --- virt/kvm/arm/pmu.c | 3 +++ 1 file changed, 3 insertions(+) --- a/virt/kvm/arm/pmu.c +++ b/virt/kvm/arm/pmu.c @@ -486,6 +486,9 @@ void kvm_pmu_software_increment(struct k if (val == 0) return; + if (!(__vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E)) + return; + enable = __vcpu_sys_reg(vcpu, PMCNTENSET_EL0); for (i = 0; i < ARMV8_PMU_CYCLE_IDX; i++) { if (!(val & BIT(i)))