Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp735870pxb; Wed, 25 Aug 2021 13:51:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmADolOL6+j7bjUQpBdG8wi8hgmYcACJlbEvYs4m3tRoQPuMYNb3/M/06PJqKFrBGtjuK4 X-Received: by 2002:a05:6638:38aa:: with SMTP id b42mr353035jav.6.1629924681793; Wed, 25 Aug 2021 13:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629924681; cv=none; d=google.com; s=arc-20160816; b=PHhxmyiZ2bmWDXsMW0Zt3kCzIpTJnlA3M0bug3apZLBwqq9JxGAzypdSaukqbK7Zhx KGlZ51fAkRimiEsvMPcaCDSVWXy4Xg7Xc5GOFXExk7hJZpfa204O0EUHlVd5riAhydKu BjjHd17jbNtbWQfshlDqR+X3fl2b0ZclCJZ9EcwTcyaBRy35rsWJOohA9ZchehT1Zi0L 9syg62l/Tgcx9RbpVNwP3JuiPP5/AB0nACZDdUWDjnmbNR+cI38hH7Bl7v36AqZQ46/n nbl9VDzESsBOtlSyhc69B2ygnc81Lzy1k4h05Shn8Inp8KpJmLNxXnQkZhrprKXvn7Wq G5xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=Hf05A7QV4fM1qnSobUdlLNOlQ7bosXjbos2KMTHbSfk=; b=muNtUySEBr961svtzsz3sdLK7/yzD5Rkc7V0VL3U2m3kwP1hOqRex09D/cd/R65sMp 9jBu+nynNpPdnbtxb7770Mdtei76XaFpTDRPM6s/KvHM+RCdOXdYM7fuWs3OOZ826h0z vpMp/M6eZRhFdssMXMF1s7N+PMOddOCT71wpZuq4B5KlvBZtjp9sNm/Z82EMci/yiKrT ZnlorYXoMi+JGVHPCnEDmVZTA/yQFqXauuGDkH32fL+QWsInnjVMUcv9iQIjDZ2cjwBV f6E8jSUQl3IjjAI3SN5/XTm/porGgmAi5CPy+g0qYgEpE9EDn8QSNttDdCMnh3lhcgHm BTzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si611656jar.122.2021.08.25.13.51.09; Wed, 25 Aug 2021 13:51:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241679AbhHYQSs (ORCPT + 99 others); Wed, 25 Aug 2021 12:18:48 -0400 Received: from foss.arm.com ([217.140.110.172]:54796 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240766AbhHYQS1 (ORCPT ); Wed, 25 Aug 2021 12:18:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1258A101E; Wed, 25 Aug 2021 09:17:41 -0700 (PDT) Received: from monolith.cable.virginm.net (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B6D073F66F; Wed, 25 Aug 2021 09:17:39 -0700 (PDT) From: Alexandru Elisei To: maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, will@kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v4 18/39] KVM: arm64: Expose SPE version to guests Date: Wed, 25 Aug 2021 17:17:54 +0100 Message-Id: <20210825161815.266051-19-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210825161815.266051-1-alexandru.elisei@arm.com> References: <20210825161815.266051-1-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the ID_AA64DFR0_EL1.PMSVer field to a non-zero value if the VCPU SPE feature is set. SPE version is capped at FEAT_SPEv1p1 because KVM doesn't yet implement freezing of PMU event counters on a SPE buffer management event. Signed-off-by: Alexandru Elisei --- arch/arm64/kvm/sys_regs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index f6f126eb6ac1..ab7370b7a44b 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1070,8 +1070,10 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, val = cpuid_feature_cap_perfmon_field(val, ID_AA64DFR0_PMUVER_SHIFT, kvm_vcpu_has_pmu(vcpu) ? ID_AA64DFR0_PMUVER_8_4 : 0); - /* Hide SPE from guests */ - val &= ~FEATURE(ID_AA64DFR0_PMSVER); + /* Limit guests to SPE for ARMv8.3 */ + val = cpuid_feature_cap_perfmon_field(val, + ID_AA64DFR0_PMSVER_SHIFT, + kvm_vcpu_has_spe(vcpu) ? ID_AA64DFR0_PMSVER_8_3 : 0); break; case SYS_ID_DFR0_EL1: /* Limit guests to PMUv3 for ARMv8.4 */ -- 2.33.0