[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230306104346.022849ee@jacob-builder>
Date: Mon, 6 Mar 2023 10:43:46 -0800
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
Cc: Baolu Lu <baolu.lu@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
Jason Gunthorpe <jgg@...dia.com>,
Joerg Roedel <joro@...tes.org>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
"vkoul@...nel.org" <vkoul@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Will Deacon <will@...nel.org>,
David Woodhouse <dwmw2@...radead.org>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
"Jiang, Dave" <dave.jiang@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"Zanussi, Tom" <tom.zanussi@...el.com>,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH 1/4] iommu/vt-d: Implement set device pasid op for
default domain
Hi Kevin,
On Mon, 6 Mar 2023 08:18:37 +0000, "Tian, Kevin" <kevin.tian@...el.com>
wrote:
> > From: Baolu Lu <baolu.lu@...ux.intel.com>
> > Sent: Sunday, March 5, 2023 11:06 AM
> >
> > On 3/4/23 12:35 AM, Jacob Pan wrote:
> > >>> From: Baolu Lu<baolu.lu@...ux.intel.com>
> > >>> Sent: Thursday, March 2, 2023 10:07 PM
> > >>>
> > >>>> +
> > >>>> + if (hw_pass_through && domain_type_is_si(dmar_domain))
> > >>>> + ret = intel_pasid_setup_pass_through(iommu,
> > >>>> dmar_domain,
> > >>>> + dev, pasid);
> > >>>> + else if (dmar_domain->use_first_level)
> > >>>> + ret = domain_setup_first_level(iommu, dmar_domain,
> > >>>> + dev, pasid);
> > >>>> + else
> > >>>> + ret = intel_pasid_setup_second_level(iommu,
> > >>>> dmar_domain,
> > >>>> + dev, pasid);
> > >>>> +
> > >>>> + return ret;
> > >>>> +}
> > >>> Do you need to consider pasid cache invalidation?
> > >>>
> > >> To avoid confusion this is not about invalidation of pasid cache
> > >> itself which should be covered by above setup functions already.
> > >>
> > >> Here actually means per-PASID invalidation in iotlb and devtlb. Today
> > >> only RID is tracked per domain for invalidation. it needs extension
> > >> to walk attached pasid too.
> > > Yes, will add.
> > >
> > > For the set up path, there is no need to flush IOTLBs, because we're
> > > going from non present to present.
> > >
> > > On the remove path, IOTLB flush should be covered when device driver
> > > calls iommu_detach_device_pasid(). Covered with this patch.
> >
> > It's not only for the PASID teardown path, but also for unmap(). As the
> > device has issued DMA requests with PASID, the IOMMU probably will cache
> > the DMA translation with PASID tagged. Hence, we need to invalidate the
> > PASID-specific IOTLB and device TLB in the unmap() path.
> >
> > I once had a patch for this:
> >
> > https://lore.kernel.org/linux-iommu/20220614034411.1634238-1-
> > baolu.lu@...ux.intel.com/
> >
> > Probably you can use it as a starting point.
> >
>
> just that we should not have a sub-device term there. Just name
> the tracking information per pasid.
Sounds good, I should be enable to use Baolu's patch for the most part.
Thanks,
Jacob
Powered by blists - more mailing lists