public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Fuad Tabba <tabba@google.com>
To: kvmarm@lists.linux.dev
Cc: maz@kernel.org, oliver.upton@linux.dev, james.morse@arm.com,
	 suzuki.poulose@arm.com, yuzenghui@huawei.com,
	catalin.marinas@arm.com,  will@kernel.org, eric.auger@redhat.com,
	jingzhangos@google.com,  joey.gouly@arm.com, tabba@google.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 11/12] KVM: arm64: Trap external trace for protected VMs
Date: Wed,  6 Dec 2023 10:05:01 +0000	[thread overview]
Message-ID: <20231206100503.564090-12-tabba@google.com> (raw)
In-Reply-To: <20231206100503.564090-1-tabba@google.com>

pKVM does not support external trace for protected VMs. Trap
external trace, and add the ExtTrcBuff to make it possible to
check for the feature.

Signed-off-by: Fuad Tabba <tabba@google.com>
---
 arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++++
 arch/arm64/tools/sysreg        | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
index 9d23a51d7f75..84b5c3f387d8 100644
--- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
+++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
@@ -136,6 +136,10 @@ static void pvm_init_traps_aa64dfr0(struct kvm_vcpu *vcpu)
 			cptr_set |= CPTR_EL2_TTA;
 	}
 
+	/* Trap External Trace */
+	if (!FIELD_GET(ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_ExtTrcBuff), feature_ids))
+		mdcr_clear |= MDCR_EL2_E2TB_MASK << MDCR_EL2_E2TB_SHIFT;
+
 	vcpu->arch.mdcr_el2 |= mdcr_set;
 	vcpu->arch.mdcr_el2 &= ~mdcr_clear;
 	vcpu->arch.cptr_el2 |= cptr_set;
diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg
index 85f8b385fed2..be857797cc00 100644
--- a/arch/arm64/tools/sysreg
+++ b/arch/arm64/tools/sysreg
@@ -1115,7 +1115,10 @@ Enum	63:60	HPMN0
 	0b0000	UNPREDICTABLE
 	0b0001	DEF
 EndEnum
-Res0	59:56
+UnsignedEnum	59:56	ExtTrcBuff
+	0b0000	NI
+	0b0001	IMP
+EndEnum
 UnsignedEnum	55:52	BRBE
 	0b0000	NI
 	0b0001	IMP
-- 
2.43.0.rc2.451.g8631bc7472-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-12-06 11:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 10:04 [PATCH v2 00/12] KVM: arm64: Fixes to fine grain traps and pKVM traps Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 01/12] KVM: Add missing HCRX_EL2 field definitions Fuad Tabba
2023-12-07 16:57   ` Mark Brown
2023-12-08  8:14     ` Fuad Tabba
2023-12-08 13:43       ` Mark Brown
2023-12-06 10:04 ` [PATCH v2 02/12] KVM: arm64: Add latest HFGxTR_EL2 FGT entries to nested virt Fuad Tabba
2023-12-07 17:06   ` Mark Brown
2023-12-08  8:16     ` Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 03/12] KVM: arm64: Add latest HFGITR_EL2 " Fuad Tabba
2023-12-07 17:14   ` Mark Brown
2023-12-08  8:17     ` Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 04/12] KVM: arm64: Add bit masks for HAFGRTR_EL2 Fuad Tabba
2023-12-07 17:19   ` Mark Brown
2023-12-08  8:17     ` Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 05/12] KVM: arm64: Handle HAFGRTR_EL2 trapping in nested virt Fuad Tabba
2023-12-07 17:28   ` Mark Brown
2023-12-08  8:19     ` Fuad Tabba
2023-12-08 13:51       ` Mark Brown
2023-12-06 10:04 ` [PATCH v2 06/12] KVM: arm64: Update and fix FGT register masks Fuad Tabba
2023-12-07 15:00   ` Joey Gouly
2023-12-07 15:06     ` Fuad Tabba
2023-12-07 17:12       ` Joey Gouly
2023-12-08  8:23         ` Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 07/12] KVM: arm64: Add build validation for FGT trap mask values Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 08/12] KVM: arm64: Use generated FGT RES0 bits instead of specifying them Fuad Tabba
2023-12-06 10:04 ` [PATCH v2 09/12] KVM: arm64: Generate the HFGWTR-only RES0 bits Fuad Tabba
2023-12-06 10:19   ` Fuad Tabba
2023-12-06 10:05 ` [PATCH v2 10/12] KVM: arm64: Define FGT NMASK bits relative to other fields Fuad Tabba
2023-12-06 10:05 ` Fuad Tabba [this message]
2023-12-06 10:05 ` [PATCH v2 12/12] KVM: arm64: Mark CMOW as allowed for protected VMs Fuad Tabba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231206100503.564090-12-tabba@google.com \
    --to=tabba@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=eric.auger@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jingzhangos@google.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox