[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240524131206.GS20229@nvidia.com>
Date: Fri, 24 May 2024 10:12:06 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
Cc: Nicolin Chen <nicolinc@...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
On Fri, May 24, 2024 at 07:21:59AM +0000, Tian, Kevin wrote:
> My point was based on Jason's example about 3 VMIDs:
>
> hwpt_alloc(deva, nesting_parent=true) = shared_s2
> viommu_alloc(deva, shared_s2) = viommu1
> viommu_alloc(devb, shared_s2) = viommu2
> hwpt_alloc(deva, viommu1, vste) = deva_vste
> hwpt_alloc(devb, viommu2, vste) = devb_vste
> attach(deva, deva_vste)
> attach(devb, devb_vste)
> attach(devc, shared_s2)
>
> for devc it could be:
> hwpt_alloc(deva, viommu1, vproxy_s1) = devc_proxys1
> attach(devc, devc_proxys1)
>
> then devc will reuse VMID of viommu1 and we save one VMID.
I think that can work, at least I haven't thought of a reason why the
non-vIOMMU device's VMID couldn't be shared with one of the
vIOMMUs.
It is all quite a contrived case, I dont't expect people to want to do
anything like this, it is just showing that the API is properly setup
that it could be done. Userspace is not restricted to a single VIOMMU.
> Does that not work so we need create another viommu to hold the
> proxy identity s1 then still need a 3rd VMID?
Yes, I think that can be OK.
Jason
Powered by blists - more mailing lists