From: Pranjal Shrivastava <praan@google.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: "Jason Gunthorpe" <jgg@nvidia.com>,
"Nicolin Chen" <nicolinc@nvidia.com>,
"Will Deacon" <will@kernel.org>, "Joerg Roedel" <joro@8bytes.org>,
"Jean-Philippe Brucker" <jpb@kernel.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Mikołaj Lenczewski" <miko.lenczewski@arm.com>,
linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/arm-smmu-v3-sva: Enable Hardware Access and Hardware Dirty bits
Date: Fri, 8 May 2026 13:57:30 +0000 [thread overview]
Message-ID: <af3ryl7G58D2GeWr@google.com> (raw)
In-Reply-To: <f31043cc-45dd-457f-8031-0cef51c9470e@arm.com>
On Fri, May 08, 2026 at 02:31:11PM +0100, Robin Murphy wrote:
> On 2026-05-08 2:12 pm, Pranjal Shrivastava wrote:
> > On Fri, May 08, 2026 at 09:35:50AM -0300, Jason Gunthorpe wrote:
> > > On Thu, May 07, 2026 at 10:30:14PM +0000, Pranjal Shrivastava wrote:
> > > > > @@ -92,6 +92,16 @@ void arm_smmu_make_sva_cd(struct arm_smmu_cd *target,
> > > > > target->data[1] = cpu_to_le64(virt_to_phys(mm->pgd) &
> > > > > CTXDESC_CD_1_TTB0_MASK);
> > > > > +
> > > > > + /*
> > > > > + * Enable Hardware Access and Dirty updates (DBM) if supported.
> > > > > + * This is safe to enable by default, as PTE_WRITE and PTE_DBM
> > > > > + * share the same bit.
> > > > > + */
> > > > > + if (master->smmu->features & ARM_SMMU_FEAT_HA)
> > > > > + target->data[0] |= cpu_to_le64(CTXDESC_CD_0_TCR_HA);
> > > > > + if (master->smmu->features & ARM_SMMU_FEAT_HD)
> > > > > + target->data[0] |= cpu_to_le64(CTXDESC_CD_0_TCR_HD);
> > > >
> > > > IIUC, we should be setting these if IO_PGTABLE_QUIRK_ARM_HD is present?
> > >
> > > SVA does not use IO_PGTABLE at all, and it directly constructs its own
> > > CD.
> > >
> > > No relation between those two flows.
> >
> > I understand that but I mean we need to know if the system supports
> > HTTU ? Like for SMMU we use the IO_PGTABLE_QUIRK, shouldn't we be
> > checking if the CPU's tables support HTTU?
> >
> > Are we assuming that if the SMMU IDR presents HTTU capability the MMU
> > would also have it? I think an unconditional enablement is risky as we
> > may not have system-wide HTTU support.
> >
> > If we look at arm_smmu_master_sva_supported, the driver already
> > maintains a strict agreement between the CPU and SMMU for SVA.
> > It checks sanitized CPU ID registers for things like PARANGE & ASIDBITS,
> > and it uses system_supports_bbml2_noabort() to decide whether to enable
> > FEAT_BBML2.
> >
> > Shouldn't we follow this exact same pattern for HTTU ?
> > We should probably be checking cpu_has_hw_af() (from asm/cpufeature.h)
> > in the SVA support check or here if we wanna enable HTTU.
>
> It might make sense to depend on CONFIG_ARM64_HW_AFDBM - when that is
> enabled, then IIRC we already expect to cope with some CPUs not supporting
> hardware updates, so it should still be fine for an SMMU to make them even
> if no CPU does. However, if it's disabled then I'm not sure if missing
> access flag faults (if SMMU HA silently sets them) might be an issue - for
> dirty, we'd just never put down the Writeable-Clean permission so enabling
> SMMU HD wouldn't do anything anyway.
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()?
Thanks,
Praan
next prev parent reply other threads:[~2026-05-08 13:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 13:54 [PATCH] iommu/arm-smmu-v3-sva: Enable Hardware Access and Hardware Dirty bits Nicolin Chen
2026-05-07 22:30 ` Pranjal Shrivastava
2026-05-08 12:35 ` Jason Gunthorpe
2026-05-08 13:12 ` Pranjal Shrivastava
2026-05-08 13:27 ` Jason Gunthorpe
2026-05-08 13:31 ` Robin Murphy
2026-05-08 13:57 ` Pranjal Shrivastava [this message]
2026-05-08 14:24 ` Robin Murphy
2026-05-09 7:56 ` Nicolin Chen
2026-05-11 13:22 ` Pranjal Shrivastava
2026-05-13 11:42 ` Will Deacon
2026-05-13 14:27 ` Pranjal Shrivastava
2026-05-13 14:32 ` Jason Gunthorpe
2026-05-13 17:38 ` Pranjal Shrivastava
2026-05-11 13:21 ` Pranjal Shrivastava
2026-05-19 15:23 ` Will Deacon
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=af3ryl7G58D2GeWr@google.com \
--to=praan@google.com \
--cc=catalin.marinas@arm.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=jpb@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miko.lenczewski@arm.com \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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.