From: Oliver Upton <oupton@kernel.org>
To: kvmarm@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Wei-Lin Chang <weilin.chang@arm.com>,
Steffen Eiden <seiden@linux.ibm.com>,
Fuad Tabba <fuad.tabba@linux.dev>,
Oliver Upton <oupton@kernel.org>
Subject: [PATCH 4/8] KVM: arm64: nv: Treat the VNCR GICv3 registers as hidden from user
Date: Wed, 4 Nov 2026 11:21:20 -0800 [thread overview]
Message-ID: <20261104192124.3932743-5-oupton@kernel.org> (raw)
In-Reply-To: <20261104192124.3932743-1-oupton@kernel.org>
KVM's emulation of sysreg traps will soon need to evaluate the
visibility of a sysreg prior to the effects of the L1 hypervisor's traps
to cope with instructions that intersect with a CGT but lack a
corresponding FGU bit (I know, not enough TLAs).
The VNCR GICv3 registers are marked as hidden from both user/guest on
the basis that KVM never handles these traps locally and unconditinally
relies on VNCR redirection. But an L1 hypervisor could trap these.
Remap the visibility as being specific to user accesses, giving the
indication that guest accesses to the sysreg are legal at least from an
architecture POV. Note that the guest side of the visibility was a bit
belt-and-braces as the bad_vncr_trap() accessor will act as a backstop
against any unexpected local trap handling.
Signed-off-by: Oliver Upton <oupton@kernel.org>
---
arch/arm64/kvm/sys_regs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 870dcb25d0d7..0b21b454242c 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1020,10 +1020,10 @@ static u64 reset_mpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
return mpidr;
}
-static unsigned int hidden_visibility(const struct kvm_vcpu *vcpu,
- const struct sys_reg_desc *r)
+static unsigned int hidden_user_visibility(const struct kvm_vcpu *vcpu,
+ const struct sys_reg_desc *r)
{
- return REG_HIDDEN;
+ return REG_USER_HIDDEN;
}
static unsigned int pmu_visibility(const struct kvm_vcpu *vcpu,
@@ -2757,7 +2757,7 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
#define EL2_REG_VNCR_FILT(name, vis) \
EL2_REG_FILTERED(name, bad_vncr_trap, reset_val, 0, vis)
#define EL2_REG_VNCR_GICv3(name) \
- EL2_REG_VNCR_FILT(name, hidden_visibility)
+ EL2_REG_VNCR_FILT(name, hidden_user_visibility)
#define EL2_REG_REDIR(name, rst, v) EL2_REG(name, bad_redir_trap, rst, v)
#define TIMER_REG(name, vis) \
--
2.47.3
next prev parent reply other threads:[~2026-11-04 19:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 19:21 [PATCH 0/8] KVM: arm64: Prefix of fixes from HAFDBS series (for 7.4) Oliver Upton
2026-11-04 19:21 ` [PATCH 1/8] KVM: arm64: nv: Disallow KVM_CAP_ARM_MTE + FEAT_EL2 Oliver Upton
2026-11-04 19:37 ` sashiko-bot
2026-11-04 20:17 ` Oliver Upton
2026-11-04 19:21 ` [PATCH 2/8] KVM: arm64: nv: Add CGT description for FEAT_PoPS instructions Oliver Upton
2026-11-05 18:12 ` Leonardo Bras
2026-11-04 19:21 ` [PATCH 3/8] KVM: arm64: Separate user / guest visibility flags Oliver Upton
2026-11-04 19:21 ` Oliver Upton [this message]
2026-11-04 19:21 ` [PATCH 5/8] KVM: arm64: Use ->visibility() to filter MTE CMO instructions Oliver Upton
2026-11-04 19:21 ` [PATCH 6/8] KVM: arm64: Add sys_reg_descs for remaining " Oliver Upton
2026-11-04 19:21 ` [PATCH 7/8] KVM: arm64: nv: Enforce sysreg visibility before evaulating guest traps Oliver Upton
2026-11-04 19:21 ` [PATCH 8/8] KVM: arm64: Stop leaning on __kvm_inject_sea() for abort injection Oliver Upton
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=20261104192124.3932743-5-oupton@kernel.org \
--to=oupton@kernel.org \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=weilin.chang@arm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.