[PATCH v3] KVM: arm64: Trap guest MPAM accesses whenever MPAM is implemented

Marc Zyngier maz at kernel.org
Thu Sep 17 03:59:14 PDT 2026


On Tue, 15 Sep 2026 19:51:00 +0100,
Fuad Tabba <fuad.tabba at linux.dev> wrote:
> 
> Hi Marc,
> 
> On Sun, 13 Sept 2026 at 11:00, Marc Zyngier <maz at kernel.org> wrote:
> [...]
> > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> [...]
> > >  static void cpu_hyp_init_context(void)
> > >  {
> > > + u64 pfr0 = __read_sysreg_by_encoding(SYS_ID_AA64PFR0_EL1);
> > > + u64 pfr1 = __read_sysreg_by_encoding(SYS_ID_AA64PFR1_EL1);
> > > +
> >
> > Why not directly read_sysreg(id_aa64pfr0_el1) and co?
> > __read_sysreg_by_encoding() is useful when the encoding comes from a
> > variable, but it looks odd in the case of a literal sysreg.
> 
> It applies the arm64.nompam override, which is what
> finalise_el2_state() tests. With the override set, EL2 setup leaves
> the MPAM traps alone, and a raw read_sysreg() would still see MPAM in
> the ID registers, so KVM would write MPAM2_EL2 on exactly the firmware
> the option exists for. I'll add a comment.

Ah, good point. A comment would help indeed.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list