[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <acbd03f2-5c7e-d38e-92b6-cedc02429889@redhat.com>
Date: Wed, 7 Apr 2021 10:06:30 +0800
From: Jason Wang <jasowang@...hat.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: "Tian, Kevin" <kevin.tian@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
LKML <linux-kernel@...r.kernel.org>,
Joerg Roedel <joro@...tes.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
David Woodhouse <dwmw2@...radead.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"cgroups@...r.kernel.org" <cgroups@...r.kernel.org>,
Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>,
Johannes Weiner <hannes@...xchg.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
Alex Williamson <alex.williamson@...hat.com>,
Eric Auger <eric.auger@...hat.com>,
Jonathan Corbet <corbet@....net>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>, "Wu, Hao" <hao.wu@...el.com>,
"Jiang, Dave" <dave.jiang@...el.com>
Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation
APIs
在 2021/4/6 下午8:42, Jason Gunthorpe 写道:
> On Tue, Apr 06, 2021 at 09:35:17AM +0800, Jason Wang wrote:
>
>>> VFIO and VDPA has no buisness having map/unmap interfaces once we have
>>> /dev/ioasid. That all belongs in the iosaid side.
>>>
>>> I know they have those interfaces today, but that doesn't mean we have
>>> to keep using them for PASID use cases, they should be replaced with a
>>> 'do dma from this pasid on /dev/ioasid' interface certainly not a
>>> 'here is a pasid from /dev/ioasid, go ahead and configure it youself'
>>> interface
>>
>> So it looks like the PASID was bound to SVA in this design. I think it's not
>> necessairly the case:
> No, I wish people would stop talking about SVA.
>
> SVA and vSVA are a very special narrow configuration of a PASID. There
> are lots of other PASID configurations! That is the whole point, a
> PASID is complicated, there are many configuration scenarios, they
> need to be in one place with a very clearly defined uAPI
Right, that's my understanding as well.
>
>> 1) PASID can be implemented without SVA, in this case a map/unmap interface
>> is still required
> Any interface to manipulate a PASID should be under /dev/ioasid. We do
> not want to duplicate this into every subsystem.
Yes.
>
>> 2) For the case that hypervisor want to do some mediation in the middle for
>> a virtqueue. e.g in the case of control vq that is implemented in the
>> VF/ADI/SF itself, the hardware virtqueue needs to be controlled by Qemu,
>> Though binding qemu's page table to cvq can work but it looks like a
>> overkill, a small dedicated buffers that is mapped for this PASID seems more
>> suitalbe.
> /dev/ioasid should allow userspace to setup any PASID configuration it
> wants. There are many choices. That is the whole point, instead of
> copying&pasting all the PASID configuration option into every
> subsystem we have on place to configure it.
>
> If you want a PASID (or generic ioasid) that has the guest physical
> map, which is probably all that VDPA would ever want, then /dev/ioasid
> should be able to prepare that.
>
> If you just want to map a few buffers into a PASID then it should be
> able to do that too.
>
>> So do you mean the device should not expose the PASID confiugration API to
>> guest? I think it could happen if we assign the whole device and let guest
>> to configure it for nested VMs.
> This always needs co-operating with the vIOMMU driver. We can't have
> nested PASID use without both parts working together.
>
> The vIOMMU driver configures the PASID and assigns the mappings
> (however complicated that turns out to be)
>
> The VDPA/mdev driver authorizes the HW to use the ioasid mapping, eg
> by authorizing a queue to issue PCIe TLPs with a specific PASID.
>
> The authorization is triggered by the guest telling the vIOMMU to
> allow a vRID to talk to a PASID, which qemu would have to translate to
> telling something like the VDPA driver under the vRID that it can use
> a PASID from /dev/ioasid
>
> For security a VDPA/mdev device MUST NOT issue PASIDs that the vIOMMU
> has not authorized its vRID to use. Otherwise the security model of
> something like VFIO in the guest becomes completely broken.
Yes, that's how it should work.
Thanks
>
> Jason
>
Powered by blists - more mailing lists