All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: kvmarm@lists.linux.dev, Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH v2 6/8] KVM: arm64: Add sys_reg_descs for remaining MTE CMO instructions
Date: Fri, 6 Nov 2026 13:30:49 -0800	[thread overview]
Message-ID: <au5HCZ4Ygasx-qKi@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-202094@kernel.org>

On Fri, Nov 06, 2026 at 06:45:39PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] KVM: arm64: possible missing MTE_CMO_INSN entries for DC GVA and
>   DC GZVA
> --
> 
> commit c80fdbddf913183cac8f63dfc60ce6f48445eafa
> Author: Oliver Upton <oupton@kernel.org>
> 
> KVM: arm64: Add sys_reg_descs for remaining MTE CMO instructions
> 
> This commit adds MTE_CMO_INSN descriptors with mte_visibility to
> sys_insn_descs[] for MTE cache maintenance instructions trapped by
> HCR_EL2.TPCP so that they inject an UNDEFINED exception when MTE is not
> enabled for the VM.
> 
> > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > index b456354713443..7f7a197a9ad6b 100644
> > --- a/arch/arm64/kvm/sys_regs.c
> > +++ b/arch/arm64/kvm/sys_regs.c
> [ ... ]
> > @@ -4394,6 +4403,15 @@ static struct sys_reg_desc sys_insn_descs[] = {
> >  	SYS_INSN(TLBI_VALE1NXS, handle_tlbi_el1),
> >  	SYS_INSN(TLBI_VAALE1NXS, handle_tlbi_el1),
> >  
> > +	MTE_CMO_INSN(DC_CGVAC, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CGDVAC, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CGVAP, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CGDVAP, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CGVADP, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CGDVADP, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CIGVAC, bad_cmo_trap),
> > +	MTE_CMO_INSN(DC_CIGDVAC, bad_cmo_trap),
> 
> [Severity: Low]
> This question rests on an architecture detail that could not be confirmed
> from the kernel source: can SYS_DC_GVA and SYS_DC_GZVA trap to EL2 via
> HCR_EL2.TDZ or HFGITR_EL2.DCZVA when MTE is not enabled for the VM?
> 
> If so, encoding_to_cgt[] maps both instructions to CGT_HCR_TDZ and
> encoding_to_fgt[] maps them to HFGITR_EL2.DCZVA, which is marked NEVER_FGU
> in config.c because the trap bit is shared with SYS_DC_ZVA.  Without
> MTE_CMO_INSN entries for SYS_DC_GVA and SYS_DC_GZVA in sys_insn_descs[],
> triage_sysreg_trap() has neither an FGU bit nor a visibility() callback to
> filter them, and will forward traps from a nested guest to L1 when L1 sets
> HCR_EL2.TDZ or HFGITR_EL2.DCZVA instead of injecting an UNDEFINED
> exception.

Urgh, I'm starting to get the sense that we should pursue a generalized
solution. This relies on adding a subtle detail to KVM's trap behavior
when what we're trying to do already has a direct description in the
architecture...

Thanks,
Oliver

  reply	other threads:[~2026-11-06 21:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 18:31 [PATCH v2 0/8] KVM: arm64: Prefix of fixes from HAFDBS series (for 7.4) Oliver Upton
2026-11-06 18:31 ` [PATCH v2 1/8] KVM: arm64: nv: Disallow KVM_CAP_ARM_MTE + FEAT_EL2 Oliver Upton
2026-11-08  5:30   ` Wei-Lin Chang
2026-11-06 18:31 ` [PATCH v2 2/8] KVM: arm64: nv: Add CGT description for FEAT_PoPS instructions Oliver Upton
2026-11-06 18:31 ` [PATCH v2 3/8] KVM: arm64: Separate user / guest visibility flags Oliver Upton
2026-11-06 18:31 ` [PATCH v2 4/8] KVM: arm64: nv: Treat the VNCR GICv3 registers as hidden from user Oliver Upton
2026-11-06 18:31 ` [PATCH v2 5/8] KVM: arm64: Use ->visibility() to filter MTE CMO instructions Oliver Upton
2026-11-06 18:31 ` [PATCH v2 6/8] KVM: arm64: Add sys_reg_descs for remaining " Oliver Upton
2026-11-06 18:45   ` sashiko-bot
2026-11-06 21:30     ` Oliver Upton [this message]
2026-11-06 18:31 ` [PATCH v2 7/8] KVM: arm64: nv: Enforce sysreg visibility before evaulating guest traps Oliver Upton
2026-11-06 18:31 ` [PATCH v2 8/8] KVM: arm64: Stop leaning on __kvm_inject_sea() for abort injection Oliver Upton
2026-11-06 18:47   ` sashiko-bot

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=au5HCZ4Ygasx-qKi@kernel.org \
    --to=oupton@kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.