Re: [PATCH] iommu/vt-d: Fix PASID directory pointer coherency

From: Jacob Pan
Date: Tue Feb 07 2023 - 13:06:44 EST


Hi Kevin,

On Tue, 7 Feb 2023 00:41:16 +0000, "Tian, Kevin" <kevin.tian@xxxxxxxxx>
wrote:

> > From: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, February 7, 2023 1:25 AM
> >
> > > > @@ -1976,6 +1976,12 @@ static int
> > domain_context_mapping_one(struct
> > > > dmar_domain *domain, pds = context_get_sm_pds(table);
> > > > context->lo = (u64)virt_to_phys(table->table) |
> > > > context_pdts(pds);
> > > > + /*
> > > > + * Scalable-mode PASID directory pointer is not
> > > > snooped if the
> > > > + * coherent bit is not set.
> > > > + */
> > > > + if (!ecap_coherent(iommu->ecap))
> > > > + clflush_cache_range(table->table,
> > > > sizeof(void *));
> > >
> > > This isn't comprehensive. The clflush should be called whenever the
> > > pasid directory table is allocated or updated.
> > >
> > allocate a pasid table does not mean it gets used by iommu hw, not
> > until it is programmed into context entry.
> >
>
> this is insufficient.
>
> Even after this point the PASID directory entry could be changed when
> a new PASID table is allocated, e.g. in intel_pasid_get_entry().
>
you are right, will include updates in v2.

Thanks,

Jacob