[PATCH v7 11/16] vfio/type1: Allow invalidating first-level/stage IOMMU cache

2020-09-10 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 v7 05/16] iommu/vt-d: Support setting ioasid set to domain

2020-09-10 Thread Liu Yi L
son Cc: Eric Auger Cc: Jean-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- v6 -> v7: *) add a helper function __domain_config_ioasid_set() per Eric's comment. *) rename @ioasid_sid field of struct dmar_domain to be @pasid_set. *) Er

[PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-09-10 Thread Liu Yi L
fio: 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 (14): iommu: Report domain nesting info iommu/smmu: Report empty domain nesting info vfio/type

[PATCH v7 14/16] vfio: Document dual stage control

2020-09-10 Thread Liu Yi L
l Cc: Lu Baolu Signed-off-by: Eric Auger Signed-off-by: Liu Yi L Reviewed-by: Stefan Hajnoczi --- v6 -> v7: *) tweak per Eric's comments. v5 -> v6: *) tweak per Eric's comments. v3 -> v4: *) add review-by from Stefan Hajnoczi v2 -> v3: *) address comments from Stefan Ha

[PATCH v7 15/16] iommu/vt-d: Only support nesting when nesting caps are consistent across iommu units

2020-09-10 Thread Liu Yi L
This patch makes change to only supports the case where all the physical iommu units have the same CAP/ECAP MASKS for nested translation. 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

[PATCH v7 01/16] iommu: Report domain nesting info

2020-09-10 Thread Liu Yi L
-Philippe Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- v6 -> v7: *) rephrase the commit message, replace the @data[] field in struct iommu_nesting_info with union per comments from Eric Auger. v5 -> v6: *) rephrase the feature notes per comment

[PATCH v7 06/16] iommu/vt-d: Remove get_task_mm() in bind_gpasid()

2020-09-10 Thread Liu Yi L
Brucker Cc: Joerg Roedel Cc: Lu Baolu Signed-off-by: Liu Yi L --- drivers/iommu/intel/svm.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index 519eabb..d3cf52b 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel

[PATCH v7 10/16] vfio/type1: Support binding guest page tables to PASID

2020-09-10 Thread Liu Yi L
re the binding request. 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: Jean-Philippe Brucker Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- v6 -> v7: *) introduced @user in struct domain_capsule to

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

2021-03-02 Thread Liu Yi L
RFC v2: https://lore.kernel.org/kvm/1571919983-3231-1-git-send-email-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

[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 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 03/10] vfio/type1: Report iommu nesting info to userspace

2021-03-02 Thread Liu Yi L
l Cc: Lu Baolu 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: *

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

2021-03-02 Thread Liu Yi L
r Cc: 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. *) remov

[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 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 deta

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

2021-03-02 Thread Liu Yi L
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 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 09/10] vfio: Document dual stage control

2021-03-02 Thread Liu Yi L
l Cc: 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 E

[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-by

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 > v

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 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 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 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 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 > io

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 to

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-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 /dev/i

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
> 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 t

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

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-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-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 ne

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 tal

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-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 wor

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: [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 inst

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 as

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

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: 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: > > > > >

[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

[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 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

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

2021-09-18 Thread Liu Yi L
nd in: https://github.com/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/dev

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

2021-09-18 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 02/20] vfio: Add device class for /dev/vfio/devices

2021-09-18 Thread Liu Yi L
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 03/20] vfio: Add vfio_[un]register_device()

2021-09-18 Thread Liu Yi L
, to identify the sub-directory. 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-directorie

[RFC 04/20] iommu: Add iommu_device_get_info interface

2021-09-18 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 iom

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

2021-09-18 Thread Liu Yi L
er/group attaching 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

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

2021-09-18 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 07/20] iommu/iommufd: Add iommufd_[un]bind_device()

2021-09-18 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 08/20] vfio/pci: Add VFIO_DEVICE_BIND_IOMMUFD

2021-09-18 Thread Liu Yi L
f I/O 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

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

2021-09-18 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 943de6897f56..86d34e4ce0

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

2021-09-18 Thread Liu Yi L
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 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-18 Thread Liu Yi L
d ARM SSID (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

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

2021-09-18 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 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group

2021-09-18 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 i

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

2021-09-18 Thread Liu Yi L
ection 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/dri

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

2021-09-18 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 16/20] vfio/type1: Export symbols for dma [un]map code sharing

2021-09-18 Thread Liu Yi L
other key 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 chan

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

2021-09-18 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 18/20] iommu/iommufd: Add IOMMU_[UN]MAP_DMA on IOASID

2021-09-18 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 19/20] iommu/vt-d: Implement device_info iommu_ops callback

2021-09-18 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 dd22fc7d5176..

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

2021-09-18 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

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

2021-09-18 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

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 userspace.

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 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-22 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: [PATCH v7 10/16] vfio/type1: Support binding guest page tables to PASID

