[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXepY63VzDxpQ0xf@Asurada-Nvidia>
Date: Mon, 26 Jan 2026 09:50:27 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Will Deacon <will@...nel.org>, <jean-philippe@...aro.org>,
<robin.murphy@....com>, <joro@...tes.org>, <balbirs@...dia.com>,
<miko.lenczewski@....com>, <peterz@...radead.org>, <kevin.tian@...el.com>,
<praan@...gle.com>, <linux-arm-kernel@...ts.infradead.org>,
<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 6/7] iommu/arm-smmu-v3: Add arm_smmu_invs based
arm_smmu_domain_inv_range()
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
Powered by blists - more mailing lists