Skip to content

Commit d282fa3

Browse files
author
Marc Zyngier
committed
KVM: arm64: Handle trap of tagged Set/Way CMOs
We appear to have missed the Set/Way CMOs when adding MTE support. Not that we really expect anyone to use them, but you never know what stupidity some people can come up with... Treat these mostly like we deal with the classic S/W CMOs, only with an additional check that MTE really is enabled. Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Link: https://lore.kernel.org/r/20230515204601.1270428-3-maz@kernel.org
1 parent 8d0f019 commit d282fa3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ static bool access_dcsw(struct kvm_vcpu *vcpu,
211211
return true;
212212
}
213213

214+
static bool access_dcgsw(struct kvm_vcpu *vcpu,
215+
struct sys_reg_params *p,
216+
const struct sys_reg_desc *r)
217+
{
218+
if (!kvm_has_mte(vcpu->kvm)) {
219+
kvm_inject_undefined(vcpu);
220+
return false;
221+
}
222+
223+
/* Treat MTE S/W ops as we treat the classic ones: with contempt */
224+
return access_dcsw(vcpu, p, r);
225+
}
226+
214227
static void get_access_mask(const struct sys_reg_desc *r, u64 *mask, u64 *shift)
215228
{
216229
switch (r->aarch32_map) {
@@ -1756,8 +1769,14 @@ static bool access_spsr(struct kvm_vcpu *vcpu,
17561769
*/
17571770
static const struct sys_reg_desc sys_reg_descs[] = {
17581771
{ SYS_DESC(SYS_DC_ISW), access_dcsw },
1772+
{ SYS_DESC(SYS_DC_IGSW), access_dcgsw },
1773+
{ SYS_DESC(SYS_DC_IGDSW), access_dcgsw },
17591774
{ SYS_DESC(SYS_DC_CSW), access_dcsw },
1775+
{ SYS_DESC(SYS_DC_CGSW), access_dcgsw },
1776+
{ SYS_DESC(SYS_DC_CGDSW), access_dcgsw },
17601777
{ SYS_DESC(SYS_DC_CISW), access_dcsw },
1778+
{ SYS_DESC(SYS_DC_CIGSW), access_dcgsw },
1779+
{ SYS_DESC(SYS_DC_CIGDSW), access_dcgsw },
17611780

17621781
DBG_BCR_BVR_WCR_WVR_EL1(0),
17631782
DBG_BCR_BVR_WCR_WVR_EL1(1),

0 commit comments

Comments
 (0)