[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276422CE4B77D262CD292208CF52@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Fri, 24 May 2024 05:24:11 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Nicolin Chen <nicolinc@...dia.com>
CC: Jason Gunthorpe <jgg@...dia.com>, "will@...nel.org" <will@...nel.org>,
"robin.murphy@....com" <robin.murphy@....com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"joro@...tes.org" <joro@...tes.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "iommu@...ts.linux.dev"
<iommu@...ts.linux.dev>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-tegra@...r.kernel.org"
<linux-tegra@...r.kernel.org>, "Liu, Yi L" <yi.l.liu@...el.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>, "vasant.hegde@....com"
<vasant.hegde@....com>, "jon.grimm@....com" <jon.grimm@....com>,
"santosh.shukla@....com" <santosh.shukla@....com>, "Dhaval.Giani@....com"
<Dhaval.Giani@....com>, "shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>
Subject: RE: [PATCH RFCv1 07/14] iommufd: Add viommu set/unset_dev_id ops
> From: Nicolin Chen <nicolinc@...dia.com>
> Sent: Friday, May 24, 2024 11:26 AM
>
> On Fri, May 24, 2024 at 02:21:23AM +0000, Tian, Kevin wrote:
> > > From: Jason Gunthorpe <jgg@...dia.com>
> > > Sent: Thursday, May 23, 2024 11:01 PM
> > >
> > > On Thu, May 23, 2024 at 06:19:59AM +0000, Tian, Kevin wrote:
> > > > > From: Jason Gunthorpe <jgg@...dia.com>
> > > > > Sent: Wednesday, May 22, 2024 2:25 AM
> > > > >
> > > > > On Tue, May 14, 2024 at 06:59:07PM -0700, Nicolin Chen wrote:
> > > > > > So, you want a proxy S1 domain for a device to attach, in case
> > > > > > of a stage-2 only setup, because an S2 domain will no longer has
> > > > > > a VMID, since it's shared among viommus. In the SMMU driver case,
> > > > > > an arm_smmu_domain won't have an smmu pointer, so a device
> can't
> > > > > > attach to an S2 domain but always an nested S1 domain, right?
> > > > >
> > > > > That seems like a simple solution to the VMID lifetime, but it means
> > > > > the kernel has to decode more types of vSTE.
> > > > >
> > > >
> > > > why does ATC invalidation need to know about VMID?
> > >
> > > ATC invalidation always requires a vRID to pRID translation and the
> > > VIOMMU will hold that translation.
> > >
> > > On vCMDQ HW and on AMD HW the vRID to pRID translation is pushed
> into
> > > HW, and vCMDQ requires the VMID to do that.
> > >
> >
> > At a quick glance VMID and vRID->pRID translation are both configurations
> > of a vintf.
> >
> > My impression was that vintf->vmid is added to guest cmd when it's
> > about iotlb invalidation.
> >
> > then vintf->sid_slots is walked when handling a guest cmd for ATC
> > invalidation.
> >
> > I'm not sure why the latter one requires a valid VMID to do the walking
> > except it's a implementation choice made by vCMDQ?
>
> Well, we haven't thought about a case of doing ATC invalidation
> via VINTF/VCMDQ without setting up a VMID, as "VMID" is a field
> in the VINTF_CONFIG register next to the Enable bit and must be
> set prior to enabling a VINTF, though your understanding of the
> HW work flow is probably accurate :)
Okay, that explains it. they are irrelevant in concept but come
relevant due to that detail. 😊
>
> And the narrative at the top was trying to describe the links:
> [ device ] => [ proxy identity S1 ] => [ viommu [ shared S2 ] ]
> v.s.
> [ device ] => [ non-shareable S2 ]
>
> So the first case can take advantage of VIOMMU_INVALIDATE v.s.
> the second case requires a DEV_INVALIDATE.
and one side-effect in the first case is to save one VMID for
non-shareable S2 hence improves iotlb efficiency.
>
> Another conclusion between the lines: since ARM SMMU will have
> the first case (with viommu), there is no longer any use of a
> DEV_INVALIDATE ioctl. So, we would likely drop it in the coming
> version.
>
> Thanks
> Nicolin
Powered by blists - more mailing lists