Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3319389rdh; Thu, 28 Sep 2023 08:26:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAg9mzXpR2ViaUM84ZcDHrLoWb8yroCU5qPwmS9qagDSiN9vbRY9HKK0Usn2kbBrYWigLF X-Received: by 2002:a05:6a20:8e10:b0:128:ffb7:dcfe with SMTP id y16-20020a056a208e1000b00128ffb7dcfemr2731528pzj.1.1695914781447; Thu, 28 Sep 2023 08:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695914781; cv=none; d=google.com; s=arc-20160816; b=I89kjapSfWioMT52y11qt1QZmUpWv4pZ4CMbRQTaf1phByhgCePvgDojNL/dTZzLyL IFpsFrZYXYOp5uKy95U9PsFBGR2qyYpRuxFzDJ1tUk4nKMrdp5Kk7/TX9KG7FReqNsuF 1sJwasDJMo8Bz5cZW1lTLJ9uBNbj6Ne4xoqlBv/ComWnbq6oP84Ko2LRJqR8E4tFgplS vKJ4mbCOnttG9lpLeAxIHWUtrRkwi0L5XwktI28Wl8EvZiQKiHI6z3dI19fqJ/M9SaBd qzkuogYt/GrVSQGbAvLfSux2acZX8S9CIdJIr4u0GJpiumJW2Roab5QTeHx5f3sSsT7Y k6wA== 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:cc:to:from; bh=tJTcMtToFQRLqZCzMEX9wJFK9hrU7757UwS5vaXAO+A=; fh=c22Vo8jmrolb3C2NHSTiTLszWLzURTk1MpvpruViKqw=; b=uR21HWP0lefY1F8jN0Hp53/tsLos11UnkNy8kGKZUGL8RPVBnDc7s8ZCzDwBVed+fH GwRs0/USyr3wzp6C9UkKZeSpbald7os9npr+3liZJ0TYx0mlcLxLdW6tLXgdjEFOn30+ BZEpaY87vkg6BK/TuNJTpvc2J9OhJE0eW+6uA8fnpvo/YLrhazvA9I0BXtWUFZRGnQxg D1AhXQpLfce2Yo0GkxnK5Mj+pEh/HndyKdfPdcb8doGjBrS5r5gNe+M53vWS/BoLXHN5 qmBXA9MZed88dcdiUw/eiJPc9JbuEHo4No05a75o16KrFWvnUhQLpweIsNzbCAlyUzdp jfMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id f10-20020a65550a000000b00573fe48c908si18001613pgr.128.2023.09.28.08.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 08:26:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D641581D0B40; Thu, 28 Sep 2023 08:17:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbjI1PQp (ORCPT + 99 others); Thu, 28 Sep 2023 11:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbjI1PQi (ORCPT ); Thu, 28 Sep 2023 11:16:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 99DED1AC for ; Thu, 28 Sep 2023 08:16:35 -0700 (PDT) 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 A44A3139F; Thu, 28 Sep 2023 08:17:13 -0700 (PDT) Received: from e127643.arm.com (unknown [10.57.3.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 88C393F59C; Thu, 28 Sep 2023 08:16:32 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, broonie@kernel.org, maz@kernel.org, suzuki.poulose@arm.com Cc: James Clark , Oliver Upton , James Morse , Zenghui Yu , Catalin Marinas , Will Deacon , Mike Leach , Leo Yan , Alexander Shishkin , Anshuman Khandual , Rob Herring , Jintack Lim , Joey Gouly , linux-kernel@vger.kernel.org Subject: [PATCH v1 2/5] arm64: KVM: Rename DEBUG_STATE_SAVE_TRBE to DEBUG_STATE_SAVE_TRFCR Date: Thu, 28 Sep 2023 16:16:06 +0100 Message-Id: <20230928151611.3042443-3-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928151611.3042443-1-james.clark@arm.com> References: <20230928151611.3042443-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 28 Sep 2023 08:17:43 -0700 (PDT) This flag actually causes the TRFCR register to be saved, so rename it to that effect. Currently it only happens when TRBE is used, but in a later commit TRFCR will be saved and restored even if TRBE isn't used, so the new name will be more accurate. Signed-off-by: James Clark --- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/debug.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/debug-sr.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index c3a17888f183..498f922f4f41 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -713,8 +713,8 @@ struct kvm_vcpu_arch { #define DEBUG_DIRTY __vcpu_single_flag(iflags, BIT(4)) /* Save SPE context if active */ #define DEBUG_STATE_SAVE_SPE __vcpu_single_flag(iflags, BIT(5)) -/* Save TRBE context if active */ -#define DEBUG_STATE_SAVE_TRBE __vcpu_single_flag(iflags, BIT(6)) +/* Save TRFCR and disable TRBE if necessary */ +#define DEBUG_STATE_SAVE_TRFCR __vcpu_single_flag(iflags, BIT(6)) /* vcpu running in HYP context */ #define VCPU_HYP_CONTEXT __vcpu_single_flag(iflags, BIT(7)) diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c index 8725291cb00a..6a1bad1a921b 100644 --- a/arch/arm64/kvm/debug.c +++ b/arch/arm64/kvm/debug.c @@ -334,11 +334,11 @@ void kvm_arch_vcpu_load_debug_state_flags(struct kvm_vcpu *vcpu) /* Check if we have TRBE implemented and available at the host */ if (cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_EL1_TraceBuffer_SHIFT) && !(read_sysreg_s(SYS_TRBIDR_EL1) & TRBIDR_EL1_P)) - vcpu_set_flag(vcpu, DEBUG_STATE_SAVE_TRBE); + vcpu_set_flag(vcpu, DEBUG_STATE_SAVE_TRFCR); } void kvm_arch_vcpu_put_debug_state_flags(struct kvm_vcpu *vcpu) { vcpu_clear_flag(vcpu, DEBUG_STATE_SAVE_SPE); - vcpu_clear_flag(vcpu, DEBUG_STATE_SAVE_TRBE); + vcpu_clear_flag(vcpu, DEBUG_STATE_SAVE_TRFCR); } diff --git a/arch/arm64/kvm/hyp/nvhe/debug-sr.c b/arch/arm64/kvm/hyp/nvhe/debug-sr.c index 4558c02eb352..89c208112eb7 100644 --- a/arch/arm64/kvm/hyp/nvhe/debug-sr.c +++ b/arch/arm64/kvm/hyp/nvhe/debug-sr.c @@ -85,7 +85,7 @@ void __debug_save_host_buffers_nvhe(struct kvm_vcpu *vcpu) if (vcpu_get_flag(vcpu, DEBUG_STATE_SAVE_SPE)) __debug_save_spe(&vcpu->arch.host_debug_state.pmscr_el1); /* Disable and flush Self-Hosted Trace generation */ - if (vcpu_get_flag(vcpu, DEBUG_STATE_SAVE_TRBE)) + if (vcpu_get_flag(vcpu, DEBUG_STATE_SAVE_TRFCR)) __debug_save_trace(&vcpu->arch.host_debug_state.trfcr_el1); } @@ -98,7 +98,7 @@ void __debug_restore_host_buffers_nvhe(struct kvm_vcpu *vcpu) { if (vcpu_get_flag(vcpu, DEBUG_STATE_SAVE_SPE)) __debug_restore_spe(vcpu->arch.host_debug_state.pmscr_el1); - if (vcpu_get_flag(vcpu, DEBUG_STATE_SAVE_TRBE)) + if (vcpu_get_flag(vcpu, DEBUG_STATE_SAVE_TRFCR)) __debug_restore_trace(vcpu->arch.host_debug_state.trfcr_el1); } -- 2.34.1