2020-09-11 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Saturday, September 12, 2020 6:04 AM > > On Thu, 10 Sep 2020 03:45:27 -0700 > Liu Yi L wrote: > > > Nesting translation allows two-levels/stages page tables, with 1st > > level for guest translations (e.g. GVA->GPA), 2n

RE: [PATCH v7 07/16] vfio/type1: Add VFIO_IOMMU_PASID_REQUEST (alloc/free)

2020-09-11 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Saturday, September 12, 2020 5:38 AM > > On Thu, 10 Sep 2020 03:45:24 -0700 > Liu Yi L wrote: > > > This patch allows userspace to request PASID allocation/free, e.g. when > > serving the request from the guest. > &

RE: [PATCH v7 13/16] vfio/pci: Expose PCIe PASID capability to guest

2020-09-12 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Saturday, September 12, 2020 6:13 AM > > On Thu, 10 Sep 2020 03:45:30 -0700 > Liu Yi L wrote: > > > This patch exposes PCIe PASID capability to guest for assigned devices. > > Existing vfio_pci driver hides it from g

RE: [PATCH v7 03/16] vfio/type1: Report iommu nesting info to userspace

2020-09-12 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Saturday, September 12, 2020 4:17 AM > > On Thu, 10 Sep 2020 03:45:20 -0700 > Liu Yi L wrote: > > > This patch exports iommu nesting capability info to user space through > > VFIO. Userspace is expected to check this

RE: [PATCH v7 04/16] vfio: Add PASID allocation/free support

2020-09-14 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Saturday, September 12, 2020 4:55 AM > > On Thu, 10 Sep 2020 03:45:21 -0700 > Liu Yi L wrote: > > > Shared Virtual Addressing (a.k.a Shared Virtual Memory) allows sharing > > multiple process virtual address spaces

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-15 Thread Liu, Yi L
> From: Jason Wang > Sent: Thursday, October 15, 2020 4:41 PM > > > On 2020/10/15 ??3:58, Tian, Kevin wrote: > >> From: Jason Wang > >> Sent: Thursday, October 15, 2020 2:52 PM > >> > >> > >> On 2020/10/14 ??11:08, Tian, Kevin wrote: > From: Jason Wang > Sent: Tuesday, October 13, 20

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-19 Thread Liu, Yi L
Hi Jason, Good to see your response. > From: Jason Gunthorpe > Sent: Friday, October 16, 2020 11:37 PM > > On Wed, Oct 14, 2020 at 03:16:22AM +, Tian, Kevin wrote: > > Hi, Alex and Jason (G), > > > > How about your opinion for this new proposal? For now looks both > > Jason (W) and Jean are

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-20 Thread Liu, Yi L
Hey Jason, > From: Jason Wang > Sent: Tuesday, October 20, 2020 2:18 PM > > On 2020/10/15 ??6:14, Liu, Yi L wrote: > >> From: Jason Wang > >> Sent: Thursday, October 15, 2020 4:41 PM > >> > >> > >> On 2020/10/15 ??3:58, Tian, Kevin wrote

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-20 Thread Liu, Yi L
> From: Jason Wang > Sent: Tuesday, October 20, 2020 5:20 PM > > Hi Yi: > > On 2020/10/20 ??4:19, Liu, Yi L wrote: > >> Yes, but since PASID is a global identifier now, I think kernel > >> should track the a device list per PASID? > > We have such track

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-20 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Monday, October 19, 2020 10:25 PM > > On Mon, Oct 19, 2020 at 08:39:03AM +0000, Liu, Yi L wrote: > > Hi Jason, > > > > Good to see your response. > > Ah, I was away got it. :-) > > > > > Sec

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-20 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, October 20, 2020 9:55 PM > > On Tue, Oct 20, 2020 at 09:40:14AM +0000, Liu, Yi L wrote: > > > > See previous discussion with Kevin. If I understand correctly, you expect > > > a > shared > > > L2 table if

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-20 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, October 20, 2020 10:05 PM > To: Liu, Yi L > > On Tue, Oct 20, 2020 at 02:00:31PM +, Liu, Yi L wrote: > > > From: Jason Gunthorpe > > > Sent: Tuesday, October 20, 2020 9:55 PM > > > > > > On Tue

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-20 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, October 20, 2020 10:02 PM [...] > > > Whoever provides the vIOMMU emulation and relays the page fault to the > guest > > > has to translate the RID - > > > > that's the point. But the device info (especially the sub-device info) is > > within the passthru f

RE: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-10-21 Thread Liu, Yi L
Hi Jason, > From: Jason Wang > Sent: Thursday, October 22, 2020 10:56 AM > [...] > If you(Intel) don't have plan to do vDPA, you should not prevent other vendors > from implementing PASID capable hardware through non-VFIO subsystem/uAPI > on top of your SIOV architecture. Isn't it? yes, that's

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 pas

[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

[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 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info.

2020-12-18 Thread Liu Yi L
Xin Zeng 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/driver

[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

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 pa

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

[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

[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 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info

2020-12-22 Thread Liu Yi L
er cases. 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 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

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 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
t; - 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):

<    1   2   3   4   5   6   >