[PATCH] iommu/arm-smmu-v3-sva: Enable Hardware Access and Hardware Dirty bits
Will Deacon
will at kernel.org
Wed May 13 04:42:47 PDT 2026
On Mon, May 11, 2026 at 01:22:23PM +0000, Pranjal Shrivastava wrote:
> On Sat, May 09, 2026 at 12:56:57AM -0700, Nicolin Chen wrote:
> > On Fri, May 08, 2026 at 03:24:32PM +0100, Robin Murphy wrote:
> > > On 2026-05-08 2:57 pm, Pranjal Shrivastava wrote:
> > > > I see, so IIUC, you mean if IS_ENABLED(CONFIG_ARM64_HW_AFDBM) but CPU
> > > > doesn't enable HTTU, it is perfectly safe to let the SMMU do HTT updates,
> > > > Since the fault handlers are already expecting HW-triggered updates?
> > > >
> > > > Which means our check would be something like:
> > > >
> > > > if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) {
> > > > if (smmu->features & FEAT_HA)
> > > > ...
> > > > }
> > > >
> > > > instead of cpu_has_hw_af()?
> > >
> > > Hmm, looking closer, cpu_has_hw_af() is the thing which actually influences
> > > mm behaviour (via arch_has_hw_pte_young and arch_wants_old_prefaulted_pte),
> > > and that can still be false at runtime if ARM64_HW_AFDBM is enabled but any
> > > CPU doesn't support HAFDBS, so perhaps you were right the first time :)
> >
> > IIUIC, v2 should be:
> >
> > + /*
> > + * Enable Hardware Access and Dirty updates (DBM) if supported by
> > + * both the SMMU and the CPU. It is unsafe to enable SMMU's HTTU,
> > + * if the CPU does not support it as it bypasses mm page aging.
> > + */
> > + if (cpu_has_hw_af()) {
>
> Ack, yes. IMO, this is the correct system-wide gate.
Hmm, I'm not so sure :/
cpu_has_hw_af() doesn't take into account CPUs with broken DBM and, in
fact, ID_AA64MMFR1_EL1.HAFDBS allows support for AF to be advertised
without support for DBM.
Having said that, I don't understand why we need to care about the CPU
support. The comment above states:
"It is unsafe to enable SMMU's HTTU, if the CPU does not support it as
it bypasses mm page aging."
but I don't understand what that "bypassing" means. vmscan should still
pick up the correct state from the page-table, so what's the problem?
Will
More information about the linux-arm-kernel
mailing list