[PATCH v9 6/7] iommu/arm-smmu-v3: Add arm_smmu_invs based arm_smmu_domain_inv_range()
Nicolin Chen
nicolinc at nvidia.com
Mon Jan 26 09:50:27 PST 2026
On Mon, Jan 26, 2026 at 11:20:19AM -0400, Jason Gunthorpe wrote:
> On Mon, Jan 26, 2026 at 01:01:16PM +0000, Will Deacon wrote:
> > If we've written a new (i.e. previously invalid) valid PTE to a
> > page-table and then we install that page-table into an STE hitlessly
> > (let's say we write the S2TTB field) then isn't there a window before we
> > do the STE invalidation where the page-table might be accessible to the
> > SMMU but the new PTE is still sitting in the CPU?
>
> Hmm! Yes seems like it.
>
> However, that's seems like a general bug, if we allocate an
> iommu_domain and immediately hitlessly install it, then there would be
> no dma_wmb() for the page table memory prior to the earliest point the
> HW is able to read the STE.
>
> What I wrote is is how things are intended to work, so lets fix it
> with this?
>
> @@ -1173,6 +1173,13 @@ void arm_smmu_write_entry(struct arm_smmu_entry_writer *writer, __le64 *entry,
> __le64 unused_update[NUM_ENTRY_QWORDS];
> u8 used_qword_diff;
>
> + /*
> + * Many of the entry structures have pointers to other structures that
> + * need to have their updates be visible before any writes of the entry
> + * happen.
> + */
> + dma_wmb();
> +
> used_qword_diff =
> arm_smmu_entry_qword_diff(writer, entry, target, unused_update);
> if (hweight8(used_qword_diff) == 1) {
I will attach this patch as PATCH-1 in v10.
Thanks
Nicolin
More information about the linux-arm-kernel
mailing list