RE: [RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-11-11 Thread Liu, Yi L
Hi Jason, > From: Jason Gunthorpe > Sent: Wednesday, November 3, 2021 9:26 PM > > On Tue, Nov 02, 2021 at 09:53:29AM +0000, Liu, Yi L wrote: > > > > vfio_uninit_group_dev(_state->vdev); > > > kfree(mdev_state->pages); > > > kfre

RE: [RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-11-02 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Monday, November 1, 2021 8:50 PM > > On Fri, Oct 29, 2021 at 09:47:27AM +0000, Liu, Yi L wrote: > > Hi Jason, > > > > > From: Jason Gunthorpe > > > Sent: Monday, October 25, 2021 8:53 PM > > > > > &g

RE: [RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-10-29 Thread Liu, Yi L
Hi Jason, > From: Jason Gunthorpe > Sent: Monday, October 25, 2021 8:53 PM > > On Mon, Oct 25, 2021 at 06:28:09AM +0000, Liu, Yi L wrote: > >thanks for the guiding. will also refer to your vfio_group_cdev series. > > > >Need to double confirm here. No

RE: [RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-10-25 Thread Liu, Yi L
> From: Jason Gunthorpe mailto:j...@nvidia.com>> > Sent: Tuesday, September 21, 2021 11:57 PM > > On Sun, Sep 19, 2021 at 02:38:30PM +0800, Liu Yi L wrote: > > This patch introduces a new interface (/dev/vfio/devices/$DEVICE) for > > userspace to directly

RE: [RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-10-20 Thread Liu, Yi L
> From: David Gibson > Sent: Wednesday, September 29, 2021 10:09 AM > > On Sun, Sep 19, 2021 at 02:38:30PM +0800, Liu Yi L wrote: > > This patch introduces a new interface (/dev/vfio/devices/$DEVICE) for > > userspace to directly open a vfio device w/o relying on contai

RE: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-15 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Friday, October 15, 2021 7:18 PM > > On Fri, Oct 15, 2021 at 09:18:06AM +0000, Liu, Yi L wrote: > > > > Acquire from the xarray is > > >rcu_lock() > > >ioas = xa_load() > > >if (ioas) > > >

RE: [RFC 07/20] iommu/iommufd: Add iommufd_[un]bind_device()

2021-10-15 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Wednesday, September 22, 2021 1:15 AM > > On Sun, Sep 19, 2021 at 02:38:35PM +0800, Liu Yi L wrote: > > > +/* > > + * A iommufd_device object represents the binding relationship > > + * between iommufd and device. It is created

RE: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-15 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, September 21, 2021 11:42 PM > > On Sun, Sep 19, 2021 at 02:38:29PM +0800, Liu Yi L wrote: > > /dev/iommu aims to provide a unified interface for managing I/O address > > spaces for devices assigned to userspace. This patch adds t

RE: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-29 Thread Liu, Yi L
> From: Jean-Philippe Brucker > Sent: Wednesday, September 22, 2021 9:45 PM > > On Sun, Sep 19, 2021 at 02:38:39PM +0800, Liu Yi L wrote: > > This patch adds IOASID allocation/free interface per iommufd. When > > allocating an IOASID, userspace is expected to specify

RE: [RFC 17/20] iommu/iommufd: Report iova range to userspace

2021-09-29 Thread Liu, Yi L
> From: Jean-Philippe Brucker > Sent: Wednesday, September 22, 2021 10:49 PM > > On Sun, Sep 19, 2021 at 02:38:45PM +0800, Liu Yi L wrote: > > [HACK. will fix in v2] > > > > IOVA range is critical info for userspace to manage DMA for an I/O address > > spac

RE: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-23 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Wednesday, September 22, 2021 9:32 PM > > On Wed, Sep 22, 2021 at 12:51:38PM +0000, Liu, Yi L wrote: > > > From: Jason Gunthorpe > > > Sent: Wednesday, September 22, 2021 1:45 AM > > > > > [...] > > > > dif

RE: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-22 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Wednesday, September 22, 2021 1:45 AM > [...] > > diff --git a/drivers/iommu/iommufd/iommufd.c > b/drivers/iommu/iommufd/iommufd.c > > index 641f199f2d41..4839f128b24a 100644 > > +++ b/drivers/iommu/iommufd/iommufd.c > > @@ -24,6 +24,7 @@ > > struct iommufd_ctx {

RE: [RFC 00/20] Introduce /dev/iommu for userspace I/O address space management

2021-09-21 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, September 21, 2021 9:45 PM > > On Sun, Sep 19, 2021 at 02:38:28PM +0800, Liu Yi L wrote: > > Linux now includes multiple device-passthrough frameworks (e.g. VFIO > and > > vDPA) to manage secure device access from the use

RE: [RFC 00/20] Introduce /dev/iommu for userspace I/O address space management

2021-09-19 Thread Liu, Yi L
> From: Liu, Yi L > Sent: Sunday, September 19, 2021 2:38 PM [...] > [Series Overview] > > * Basic skeleton: > 0001-iommu-iommufd-Add-dev-iommu-core.patch > > * VFIO PCI creates device-centric interface: > 0002-vfio-Add-device-class-for-dev-vfio-devices.patch

[RFC 20/20] Doc: Add documentation for /dev/iommu

2021-09-19 Thread Liu Yi L
Document the /dev/iommu framework for user. Open: Do we want to document /dev/iommu in Documentation/userspace-api/iommu.rst? Existing iommu.rst is for the vSVA interfaces, honestly, may need to rewrite this doc entirely. Signed-off-by: Kevin Tian Signed-off-by: Liu Yi L --- Documentation

[RFC 19/20] iommu/vt-d: Implement device_info iommu_ops callback

2021-09-19 Thread Liu Yi L
From: Lu Baolu Expose per-device IOMMU attributes to the upper layers. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index

[RFC 18/20] iommu/iommufd: Add IOMMU_[UN]MAP_DMA on IOASID

2021-09-19 Thread Liu Yi L
[HACK. will fix in v2] This patch introduces vfio type1v2-equivalent interface to userspace. Due to aforementioned hack, iommufd currently calls exported vfio symbols to handle map/unmap requests from the user. Signed-off-by: Liu Yi L --- drivers/iommu/iommufd/iommufd.c | 104

[RFC 17/20] iommu/iommufd: Report iova range to userspace

2021-09-19 Thread Liu Yi L
introduce a cap chain format in IOMMU_DEVICE_GET_INFO to carry the iova range info. Signed-off-by: Liu Yi L --- drivers/iommu/iommu.c | 2 ++ drivers/iommu/iommufd/iommufd.c | 41 +++- drivers/vfio/vfio_iommu_type1.c | 47 ++--- include

[RFC 16/20] vfio/type1: Export symbols for dma [un]map code sharing

2021-09-19 Thread Liu Yi L
aspects of the new framework. Once we reach consensus, we'll follow it to do a clean implementation 'in' next version. Signed-off-by: Liu Yi L --- drivers/vfio/vfio_iommu_type1.c | 199 +++- include/linux/vfio.h| 13 +++ 2 files changed, 206 insertions(+), 6

[RFC 15/20] vfio/pci: Add VFIO_DEVICE_[DE]ATTACH_IOASID

2021-09-19 Thread Liu Yi L
Signed-off-by: Liu Yi L --- drivers/vfio/pci/vfio_pci.c | 82 + drivers/vfio/pci/vfio_pci_private.h | 1 + include/linux/iommufd.h | 1 + include/uapi/linux/vfio.h | 26 + 4 files changed, 110 insertions(+) diff --git a/drivers

[RFC 14/20] iommu/iommufd: Add iommufd_device_[de]attach_ioasid()

2021-09-19 Thread Liu Yi L
for those patches, that logic will be moved to this patch. Signed-off-by: Liu Yi L --- drivers/iommu/iommufd/iommufd.c | 226 include/linux/iommufd.h | 29 2 files changed, 255 insertions(+) diff --git a/drivers/iommu/iommufd/iommufd.c b/drivers/iommu

[RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-09-19 Thread Liu Yi L
From: Lu Baolu These two helpers could be used when 1) the iommu group is singleton, or 2) the upper layer has put the iommu group into the secure state by calling iommu_device_init_user_dma(). As we want the iommufd design to be a device-centric model, we want to remove any group knowledge in

[RFC 12/20] iommu/iommufd: Add IOMMU_CHECK_EXTENSION

2021-09-19 Thread Liu Yi L
As aforementioned, userspace should check extension for what formats can be specified when allocating an IOASID. This patch adds such interface for userspace. In this RFC, iommufd reports EXT_MAP_TYPE1V2 support and no no-snoop support yet. Signed-off-by: Liu Yi L --- drivers/iommu/iommufd

[RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-19 Thread Liu Yi L
(Sub-Stream ID). We need find a way to resolve the naming conflict between the hardware ID and software handle. One option is to rename the existing ioasid to be pasid or ssid, given their full names still sound generic. Appreciate more thoughts on this open! Signed-off-by: Liu Yi L

[RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO

2021-09-19 Thread Liu Yi L
is registered at binding time is used to mark the device which is being queried here. Signed-off-by: Liu Yi L --- drivers/iommu/iommufd/iommufd.c | 68 + include/uapi/linux/iommu.h | 49 2 files changed, 117 insertions(+) diff --git a/drivers

[RFC 09/20] iommu: Add page size and address width attributes

2021-09-19 Thread Liu Yi L
From: Lu Baolu This exposes PAGE_SIZE and ADDR_WIDTH attributes. The iommufd could use them to define the IOAS. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index

[RFC 08/20] vfio/pci: Add VFIO_DEVICE_BIND_IOMMUFD

2021-09-19 Thread Liu Yi L
address spaces attached by this device. However as a starting point (matching current vfio), only one I/O address space is supported per vfio device. It implies one device can only be attached to one iommufd at this point. Signed-off-by: Liu Yi L --- drivers/vfio/pci/Kconfig| 1

[RFC 07/20] iommu/iommufd: Add iommufd_[un]bind_device()

2021-09-19 Thread Liu Yi L
dev which requires pasid granular DMA isolation; - iommu_[un]bind_sw_mdev() for sw mdev which relies on software measures instead of iommu to isolate DMA; Signed-off-by: Liu Yi L --- drivers/iommu/iommufd/iommufd.c | 160 +++- include/linux/iommufd.h |

[RFC 06/20] iommu: Add iommu_device_init[exit]_user_dma interfaces

2021-09-19 Thread Liu Yi L
From: Lu Baolu This extends iommu core to manage security context for passthrough devices. Please bear a long explanation for how we reach this design instead of managing it solely in iommufd like what vfio does today. Devices which cannot be isolated from each other are organized into an iommu

[RFC 05/20] vfio/pci: Register device to /dev/vfio/devices

2021-09-19 Thread Liu Yi L
ing process, before opening the device through the groupfd. Signed-off-by: Liu Yi L --- drivers/vfio/pci/vfio_pci.c | 25 +++-- drivers/vfio/pci/vfio_pci_private.h | 1 + drivers/vfio/vfio.c | 3 ++- include/linux/vfio.h| 1 + 4 fi

[RFC 04/20] iommu: Add iommu_device_get_info interface

2021-09-19 Thread Liu Yi L
From: Lu Baolu This provides an interface for upper layers to get the per-device iommu attributes. int iommu_device_get_info(struct device *dev, enum iommu_devattr attr, void *data); The first attribute (IOMMU_DEV_INFO_FORCE_SNOOP) is added. It tells if the

[RFC 03/20] vfio: Add vfio_[un]register_device()

2021-09-19 Thread Liu Yi L
y. Another tricky thing is that "pdev. vs. mdev" and "pci vs. platform vs. ccw,..." are orthogonal categorizations. Need more thoughts on whether both or just one category should be used to define the sub-directories. Signed-off-by: Liu Yi L -

[RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-09-19 Thread Liu Yi L
. In case a device is exposed in both legacy and new interfaces (see next patch for how to decide it), this patch also ensures that when the device is already opened via one interface then the other one must be blocked. Signed-off-by: Liu Yi L --- drivers/vfio/vfio.c | 228

[RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-09-19 Thread Liu Yi L
here. [1] https://lore.kernel.org/kvm/4c0eb470.1hmjondo00nivfm6%25p...@cisco.com/ Signed-off-by: Liu Yi L --- drivers/iommu/Kconfig | 1 + drivers/iommu/Makefile | 1 + drivers/iommu/iommufd/Kconfig | 11 drivers/iommu/iommufd/Makefile | 2 + drivers/iommu/iommufd

[RFC 00/20] Introduce /dev/iommu for userspace I/O address space management

2021-09-19 Thread Liu Yi L
/luxis1999/dev-iommu/commits/dev-iommu-5.14-rfcv1 Thanks for your time! Regards, Yi Liu --- Liu Yi L (15): iommu/iommufd: Add /dev/iommu core vfio: Add device class for /dev/vfio/devices vfio: Add vfio_[un]register_device() vfio/pci: Register device to /dev/vfio/devices iommu/iommufd: Add

[PATCH v1 1/3] iommu/vt-d: Using pasid_pte_is_present() helper function

2021-08-16 Thread Liu Yi L
Use pasid_pte_is_present() for present bit check in intel_pasid_tear_down_entry(). Cc: Lu Baolu Signed-off-by: Liu Yi L --- drivers/iommu/intel/pasid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index

[PATCH v1 3/3] iommu/vt-d: Fix Unexpected page request in Privilege Mode

2021-08-16 Thread Liu Yi L
is enough. Fixes: 1c4f88b7f1f9 ("iommu/vt-d: Shared virtual address in scalable mode") Cc: Lu Baolu Signed-off-by: Kumar Sanjay K Signed-off-by: Liu Yi L Tested-by: Yi Sun --- drivers/iommu/intel/pasid.c | 10 -- drivers/iommu/intel/pasid.h | 5 + 2 files changed, 13

[PATCH v1 2/3] iommu/vt-d: Add present bit check in pasid entry setup helper functions

2021-08-16 Thread Liu Yi L
The helper functions is not capable to modify the pasid entries which are still in use. So should have a check against present bit. Cc: Lu Baolu Signed-off-by: Liu Yi L --- drivers/iommu/intel/pasid.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/iommu/intel

[PATCH v1 0/3] Misc fixes to intel iommu driver

2021-08-16 Thread Liu Yi L
Hi, This series includes two minor enhancements and one bug fix. Please have a review. Thanks, Yi Liu --- Liu Yi L (3): iommu/vt-d: Using pasid_pte_is_present() helper function iommu/vt-d: Add present bit check in pasid entry setup helper functions iommu/vt-d: Fix Unexpected page

Re: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Liu Yi L
Hi Alex, On Wed, 16 Jun 2021 13:39:37 -0600, Alex Williamson wrote: > On Wed, 16 Jun 2021 06:43:23 + > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > > > On Tue, 15 Jun 2021 02:31:39 + > > > "Tian, Kevin" wrote: > > > >

RE: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread Liu, Yi L
> From: Shenming Lu > Sent: Friday, June 4, 2021 10:03 AM > > On 2021/6/4 2:19, Jacob Pan wrote: > > Hi Shenming, > > > > On Wed, 2 Jun 2021 12:50:26 +0800, Shenming Lu > > > wrote: > > > >> On 2021/6/2 1:33, Jason Gunthorpe wrote: > >>> On Tue, Jun 01, 2021 at 08:30:35PM +0800, Lu Baolu wrote:

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Liu Yi L
On Tue, 1 Jun 2021 10:36:36 +0800, Jason Wang wrote: > 在 2021/5/31 下午4:41, Liu Yi L 写道: > >> I guess VFIO_ATTACH_IOASID will fail if the underlayer doesn't support > >> hardware nesting. Or is there way to detect the capability before? > > I think it could fail i

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Liu Yi L
On Fri, 28 May 2021 20:36:49 -0300, Jason Gunthorpe wrote: > On Thu, May 27, 2021 at 07:58:12AM +, Tian, Kevin wrote: > > > 2.1. /dev/ioasid uAPI > > + > > > > /* > > * Check whether an uAPI extension is supported. > > * > > * This is for FD-level capabilities, such

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Liu Yi L
On Fri, 28 May 2021 10:24:56 +0800, Jason Wang wrote: > 在 2021/5/27 下午3:58, Tian, Kevin 写道: > > /dev/ioasid provides an unified interface for managing I/O page tables for > > devices assigned to userspace. Device passthrough frameworks (VFIO, vDPA, > > etc.) are expected to use this interface

Re: [PATCH 3/6] vfio: remove the unused mdev iommu hook

2021-05-14 Thread Liu Yi L
Morning Jason, On Fri, 14 May 2021 10:39:39 -0300, Jason Gunthorpe wrote: > On Fri, May 14, 2021 at 01:17:23PM +, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Thursday, May 13, 2021 8:01 PM > > > > > > On Thu, May 13, 2021 at 03:28:52AM +, Tian, Kevin wrote: > > > > >

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-11 Thread Liu Yi L
On Tue, 11 May 2021 09:10:03 +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Monday, May 10, 2021 8:37 PM > > > [...] > > > gPASID!=hPASID has a problem when assigning a physical device which > > > supports both shared work queue (ENQCMD with PASID in MSR) > > > and dedicated

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-08 Thread Liu Yi L
Hi Jason, On Wed, 5 May 2021 19:21:20 -0300, Jason Gunthorpe wrote: > On Wed, May 05, 2021 at 01:04:46PM -0700, Jacob Pan wrote: > > Hi Jason, > > > > On Wed, 5 May 2021 15:00:23 -0300, Jason Gunthorpe wrote: > > > > > On Wed, May 05, 2021 at 10:22:59AM -0700, Jacob Pan wrote: > > > > >

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-22 Thread Liu Yi L
On Wed, 21 Apr 2021 13:33:12 -0600, Alex Williamson wrote: > On Wed, 21 Apr 2021 14:52:03 -0300 > Jason Gunthorpe wrote: > > > On Wed, Apr 21, 2021 at 10:54:51AM -0600, Alex Williamson wrote: > > > > > That's essentially replacing vfio-core, where I think we're more > > > > I am only

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-21 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 16, 2021 11:46 PM [...] > > This is not a tactic or excuse for not working on the new /dev/ioasid > > interface. In fact, I believe we can benefit from the lessons learned > > while completing the existing. This will give confidence to the

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-02 Thread Liu, Yi L
Hi Jason, > From: Jason Gunthorpe > Sent: Thursday, April 1, 2021 7:54 PM > > On Thu, Apr 01, 2021 at 07:04:01AM +0000, Liu, Yi L wrote: > > > After reading your reply in https://lore.kernel.org/linux- > iommu/20210331123801.gd1463...@nvidia.com/#t > > So you

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Thursday, April 1, 2021 9:43 PM > > On Thu, Apr 01, 2021 at 01:38:46PM +0000, Liu, Yi L wrote: > > > From: Jean-Philippe Brucker > > > Sent: Thursday, April 1, 2021 8:05 PM > > [...] > > > > > > Also

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Thursday, April 1, 2021 9:16 PM > > On Thu, Apr 01, 2021 at 01:10:48PM +0000, Liu, Yi L wrote: > > > From: Jason Gunthorpe > > > Sent: Thursday, April 1, 2021 7:47 PM > > [...] > > > I'm worried Intel views the only

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Liu, Yi L
> From: Jean-Philippe Brucker > Sent: Thursday, April 1, 2021 8:05 PM [...] > > Also wondering about: > > * Querying IOMMU nesting capabilities before binding page tables (which > page table formats are supported?). We were planning to have a VFIO cap, > but I'm guessing we need to go back

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Thursday, April 1, 2021 7:47 PM [...] > I'm worried Intel views the only use of PASID in a guest is with > ENQCMD, but that is not consistent with the industry. We need to see > normal nested PASID support with assigned PCI VFs. I'm not quire flow here. Intel also

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Liu, Yi L
Hi Jason, > From: Liu, Yi L > Sent: Thursday, April 1, 2021 12:39 PM > > > From: Jason Gunthorpe > > Sent: Wednesday, March 31, 2021 8:41 PM > > > > On Wed, Mar 31, 2021 at 07:38:36AM +, Liu, Yi L wrote: > > > > > The reason is /de

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-31 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Wednesday, March 31, 2021 8:41 PM > > On Wed, Mar 31, 2021 at 07:38:36AM +0000, Liu, Yi L wrote: > > > The reason is /dev/ioasid FD is per-VM since the ioasid allocated to > > the VM should be able to be shared by all assigned device

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-31 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, March 30, 2021 9:43 PM [..] > No, the mdev device driver must enforce this directly. It is the one > that programms the physical shared HW, it is the one that needs a list > of PASID's it is allowed to program *for each mdev* > > ioasid_set doesn't seem

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-31 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, March 30, 2021 9:28 PM > > On Tue, Mar 30, 2021 at 04:14:58AM +, Tian, Kevin wrote: > > > One correction. The mdev should still construct the list of allowed PASID's > as > > you said (by listening to IOASID_BIND/UNBIND event), in addition to the >

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-31 Thread Liu, Yi L
Hi Jason, > From: Jason Gunthorpe > Sent: Tuesday, March 30, 2021 9:29 PM > > On Tue, Mar 30, 2021 at 01:37:05AM +, Tian, Kevin wrote: [...] > > Hi, Jason, > > > > Actually above is a major open while we are refactoring vSVA uAPI toward > > this direction. We have two concerns about merging

RE: [Patch v8 04/10] vfio/type1: Support binding guest page tables to PASID

2021-03-03 Thread Liu, Yi L
ar 02, 2021 at 09:13:19AM -0800, Jacob Pan wrote: > > > > Hi Jason, > > > > > > > > On Tue, 2 Mar 2021 08:56:28 -0400, Jason Gunthorpe > > > > wrote: > > > > > On Wed, Mar 03, 2021 at 04:35:39AM +0800, Liu Yi L wrote: > > > >

RE: [Patch v8 03/10] vfio/type1: Report iommu nesting info to userspace

2021-03-03 Thread Liu, Yi L
Hi Jason, > From: Jason Gunthorpe > Sent: Tuesday, March 2, 2021 8:52 PM > > On Wed, Mar 03, 2021 at 04:35:38AM +0800, Liu Yi L wrote: > > diff --git a/drivers/vfio/vfio_iommu_type1.c > b/drivers/vfio/vfio_iommu_type1.c > > index 4bb162c1d649..3a5c84d4f19b 10

RE: [PATCH v7 02/16] iommu/smmu: Report empty domain nesting info

2021-03-03 Thread Liu, Yi L
Hi Eric, > From: Auger Eric > Sent: Friday, February 12, 2021 5:58 PM > > Hi Vivek, Yi, > > On 2/12/21 8:14 AM, Vivek Gautam wrote: > > Hi Yi, > > > > > > On Sat, Jan 23, 2021 at 2:29 PM Liu, Yi L wrote: > >> > >> Hi Eric, > >

RE: [PATCH V4 00/18] IOASID extensions for guest SVA

2021-03-02 Thread Liu, Yi L
> From: Jacob Pan > Sent: Sunday, February 28, 2021 6:01 AM > > I/O Address Space ID (IOASID) core code was introduced in v5.5 as a generic > kernel allocator service for both PCIe Process Address Space ID (PASID) and > ARM SMMU's Substream ID. IOASIDs are used to associate DMA requests > with >

[Patch v8 10/10] iommu/vt-d: Support reporting nesting capability info

2021-03-02 Thread Liu Yi L
This patch reports nesting info when iommu_domain_get_attr() is called with DOMAIN_ATTR_NESTING and one domain with nesting set. Cc: Kevin Tian CC: Jacob Pan Cc: Alex Williamson Cc: Eric Auger Cc: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Signed-off

[Patch v8 09/10] vfio: Document dual stage control

2021-03-02 Thread Liu Yi L
: Lu Baolu Signed-off-by: Eric Auger Signed-off-by: Liu Yi L Reviewed-by: Stefan Hajnoczi --- v7 -> v8: *) remove SYSWIDE_PASID description, point to /dev/ioasid when mentioning PASID allocation from host. v6 -> v7: *) tweak per Eric's comments. v5 -> v6: *) tweak per Eric's comm

[Patch v8 08/10] vfio/pci: Expose PCIe PASID capability to userspace

2021-03-02 Thread Liu Yi L
: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Reviewed-by: Eric Auger --- v7 -> v8: *) refine the commit message and the subject. v5 -> v6: *) add review-by from Eric Auger. v1 -> v2: *) added in v2, but it was sent in a separate patchseries before ---

[Patch v8 07/10] vfio/type1: Add vSVA support for IOMMU-backed mdevs

2021-03-02 Thread Liu Yi L
. The main requirement is to use the auxiliary domain associated with mdev. Cc: Kevin Tian CC: Jacob Pan CC: Jun Tian Cc: Alex Williamson Cc: Eric Auger Cc: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Reviewed-by: Eric Auger --- v5 -> v6: *) add review-by f

[Patch v8 06/10] iommu: Pass domain to sva_unbind_gpasid()

2021-03-02 Thread Liu Yi L
@domain per the above reason. Cc: Kevin Tian CC: Jacob Pan Cc: Alex Williamson Cc: Eric Auger Cc: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Yi Sun Signed-off-by: Liu Yi L --- v7 -> v8: *) tweaked the commit message. v6 -> v7: *) correct the link for the d

[Patch v8 05/10] vfio/type1: Allow invalidating first-level/stage IOMMU cache

2021-03-02 Thread Liu Yi L
Cc: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Signed-off-by: Eric Auger Signed-off-by: Jacob Pan --- v1 -> v2: *) rename from "vfio/type1: Flush stage-1 IOMMU cache for nesting type" *) rename vfio_cache_inv_fn() to vfio_dev_cache_

[Patch v8 04/10] vfio/type1: Support binding guest page tables to PASID

2021-03-02 Thread Liu Yi L
: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Jean-Philippe Brucker Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- v7 -> v8: *) adapt to /dev/ioasid *) address comments from Alex on v7. *) adapt to latest iommu_sva_unbind_gpasid() implementation. *) remove the

[Patch v8 03/10] vfio/type1: Report iommu nesting info to userspace

2021-03-02 Thread Liu Yi L
Signed-off-by: Liu Yi L --- v7 -> v8: *) tweak per Alex's comments against v7. *) check "iommu->nesting_info->format == 0" in attach_group() v6 -> v7: *) using vfio_info_add_capability() for adding nesting cap per suggestion from Eric. v5 -> v6: *) address comments a

[Patch v8 02/10] iommu/smmu: Report empty domain nesting info

2021-03-02 Thread Liu Yi L
Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan Reviewed-by: Eric Auger --- v5 -> v6: *) add review-by from Eric Auger. v4 -> v5: *) address comments from Eric Auger. --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 29 +++-- drivers/iommu/arm/arm-smmu/arm-smmu.c

[Patch v8 01/10] iommu: Report domain nesting info

2021-03-02 Thread Liu Yi L
-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- v7 -> v8: *) add padding in struct iommu_nesting_info_vtd *) describe future extension rules for struct iommu_nesting_info in iommu.rst. *) remove SYSWIDE_PASID v6 -> v7: *) rephrase the

[Patch v8 00/10] vfio: expose virtual Shared Virtual Addressing to VMs

2021-03-02 Thread Liu Yi L
..@intel.com/ - RFC v1 -> v2: Dropped vfio: VFIO_IOMMU_ATTACH/DETACH_PASID_TABLE. RFC v1: https://lore.kernel.org/kvm/1562324772-3084-1-git-send-email-yi.l@intel.com/ --- Eric Auger (1): vfio: Document dual stage control Liu Yi L (8): iommu: Report domain nestin

RE: [PATCH v7 02/16] iommu/smmu: Report empty domain nesting info

2021-01-23 Thread Liu, Yi L
Hi Eric, > From: Auger Eric > Sent: Tuesday, January 19, 2021 6:03 PM > > Hi Yi, Vivek, > [...] > > I see. I think there needs a change in the code there. Should also expect > > a nesting_info returned instead of an int anymore. @Eric, how about your > > opinion? > > > > domain =

RE: [PATCH v7 02/16] iommu/smmu: Report empty domain nesting info

2021-01-12 Thread Liu, Yi L
Hi Vivek, > From: Vivek Gautam > Sent: Tuesday, January 12, 2021 7:06 PM > > Hi Yi, > > > On Tue, Jan 12, 2021 at 2:51 PM Liu, Yi L wrote: > > > > Hi Vivek, > > > > > From: Vivek Gautam > > > Sent: Tuesday, January 12, 2021 2:50 PM

RE: [PATCH v7 02/16] iommu/smmu: Report empty domain nesting info

2021-01-12 Thread Liu, Yi L
Hi Vivek, > From: Vivek Gautam > Sent: Tuesday, January 12, 2021 2:50 PM > > Hi Yi, > > > On Thu, Sep 10, 2020 at 4:13 PM Liu Yi L wrote: > > > > This patch is added as instead of returning a boolean for > DOMAIN_ATTR_NESTING, > > iommu_domain_get_

[PATCH v4 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2021-01-06 Thread Liu Yi L
-> has_iotlb_device needs to be updated when attaching to subdevices. Fixes: 67b8e02b5e761 ("iommu/vt-d: Aux-domain specific domain attach/detach") Signed-off-by: Liu Yi L Acked-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 53 +++-- 1 fil

[PATCH v4 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info

2021-01-06 Thread Liu Yi L
ses. For example, flushing device_iotlb for a domain which has sub-devices attached by auxiliary manner. Fixes: 67b8e02b5e761 ("iommu/vt-d: Aux-domain specific domain attach/detach") Co-developed-by: Xin Zeng Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L Acked-by: Lu Baolu --- driver

[PATCH v4 1/3] iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev

2021-01-06 Thread Liu Yi L
/vt-d: Shared virtual address in scalable mode") Cc: Lu Baolu Cc: Jacob Pan Cc: Raj Ashok Cc: David Woodhouse Reported-by: Guo Kaijie Reported-by: Xin Zeng Signed-off-by: Guo Kaijie Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L Tested-by: Guo Kaijie Cc: sta...@vger.kernel.org # v

[PATCH v4 0/3] iommu/vt-d: Misc fixes on scalable mode

2021-01-06 Thread Liu Yi L
ename "iommu/vt-d: A fix to iommu_flush_dev_iotlb() for aux-domain" to be "iommu/vt-d: Fix ineffective devTLB invalidation for subdevices" - Refined the commit messages v1: https://lore.kernel.org/linux-iommu/2020122352.183523-1-yi.l@intel.com/ Regards, Yi Liu Li

RE: [PATCH v3 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2021-01-06 Thread Liu, Yi L
Hi Will, > From: Will Deacon > Sent: Wednesday, January 6, 2021 1:24 AM > > On Tue, Jan 05, 2021 at 05:50:22AM +0000, Liu, Yi L wrote: > > > > +static void __iommu_flush_dev_iotlb(struct device_domain_info > *info, > > > > +

RE: [PATCH v3 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info

2021-01-04 Thread Liu, Yi L
Hi Baolu, > From: Lu Baolu > Sent: Tuesday, December 29, 2020 4:38 PM > > Hi Yi, > > On 2020/12/29 11:25, Liu Yi L wrote: > > In the existing code, loop all devices attached to a domain does not > > include sub-devices attached via iommu_aux_attach_device(). >

RE: [PATCH v3 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2021-01-04 Thread Liu, Yi L
Hi Baolu, > From: Lu Baolu > Sent: Tuesday, December 29, 2020 4:42 PM > > Hi Yi, > > On 2020/12/29 11:25, Liu Yi L wrote: > > iommu_flush_dev_iotlb() is called to invalidate caches on device. It only > > loops the devices which are full-attached

[PATCH v3 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2020-12-28 Thread Liu Yi L
-> has_iotlb_device needs to be updated when attaching to subdevices. Fixes: 67b8e02b5e761 ("iommu/vt-d: Aux-domain specific domain attach/detach") Signed-off-by: Liu Yi L --- drivers/iommu/intel/iommu.c | 53 ++--- 1 file changed, 37 insertions(+), 16 delet

[PATCH v3 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info

2020-12-28 Thread Liu Yi L
ses. For example, flushing device_iotlb for a domain which has sub-devices attached by auxiliary manner. Co-developed-by: Xin Zeng Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L --- drivers/iommu/intel/iommu.c | 95 +++-- include/linux/intel-iommu.h | 16 +--

[PATCH v3 1/3] iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev

2020-12-28 Thread Liu Yi L
/vt-d: Shared virtual address in scalable mode") Cc: Lu Baolu Cc: Jacob Pan Cc: Raj Ashok Cc: David Woodhouse Reported-by: Guo Kaijie Reported-by: Xin Zeng Signed-off-by: Guo Kaijie Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L --- drivers/iommu/intel/svm.c | 9 + include/l

[PATCH v3 0/3] iommu/vt-d: Misc fixes on scalable mode

2020-12-28 Thread Liu Yi L
quot; - Rename "iommu/vt-d: A fix to iommu_flush_dev_iotlb() for aux-domain" to be "iommu/vt-d: Fix ineffective devTLB invalidation for subdevices" - Refined the commit messages v1: https://lore.kernel.org/linux-iommu/2020122352.183523-1-yi.l@intel.com/ Liu Yi L (3):

RE: [PATCH v2 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2020-12-25 Thread Liu, Yi L
Hi Baolu, Well received, all comments accepted. thanks. Regards, Yi Liu > From: Lu Baolu > Sent: Wednesday, December 23, 2020 6:10 PM > > Hi Yi, > > On 2020/12/23 14:27, Liu Yi L wrote: > > iommu_flush_dev_iotlb() is called to invalidate caches on device. It only >

[PATCH v2 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2020-12-22 Thread Liu Yi L
-> has_iotlb_device needs to be updated when attaching to subdevices. Fixes: 67b8e02b5e761 ("iommu/vt-d: Aux-domain specific domain attach/detach") Signed-off-by: Liu Yi L --- drivers/iommu/intel/iommu.c | 63 +++-- 1 file changed, 47 insertions(+), 16 delet

[PATCH v2 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info

2020-12-22 Thread Liu Yi L
ses. For example, flushing device_iotlb for a domain which has sub-devices attached by auxiliary manner. Co-developed-by: Xin Zeng Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L --- drivers/iommu/intel/iommu.c | 95 +++-- include/linux/intel-iommu.h | 16 +--

[PATCH v2 1/3] iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev

2020-12-22 Thread Liu Yi L
/vt-d: Shared virtual address in scalable mode") Cc: Lu Baolu Cc: Jacob Pan Cc: Raj Ashok Cc: David Woodhouse Reported-by: Guo Kaijie Reported-by: Xin Zeng Signed-off-by: Guo Kaijie Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L Tested-by: Guo Kaijie --- drivers/iommu/intel/s

[PATCH v2 0/3] iommu/vt-d: Misc fixes on scalable mode

2020-12-22 Thread Liu Yi L
This patchset aims to fix a bug regards to native SVM usage, and also several bugs around subdevice (attached to device via auxiliary manner) tracking and ineffective device_tlb flush. Liu Yi L (3): iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev iommu/vt-d

RE: [PATCH 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info.

2020-12-22 Thread Liu, Yi L
Hi Jacob, > From: Jacob Pan > Sent: Wednesday, December 23, 2020 4:21 AM > > Hi Yi, > > On Sun, 20 Dec 2020 08:03:51 +0800, Liu Yi L wrote: > > > In existing code, if wanting to loop all devices attached to a domain, > > current code can only loop the devices

RE: [PATCH 0/4] iommu/vtd-: Misc fixes on scalable mode

2020-12-22 Thread Liu, Yi L
> From: Jacob Pan > Sent: Wednesday, December 23, 2020 2:17 AM > > Hi Yi, > > nit: The cover letter is 0/4, patches are 1/3 - 3/3. You also need to copy > LKML. > > On Sun, 20 Dec 2020 08:03:49 +0800, Liu Yi L wrote: > > > Hi, > > > > This

[PATCH 1/3] iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev

2020-12-18 Thread Liu Yi L
/vt-d: Add basic SVM PASID support") Cc: Lu Baolu Cc: Jacob Pan Cc: Raj Ashok Cc: David Woodhouse Reported-by: Guo Kaijie Reported-by: Xin Zeng Signed-off-by: Guo Kaijie Signed-off-by: Xin Zeng Signed-off-by: Liu Yi L --- drivers/iommu/intel/svm.c | 9 + include/linux/intel-i

[PATCH 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info.

2020-12-18 Thread Liu Yi L
Co-developed-by: Liu Yi L Signed-off-by: Liu Yi L Co-developed-by: Lu Baolu Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 92 - include/linux/intel-iommu.h | 11 - 2 files changed, 90 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/in

[PATCH 0/4] iommu/vtd-: Misc fixes on scalable mode

2020-12-18 Thread Liu Yi L
Hi, This patchset aims to fix a bug regards to SVM usage on native, and also several bugs around subdevice (attached to device via auxiliary manner) tracking and ineffective device_tlb flush. Regards, Yi Liu Liu Yi L (3): iommu/vt-d: Move intel_iommu info from struct intel_svm to struct

[PATCH 3/3] iommu/vt-d: A fix to iommu_flush_dev_iotlb() for aux-domain

2020-12-18 Thread Liu Yi L
->has_iotlb_device for both device/subdevice attach/detach and ATS enabling/disabling. Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 90 + 1 file changed, 72 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/in

RE: [PATCH v2 1/1] vfio/type1: Add vfio_group_domain()

2020-11-25 Thread Liu, Yi L
On Thurs, Nov 26, 2020, at 9:27 AM, Lu Baolu wrote: > Add the API for getting the domain from a vfio group. This could be used > by the physical device drivers which rely on the vfio/mdev framework for > mediated device user level access. The typical use case like below: > > unsigned int

  1   2   3   4   5   6   >