Re: [PATCH v4 00/22] SMMUv3 Nested Stage Setup

2019-03-05 Thread Auger Eric
Hi, On 2/18/19 2:54 PM, Eric Auger wrote: > This series allows a virtualizer to program the nested stage mode. > This is useful when both the host and the guest are exposed with > an SMMUv3 and a PCI device is assigned to the guest using VFIO. > > In this mode, the physical IOMMU must be

Re: [PATCH v5 05/22] iommu: Introduce cache_invalidate API

2019-03-17 Thread Auger Eric
Hi Jacob, On 3/15/19 7:37 PM, Jacob Pan wrote: > On Fri, 15 Mar 2019 17:08:49 +0100 > Eric Auger wrote: > >> From: "Liu, Yi L" >> >> In any virtualization use case, when the first translation stage >> is "owned" by the guest OS, the host IOMMU driver has no knowledge >> of caching structure

Re: [PATCH v5 05/22] iommu: Introduce cache_invalidate API

2019-03-18 Thread Auger Eric
Hi Jean, On 3/18/19 12:01 PM, Jean-Philippe Brucker wrote: > On 17/03/2019 16:43, Auger Eric wrote: >>>> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h >>>> index 532a64075f23..e4c6a447e85a 100644 >>>> --- a/include/uapi/linux/iommu.

Re: [PATCH v6 05/22] iommu: Introduce cache_invalidate API

2019-03-21 Thread Auger Eric
Hi jean, Jacob, On 3/21/19 3:13 PM, Jean-Philippe Brucker wrote: > On 21/03/2019 13:54, Auger Eric wrote: >> Hi Jacob, Jean-Philippe, >> >> On 3/20/19 5:50 PM, Jean-Philippe Brucker wrote: >>> On 20/03/2019 16:37, Jacob Pan wrote: >>> [...] >>>

Re: [PATCH v6 05/22] iommu: Introduce cache_invalidate API

2019-03-21 Thread Auger Eric
Hi Jacob, Jean-Philippe, On 3/20/19 5:50 PM, Jean-Philippe Brucker wrote: > On 20/03/2019 16:37, Jacob Pan wrote: > [...] >>> +struct iommu_inv_addr_info { >>> +#define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0) >>> +#define IOMMU_INV_ADDR_FLAGS_ARCHID(1 << 1) >>> +#define

Re: [PATCH v6 00/22] SMMUv3 Nested Stage Setup

2019-03-22 Thread Auger Eric
Hi, On 3/17/19 6:22 PM, Eric Auger wrote: > This series allows a virtualizer to program the nested stage mode. > This is useful when both the host and the guest are exposed with > an SMMUv3 and a PCI device is assigned to the guest using VFIO. > > In this mode, the physical IOMMU must be

Re: [PATCH v6 05/22] iommu: Introduce cache_invalidate API

2019-03-22 Thread Auger Eric
Hi Jacob, On 3/21/19 11:10 PM, Jacob Pan wrote: > On Thu, 21 Mar 2019 15:32:45 +0100 > Auger Eric wrote: > >> Hi jean, Jacob, >> >> On 3/21/19 3:13 PM, Jean-Philippe Brucker wrote: >>> On 21/03/2019 13:54, Auger Eric wrote: >>>> Hi Jacob, J

Re: [PATCH v6 07/22] vfio: VFIO_IOMMU_ATTACH/DETACH_PASID_TABLE

2019-03-22 Thread Auger Eric
Hi Alex, On 3/21/19 11:19 PM, Alex Williamson wrote: > On Sun, 17 Mar 2019 18:22:17 +0100 > Eric Auger wrote: > >> From: "Liu, Yi L" >> >> This patch adds VFIO_IOMMU_ATTACH/DETACH_PASID_TABLE ioctl >> which aims to pass/withdraw the virtual iommu guest configuration >> to/from the VFIO driver

Re: [PATCH v6 02/22] iommu: introduce device fault data

2019-03-22 Thread Auger Eric
Hi Jacob, On 3/21/19 11:04 PM, Jacob Pan wrote: > On Sun, 17 Mar 2019 18:22:12 +0100 > Eric Auger wrote: > >> From: Jacob Pan >> >> Device faults detected by IOMMU can be reported outside the IOMMU >> subsystem for further processing. This patch introduces >> a generic device fault data

Re: [PATCH v6 09/22] vfio: VFIO_IOMMU_BIND/UNBIND_MSI

2019-03-22 Thread Auger Eric
Hi Alex, On 3/22/19 12:01 AM, Alex Williamson wrote: > On Sun, 17 Mar 2019 18:22:19 +0100 > Eric Auger wrote: > >> This patch adds the VFIO_IOMMU_BIND/UNBIND_MSI ioctl which aim >> to pass/withdraw the guest MSI binding to/from the host. >> >> Signed-off-by: Eric Auger >> >> --- >> v3 -> v4: >>

Re: [RFC v3 02/21] iommu: Introduce cache_invalidate API

2019-01-29 Thread Auger Eric
Hi Jean-Philippe, On 1/28/19 6:32 PM, Jean-Philippe Brucker wrote: > Hi Eric, > > On 25/01/2019 16:49, Auger Eric wrote: > [...] >>>> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h >>>> index 7a7cf7a3de7c..4605f5cfac84 100644 >>>

Re: [RFC v3 02/21] iommu: Introduce cache_invalidate API

2019-01-30 Thread Auger Eric
Hi Alex, On 1/30/19 12:16 AM, Alex Williamson wrote: > On Fri, 25 Jan 2019 17:49:20 +0100 > Auger Eric wrote: > >> Hi Alex, >> >> On 1/11/19 10:30 PM, Alex Williamson wrote: >>> On Tue, 8 Jan 2019 11:26:14 +0100 >>> Eric Auger wrote: &g

Re: [RFC v3 01/21] iommu: Introduce set_pasid_table API

2019-01-25 Thread Auger Eric
Hi Jean-Philippe, On 1/11/19 7:16 PM, Jean-Philippe Brucker wrote: > On 08/01/2019 10:26, Eric Auger wrote: >> From: Jacob Pan >> >> In virtualization use case, when a guest is assigned >> a PCI host device, protected by a virtual IOMMU on a guest, >> the physical IOMMU must be programmed to be

Re: [RFC v3 01/21] iommu: Introduce set_pasid_table API

2019-01-25 Thread Auger Eric
Hi Jean-Philippe, On 1/25/19 9:39 AM, Auger Eric wrote: > Hi Jean-Philippe, > > On 1/11/19 7:16 PM, Jean-Philippe Brucker wrote: >> On 08/01/2019 10:26, Eric Auger wrote: >>> From: Jacob Pan >>> >>> In virtualization use case, when a guest is

Re: [RFC v3 01/21] iommu: Introduce set_pasid_table API

2019-01-25 Thread Auger Eric
Hi Alex, On 1/11/19 7:43 PM, Alex Williamson wrote: > On Tue, 8 Jan 2019 11:26:13 +0100 > Eric Auger wrote: > >> From: Jacob Pan >> >> In virtualization use case, when a guest is assigned >> a PCI host device, protected by a virtual IOMMU on a guest, >> the physical IOMMU must be programmed

Re: [RFC v3 03/21] iommu: Introduce bind_guest_msi

2019-01-25 Thread Auger Eric
Hi Alex, On 1/11/19 11:44 PM, Alex Williamson wrote: > On Tue, 8 Jan 2019 11:26:15 +0100 > Eric Auger wrote: > >> On ARM, MSI are translated by the SMMU. An IOVA is allocated >> for each MSI doorbell. If both the host and the guest are exposed >> with SMMUs, we end up with 2 different IOVAs

Re: [RFC v3 02/21] iommu: Introduce cache_invalidate API

2019-01-25 Thread Auger Eric
Hi Alex, On 1/11/19 10:30 PM, Alex Williamson wrote: > On Tue, 8 Jan 2019 11:26:14 +0100 > Eric Auger wrote: > >> From: "Liu, Yi L" >> >> In any virtualization use case, when the first translation stage >> is "owned" by the guest OS, the host IOMMU driver has no knowledge >> of caching

Re: [RFC v3 03/21] iommu: Introduce bind_guest_msi

2019-01-25 Thread Auger Eric
Hi Alex, On 1/11/19 11:44 PM, Alex Williamson wrote: > On Tue, 8 Jan 2019 11:26:15 +0100 > Eric Auger wrote: > >> On ARM, MSI are translated by the SMMU. An IOVA is allocated >> for each MSI doorbell. If both the host and the guest are exposed >> with SMMUs, we end up with 2 different IOVAs

Re: [PATCH v7 18/23] iommu/smmuv3: Report non recoverable faults

2019-05-13 Thread Auger Eric
Hi Robin, On 5/8/19 7:20 PM, Robin Murphy wrote: > On 08/04/2019 13:19, Eric Auger wrote: >> When a stage 1 related fault event is read from the event queue, >> let's propagate it to potential external fault listeners, ie. users >> who registered a fault handler. >> >> Signed-off-by: Eric Auger

Re: [PATCH v3 7/7] iommu/vt-d: Differentiate relaxable and non relaxable RMRRs

2019-05-17 Thread Auger Eric
Hi Lu, On 5/17/19 6:46 AM, Lu Baolu wrote: > Hi Eric, > > On 5/16/19 6:08 PM, Eric Auger wrote: >> Now we have a new IOMMU_RESV_DIRECT_RELAXABLE reserved memory >> region type, let's report USB and GFX RMRRs as relaxable ones. >> >> This allows to have a finer reporting at IOMMU API level of >>

Re: [PATCH v3 6/7] iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions

2019-05-17 Thread Auger Eric
Hi Robin, On 5/16/19 7:53 PM, Robin Murphy wrote: > On 16/05/2019 14:23, Auger Eric wrote: >> Hi Robin, >> On 5/16/19 2:46 PM, Robin Murphy wrote: >>> On 16/05/2019 11:08, Eric Auger wrote: >>>> Introduce a new type for reserved region. This corresponds &

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-04 Thread Auger Eric
Hi Alex, On 6/4/19 12:31 AM, Alex Williamson wrote: > On Sun, 26 May 2019 18:10:01 +0200 > Eric Auger wrote: > >> This patch registers a fault handler which records faults in >> a circular buffer and then signals an eventfd. This buffer is >> exposed within the fault region. >> >>

Re: [PATCH v8 28/29] vfio-pci: Add VFIO_PCI_DMA_FAULT_IRQ_INDEX

2019-06-04 Thread Auger Eric
Hi Alex, On 6/4/19 12:31 AM, Alex Williamson wrote: > On Sun, 26 May 2019 18:10:03 +0200 > Eric Auger wrote: > >> Add a new VFIO_PCI_DMA_FAULT_IRQ_INDEX index. This allows to >> set/unset an eventfd that will be triggered when DMA translation >> faults are detected at physical level when the

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-07 Thread Auger Eric
Hi Jean, Jacob, On 6/6/19 10:29 PM, Jacob Pan wrote: > On Thu, 6 Jun 2019 19:54:05 +0100 > Jean-Philippe Brucker wrote: > >> On 05/06/2019 23:45, Jacob Pan wrote: >>> On Tue, 4 Jun 2019 18:11:08 +0200 >>> Auger Eric wrote: >>> >>>>

Re: [PATCH v8 24/29] vfio: VFIO_IOMMU_BIND/UNBIND_MSI

2019-06-07 Thread Auger Eric
Hi Alex, On 6/4/19 12:32 AM, Alex Williamson wrote: > On Sun, 26 May 2019 18:09:59 +0200 > Eric Auger wrote: > >> This patch adds the VFIO_IOMMU_BIND/UNBIND_MSI ioctl which aim >> to pass/withdraw the guest MSI binding to/from the host. >> >> Signed-off-by: Eric Auger >> >> --- >> v6 -> v7: >>

Re: [PATCH v8 25/29] vfio-pci: Add a new VFIO_REGION_TYPE_NESTED region type

2019-06-07 Thread Auger Eric
Hi Alex, On 6/4/19 12:31 AM, Alex Williamson wrote: > On Sun, 26 May 2019 18:10:00 +0200 > Eric Auger wrote: > >> This patch adds two new regions aiming to handle nested mode >> translation faults. >> >> The first region (two host kernel pages) is read-only from the >> user-space perspective.

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-07 Thread Auger Eric
Hi Jean, On 6/7/19 2:48 PM, Jean-Philippe Brucker wrote: > On 26/05/2019 17:10, Eric Auger wrote: >> +int vfio_pci_iommu_dev_fault_handler(struct iommu_fault_event *evt, void >> *data) >> +{ >> +struct vfio_pci_device *vdev = (struct vfio_pci_device *) data; >> +struct

Re: [PATCH v5 1/7] iommu: Fix a leak in iommu_insert_resv_region

2019-05-29 Thread Auger Eric
Hi Christoph, On 5/29/19 8:17 AM, Christoph Hellwig wrote: >> } else if ((start >= a) && (end <= b)) { >> if (new->type == type) >> -goto done; >> +return 0; >> else >>

Re: [PATCH v5 7/7] iommu/vt-d: Differentiate relaxable and non relaxable RMRRs

2019-05-29 Thread Auger Eric
Hi Lu, On 5/29/19 4:34 AM, Lu Baolu wrote: > Hi, > > On 5/28/19 7:50 PM, Eric Auger wrote: >> Now we have a new IOMMU_RESV_DIRECT_RELAXABLE reserved memory >> region type, let's report USB and GFX RMRRs as relaxable ones. >> >> We introduce a new device_rmrr_is_relaxable() helper to check >>

Re: [PATCH v5 2/7] iommu/vt-d: Duplicate iommu_resv_region objects per device list

2019-05-29 Thread Auger Eric
Hi Lu, On 5/29/19 4:04 AM, Lu Baolu wrote: > Hi Eric, > > On 5/28/19 7:50 PM, Eric Auger wrote: >> intel_iommu_get_resv_regions() aims to return the list of >> reserved regions accessible by a given @device. However several >> devices can access the same reserved memory region and when >>

Re: [PATCH v5 3/7] iommu/vt-d: Introduce is_downstream_to_pci_bridge helper

2019-05-29 Thread Auger Eric
Hi Christoph, On 5/29/19 8:21 AM, Christoph Hellwig wrote: >> +/* is_downstream_to_pci_bridge - test if a device belongs to the >> + * PCI sub-hierarchy of a candidate PCI-PCI bridge >> + * >> + * @dev: candidate PCI device belonging to @bridge PCI sub-hierarchy >> + * @bridge: the candidate

Re: [PATCH v4 3/8] iommu/vt-d: Duplicate iommu_resv_region objects per device list

2019-05-28 Thread Auger Eric
Hi Joerg, On 5/27/19 5:23 PM, Joerg Roedel wrote: > On Mon, May 27, 2019 at 10:55:36AM +0200, Eric Auger wrote: >> -list_add_tail(>resv->list, head); >> +length = rmrr->end_address - rmrr->base_address + 1; >> +resv =

Re: [PATCH v8 23/29] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2019-06-14 Thread Auger Eric
Hi Liu, On 6/14/19 2:38 PM, Liu, Yi L wrote: > Hi Eric, > >> From: Eric Auger [mailto:eric.au...@redhat.com] >> Sent: Monday, May 27, 2019 12:10 AM >> Subject: [PATCH v8 23/29] vfio: VFIO_IOMMU_CACHE_INVALIDATE >> >> From: "Liu, Yi L" >> >> When the guest "owns" the stage 1 translation

Re: [PATCH] iommu/intel: remove an unused variable "length"

2019-06-17 Thread Auger Eric
Hi Qian, On 6/17/19 3:20 PM, Qian Cai wrote: > The linux-next commit "iommu/vt-d: Duplicate iommu_resv_region objects > per device list" [1] left out an unused variable, > > drivers/iommu/intel-iommu.c: In function 'dmar_parse_one_rmrr': > drivers/iommu/intel-iommu.c:4014:9: warning: variable

Re: [PATCH v8 0/7] Add virtio-iommu driver

2019-06-13 Thread Auger Eric
Hi, On 5/30/19 7:09 PM, Jean-Philippe Brucker wrote: > Implement the virtio-iommu driver, following specification v0.12 [1]. > Since last version [2] we've worked on improving the specification, > which resulted in the following changes to the interface: > * Remove the EXEC flag. > * Add feature

Re: [PATCH] iommu: Add padding to struct iommu_fault

2019-06-12 Thread Auger Eric
Hi Jean, On 6/12/19 7:59 PM, Jean-Philippe Brucker wrote: > Ease future extensions of struct iommu_fault_page_request and struct > iommu_fault_unrecoverable by adding a few bytes of padding. That way, a > new field can be added to either of these structures by simply introducing > a new flag. To

Re: [PATCH v4 08/22] iommu: Introduce attach/detach_pasid_table API

2019-06-24 Thread Auger Eric
Hi, On 6/18/19 5:41 PM, Jonathan Cameron wrote: > On Sun, 9 Jun 2019 06:44:08 -0700 > Jacob Pan wrote: > >> In virtualization use case, when a guest is assigned >> a PCI host device, protected by a virtual IOMMU on the guest, >> the physical IOMMU must be programmed to be consistent with >> the

Re: [PATCH v7 18/23] iommu/smmuv3: Report non recoverable faults

2019-05-13 Thread Auger Eric
Hi Robin, On 5/13/19 1:54 PM, Robin Murphy wrote: > On 13/05/2019 08:46, Auger Eric wrote: >> Hi Robin, >> >> On 5/8/19 7:20 PM, Robin Murphy wrote: >>> On 08/04/2019 13:19, Eric Auger wrote: >>>> When a stage 1 related fault event is read from the event q

Re: [PATCH v3 02/16] iommu: Introduce cache_invalidate API

2019-05-13 Thread Auger Eric
Hi Jacob, Jean-Philippe, On 5/4/19 12:32 AM, Jacob Pan wrote: > From: "Liu, Yi L" > > In any virtualization use case, when the first translation stage > is "owned" by the guest OS, the host IOMMU driver has no knowledge > of caching structure updates unless the guest invalidation activities >

Re: [PATCH v7 14/23] iommu/smmuv3: Implement cache_invalidate

2019-05-13 Thread Auger Eric
Hi Robin, On 5/8/19 5:01 PM, Robin Murphy wrote: > On 08/04/2019 13:19, Eric Auger wrote: >> Implement domain-selective and page-selective IOTLB invalidations. >> >> Signed-off-by: Eric Auger >> >> --- >> v6 -> v7 >> - check the uapi version >> >> v3 -> v4: >> - adapt to changes in the uapi >> -

Re: [PATCH v7 12/23] iommu/smmuv3: Get prepared for nested stage support

2019-05-13 Thread Auger Eric
Hi Robin, On 5/13/19 1:43 PM, Robin Murphy wrote: > On 10/05/2019 15:34, Auger Eric wrote: >> Hi Robin, >> >> On 5/8/19 4:24 PM, Robin Murphy wrote: >>> On 08/04/2019 13:19, Eric Auger wrote: >>>> To allow nested stage support, we need to store bo

Re: [PATCH v3 02/16] iommu: Introduce cache_invalidate API

2019-05-13 Thread Auger Eric
Hi Jean-Philippe, On 5/13/19 1:20 PM, Jean-Philippe Brucker wrote: > Hi Eric, > > On 13/05/2019 10:14, Auger Eric wrote: >> I noticed my qemu integration was currently incorrectly using PASID >> invalidation for ASID based invalidation (SMMUV3 Stage1 CMD_TLBI_NH_ASID >>

Re: [PATCH v7 14/23] iommu/smmuv3: Implement cache_invalidate

2019-05-13 Thread Auger Eric
Hi Robin, On 5/13/19 4:01 PM, Robin Murphy wrote: > On 13/05/2019 13:16, Auger Eric wrote: >> Hi Robin, >> On 5/8/19 5:01 PM, Robin Murphy wrote: >>> On 08/04/2019 13:19, Eric Auger wrote: >>>> Implement domain-selective and page-selective IOTLB invalidations.

Re: [PATCH 3/4] iommu/vt-d: Handle RMRR with PCI bridge device scopes

2019-05-13 Thread Auger Eric
Hi Jacob, On 5/13/19 6:41 PM, Jacob Pan wrote: > On Mon, 13 May 2019 09:13:01 +0200 > Eric Auger wrote: > >> When reading the vtd specification and especially the >> Reserved Memory Region Reporting Structure chapter, >> it is not obvious a device scope element cannot be a >> PCI-PCI bridge, in

Re: [PATCH v3 02/16] iommu: Introduce cache_invalidate API

2019-05-14 Thread Auger Eric
Hi Jacob, On 5/14/19 12:16 AM, Jacob Pan wrote: > On Mon, 13 May 2019 18:09:48 +0100 > Jean-Philippe Brucker wrote: > >> On 13/05/2019 17:50, Auger Eric wrote: >>>> struct iommu_inv_pasid_info { >>>> #define IOMMU_INV_PASID_FLAGS_PASID(1 <<

Re: [PATCH v3 02/16] iommu: Introduce cache_invalidate API

2019-05-14 Thread Auger Eric
Hi Jean, On 5/13/19 7:09 PM, Jean-Philippe Brucker wrote: > On 13/05/2019 17:50, Auger Eric wrote: >>> struct iommu_inv_pasid_info { >>> #define IOMMU_INV_PASID_FLAGS_PASID (1 << 0) >>> #define IOMMU_INV_PASID_FLAGS_ARCHID(1 << 1) >

Re: [PATCH v3 02/16] iommu: Introduce cache_invalidate API

2019-05-14 Thread Auger Eric
Hi Jean, On 5/14/19 12:42 PM, Jean-Philippe Brucker wrote: > On 14/05/2019 08:46, Auger Eric wrote: >> Hi Jean, >> >> On 5/13/19 7:09 PM, Jean-Philippe Brucker wrote: >>> On 13/05/2019 17:50, Auger Eric wrote: >>>>> struct iommu_inv_pasid_info { >&

Re: [PATCH v3 04/16] ioasid: Add custom IOASID allocator

2019-05-23 Thread Auger Eric
Hi Jacob, On 5/22/19 9:42 PM, Jacob Pan wrote: > On Tue, 21 May 2019 11:55:55 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 5/4/19 12:32 AM, Jacob Pan wrote: >>> Sometimes, IOASID allocation must be handled by platform specific >>> code. The

Re: [PATCH v3 6/7] iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions

2019-05-20 Thread Auger Eric
Hi Robin, On 5/16/19 7:53 PM, Robin Murphy wrote: > On 16/05/2019 14:23, Auger Eric wrote: >> Hi Robin, >> On 5/16/19 2:46 PM, Robin Murphy wrote: >>> On 16/05/2019 11:08, Eric Auger wrote: >>>> Introduce a new type for reserved region. This corresponds &

Re: [PATCH v7 12/23] iommu/smmuv3: Get prepared for nested stage support

2019-05-10 Thread Auger Eric
Hi Robin, On 5/8/19 4:24 PM, Robin Murphy wrote: > On 08/04/2019 13:19, Eric Auger wrote: >> To allow nested stage support, we need to store both >> stage 1 and stage 2 configurations (and remove the former >> union). >> >> A nested setup is characterized by both s1_cfg and s2_cfg >> set. >> >>

Re: [PATCH v7 13/23] iommu/smmuv3: Implement attach/detach_pasid_table

2019-05-10 Thread Auger Eric
Hi Robin, On 5/8/19 4:38 PM, Robin Murphy wrote: > On 08/04/2019 13:19, Eric Auger wrote: >> On attach_pasid_table() we program STE S1 related info set >> by the guest into the actual physical STEs. At minimum >> we need to program the context descriptor GPA and compute >> whether the stage1 is

Re: [PATCH v7 06/23] iommu: Introduce bind/unbind_guest_msi

2019-05-10 Thread Auger Eric
Hi Robin, On 5/8/19 3:59 PM, Robin Murphy wrote: > On 08/04/2019 13:18, Eric Auger wrote: >> On ARM, MSI are translated by the SMMU. An IOVA is allocated >> for each MSI doorbell. If both the host and the guest are exposed >> with SMMUs, we end up with 2 different IOVAs allocated by each. >> guest

Re: [PATCH v3 03/16] iommu: Add I/O ASID allocator

2019-05-21 Thread Auger Eric
Hi, On 5/4/19 12:32 AM, Jacob Pan wrote: > From: Jean-Philippe Brucker > > Some devices might support multiple DMA address spaces, in particular > those that have the PCI PASID feature. PASID (Process Address Space ID) > allows to share process address spaces with devices (SVA), partition a >

Re: [PATCH v3 04/16] ioasid: Add custom IOASID allocator

2019-05-21 Thread Auger Eric
Hi Jacob, On 5/4/19 12:32 AM, Jacob Pan wrote: > Sometimes, IOASID allocation must be handled by platform specific > code. The use cases are guest vIOMMU and pvIOMMU where IOASIDs need > to be allocated by the host via enlightened or paravirt interfaces. > > This patch adds an extension to the

Re: [PATCH v3 6/7] iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions

2019-05-16 Thread Auger Eric
Hi Robin, On 5/16/19 2:46 PM, Robin Murphy wrote: > On 16/05/2019 11:08, Eric Auger wrote: >> Introduce a new type for reserved region. This corresponds >> to directly mapped regions which are known to be relaxable >> in some specific conditions, such as device assignment use >> case. Well known

Re: [PATCH v3 6/7] iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions

2019-05-16 Thread Auger Eric
Hi Jean-Philippe, On 5/16/19 2:43 PM, Jean-Philippe Brucker wrote: > On 16/05/2019 12:45, Auger Eric wrote: >> Hi Jean-Philippe, >> >> On 5/16/19 1:16 PM, Jean-Philippe Brucker wrote: >>> On 16/05/2019 11:08, Eric Auger wrote: >>>> Note: At the mome

Re: [PATCH v3 6/7] iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions

2019-05-16 Thread Auger Eric
Hi Jean-Philippe, On 5/16/19 1:16 PM, Jean-Philippe Brucker wrote: > On 16/05/2019 11:08, Eric Auger wrote: >> Note: At the moment the sysfs ABI is not changed. However I wonder >> whether it wouldn't be preferable to report the direct region as >> "direct_relaxed" there. At the moment, in case

Re: [PATCH v2 6/7] iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions

2019-05-16 Thread Auger Eric
Hi On 5/16/19 10:47 AM, Eric Auger wrote: > Introduce a new type for reserved region. This corresponds > to directly mapped regions which are known to be relaxable > in some specific conditions, such as device assignment use > case. Well known examples are those used by USB controllers >

Re: [PATCH v7 04/23] iommu: Introduce attach/detach_pasid_table API

2019-05-15 Thread Auger Eric
Hi Jean-Philippe, On 5/15/19 2:09 PM, Jean-Philippe Brucker wrote: > On 08/04/2019 13:18, Eric Auger wrote: >> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h >> index edcc0dda7993..532a64075f23 100644 >> --- a/include/uapi/linux/iommu.h >> +++ b/include/uapi/linux/iommu.h >>

Re: [PATCH v2 19/19] iommu/vt-d: Add svm/sva invalidate function

2019-04-30 Thread Auger Eric
Hi Jacob, On 4/30/19 7:22 PM, Jacob Pan wrote: > On Tue, 30 Apr 2019 08:57:30 +0200 > Auger Eric wrote: > >> On 4/30/19 12:41 AM, Jacob Pan wrote: >>> On Fri, 26 Apr 2019 19:23:03 +0200 >>> Auger Eric wrote: >>> >>>> Hi Jacob, >>

Re: [PATCH v2 18/19] iommu/vt-d: Support flushing more translation cache types

2019-04-30 Thread Auger Eric
Hi Jacob, On 4/30/19 7:15 PM, Jacob Pan wrote: > On Tue, 30 Apr 2019 06:41:13 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 4/29/19 11:29 PM, Jacob Pan wrote: >>> On Sat, 27 Apr 2019 11:04:04 +0200 >>> Auger Eric wrote: >>> >&g

Re: [PATCH] iommu/vt-d: Fix intel_pasid_max_id

2019-04-30 Thread Auger Eric
Hi Jacob, On 4/30/19 8:01 PM, Jacob Pan wrote: > On Tue, 30 Apr 2019 09:29:40 +0200 > Eric Auger wrote: > >> Extended Capability Register PSS field (PASID Size Supported) >> corresponds to the PASID bit size -1. >> >> "A value of N in this field indicates hardware supports PASID >> field of N+1

Re: [PATCH v7 05/23] iommu: Introduce cache_invalidate API

2019-05-02 Thread Auger Eric
Hi Jean-Philippe, On 5/1/19 12:38 PM, Jean-Philippe Brucker wrote: > On 08/04/2019 13:18, Eric Auger wrote: >> +int iommu_cache_invalidate(struct iommu_domain *domain, struct device *dev, >> + struct iommu_cache_invalidate_info *inv_info) >> +{ >> +int ret = 0; >> + >> +

Re: [PATCH v2 18/19] iommu/vt-d: Support flushing more translation cache types

2019-04-27 Thread Auger Eric
Hi Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > When Shared Virtual Memory is exposed to a guest via vIOMMU, extended > IOTLB invalidation may be passed down from outside IOMMU subsystems. > This patch adds invalidation functions that can be used for additional > translation cache types. > >

Re: [PATCH v2 14/19] iommu: Add guest PASID bind function

2019-04-27 Thread Auger Eric
Hi Jacob, On 4/27/19 12:11 AM, Jacob Pan wrote: > On Fri, 26 Apr 2019 17:53:43 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 4/24/19 1:31 AM, Jacob Pan wrote: >>> Guest shared virtual address (SVA) may require host to shadow guest >>> PASID t

Re: [PATCH v2 11/19] iommu/vt-d: Replace Intel specific PASID allocator with IOASID

2019-04-27 Thread Auger Eric
On 4/26/19 11:01 PM, Jacob Pan wrote: > On Thu, 25 Apr 2019 12:04:01 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 4/24/19 1:31 AM, Jacob Pan wrote: >>> Make use of generic IOASID code to manage PASID allocation, >>> free, and lookup. >>&

Re: [PATCH v2 18/19] iommu/vt-d: Support flushing more translation cache types

2019-04-29 Thread Auger Eric
Hi Jacob, On 4/29/19 11:29 PM, Jacob Pan wrote: > On Sat, 27 Apr 2019 11:04:04 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 4/24/19 1:31 AM, Jacob Pan wrote: >>> When Shared Virtual Memory is exposed to a guest via vIOMMU, >>> extended IOTLB

Re: [PATCH v2 17/19] iommu: Add max num of cache and granu types

2019-04-29 Thread Auger Eric
Hi Jacob, On 4/29/19 6:17 PM, Jacob Pan wrote: > On Fri, 26 Apr 2019 18:22:46 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 4/24/19 1:31 AM, Jacob Pan wrote: >>> To convert to/from cache types and granularities between generic and >>> VT

Re: [PATCH v4 3/3] PCI: iproc: Add sorted dma ranges resource entries to host bridge

2019-04-30 Thread Auger Eric
Hi Srinath, On 4/12/19 5:13 AM, Srinath Mannam wrote: > IPROC host has the limitation that it can use only those address ranges > given by dma-ranges property as inbound address. So that the memory > address holes in dma-ranges should be reserved to allocate as DMA address. > > Inbound address

Re: [PATCH v2 15/19] iommu/vt-d: Add bind guest PASID support

2019-04-30 Thread Auger Eric
On 4/29/19 5:25 PM, Jacob Pan wrote: > On Fri, 26 Apr 2019 18:15:27 +0200 > Auger Eric wrote: > >> Hi Jacob, >> >> On 4/24/19 1:31 AM, Jacob Pan wrote: >>> When supporting guest SVA with emulated IOMMU, the guest PASID >>> table is shadowe

Re: [PATCH v7 00/23] SMMUv3 Nested Stage Setup

2019-04-30 Thread Auger Eric
Hi Robin, On 4/8/19 2:18 PM, Eric Auger wrote: > This series allows a virtualizer to program the nested stage mode. > This is useful when both the host and the guest are exposed with > an SMMUv3 and a PCI device is assigned to the guest using VFIO. > > In this mode, the physical IOMMU must be

Re: [PATCH v2 19/19] iommu/vt-d: Add svm/sva invalidate function

2019-04-30 Thread Auger Eric
On 4/30/19 12:41 AM, Jacob Pan wrote: > On Fri, 26 Apr 2019 19:23:03 +0200 > Auger Eric wrote: > >> Hi Jacob, >> On 4/24/19 1:31 AM, Jacob Pan wrote: >>> When Shared Virtual Address (SVA) is enabled for a guest OS via >>> vIOMMU, we need to pr

Re: [PATCH v2 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg()

2019-04-30 Thread Auger Eric
Hi Julien, On 4/29/19 4:44 PM, Julien Grall wrote: > its_irq_compose_msi_msg() may be called from non-preemptible context. > However, on RT, iommu_dma_map_msi_msg requires to be called from a > preemptible context. > > A recent change split iommu_dma_map_msi_msg() in two new functions: > one

Re: [PATCH v2 2/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts

2019-04-30 Thread Auger Eric
Hu Julien, On 4/29/19 4:44 PM, Julien Grall wrote: > On RT, iommu_dma_map_msi_msg() may be called from non-preemptible > context. This will lead to a splat with CONFIG_DEBUG_ATOMIC_SLEEP as > the function is using spin_lock (they can sleep on RT). > > iommu_dma_map_msi_msg() is used to map the

Re: [PATCH v2 3/7] irqchip/gicv2m: Don't map the MSI page in gicv2m_compose_msi_msg()

2019-04-30 Thread Auger Eric
Hi Julien, On 4/29/19 4:44 PM, Julien Grall wrote: > gicv2m_compose_msi_msg() may be called from non-preemptible context. > However, on RT, iommu_dma_map_msi_msg() requires to be called from a > preemptible context. > > A recent change split iommu_dma_map_msi_msg() in two new functions: > one

Re: [PATCH v2 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie

2019-04-30 Thread Auger Eric
Hi On 4/29/19 4:44 PM, Julien Grall wrote: > When an MSI doorbell is located downstream of an IOMMU, it is required > to swizzle the physical address with an appropriately-mapped IOVA for any > device attached to one of our DMA ops domain. > > At the moment, the allocation of the mapping may be

Re: [PATCH v2 7/7] iommu/dma-iommu: Remove iommu_dma_map_msi_msg()

2019-04-30 Thread Auger Eric
Hi Julien, On 4/29/19 4:44 PM, Julien Grall wrote: > A recent change split iommu_dma_map_msi_msg() in two new functions. The > function was still implemented to avoid modifying all the callers at > once. > > Now that all the callers have been reworked, iommu_dma_map_msi_msg() can > be removed. >

Re: [PATCH v2 19/19] iommu/vt-d: Add svm/sva invalidate function

2019-04-26 Thread Auger Eric
Hi Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > When Shared Virtual Address (SVA) is enabled for a guest OS via > vIOMMU, we need to provide invalidation support at IOMMU API and driver > level. This patch adds Intel VT-d specific function to implement > iommu passdown invalidate API for shared

Re: [PATCH v7 2/6] vfio/type1: Check reserve region conflict and update iova list

2019-07-05 Thread Auger Eric
Hi Shameer, On 7/4/19 2:51 PM, Shameerali Kolothum Thodi wrote: > > >> -Original Message- >> From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On >> Behalf Of Alex Williamson >> Sent: 03 July 2019 21:34 >> To: Shameerali Kolothum Thodi >> Cc: eric.au...@redhat.com;

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-07-11 Thread Auger Eric
Hi Jean, Jacob, On 6/18/19 4:04 PM, Jean-Philippe Brucker wrote: > On 12/06/2019 19:53, Jacob Pan wrote: You are right, the worst case of the spurious PS is to terminate the group prematurely. Need to know the scope of the HW damage in case of mdev where group IDs can be shared

Re: [PATCH v7 2/6] vfio/type1: Check reserve region conflict and update iova list

2019-07-07 Thread Auger Eric
Hi Shameer, On 6/26/19 5:12 PM, Shameer Kolothum wrote: > This retrieves the reserved regions associated with dev group and > checks for conflicts with any existing dma mappings. Also update > the iova list excluding the reserved regions. s/reserve/reserved in the commit title > > Reserved

Re: [PATCH v7 1/6] vfio/type1: Introduce iova list and add iommu aperture validity check

2019-07-07 Thread Auger Eric
Hi Shameer, On 6/26/19 5:12 PM, Shameer Kolothum wrote: > This introduces an iova list that is valid for dma mappings. Make > sure the new iommu aperture window doesn't conflict with the current > one or with any existing dma mappings during attach. > > Signed-off-by: Shameer Kolothum > --- >

Re: [PATCH v7 4/6] vfio/type1: check dma map request is within a valid iova range

2019-07-07 Thread Auger Eric
Hi Shameer, On 6/26/19 5:12 PM, Shameer Kolothum wrote: > This checks and rejects any dma map request outside valid iova > range. > > Signed-off-by: Shameer Kolothum > --- > v6 --> v7 > > Addressed the case where a container with only an mdev device will > have an empty list(Suggested by

Re: [PATCH v7 6/6] vfio/type1: remove duplicate retrieval of reserved regions

2019-07-07 Thread Auger Eric
Hi Shameer, On 6/26/19 5:12 PM, Shameer Kolothum wrote: > As we now already have the reserved regions list, just pass that into > vfio_iommu_has_sw_msi() fn. > > Signed-off-by: Shameer Kolothum Reviewed-by: Eric Auger Thanks Eric > --- > drivers/vfio/vfio_iommu_type1.c | 15 ++- >

Re: [PATCH v7 3/6] vfio/type1: Update iova list on detach

2019-07-07 Thread Auger Eric
Hi Shameer, On 6/26/19 5:12 PM, Shameer Kolothum wrote: > Get a copy of iova list on _group_detach and try to update the list. > On success replace the current one with the copy. Leave the list as > it is if update fails. > > Signed-off-by: Shameer Kolothum > --- >

Re: [PATCH v7 5/6] vfio/type1: Add IOVA range capability support

2019-07-07 Thread Auger Eric
Hi Shameer, On 6/26/19 5:12 PM, Shameer Kolothum wrote: > This allows the user-space to retrieve the supported IOVA > range(s), excluding any reserved regions. The implementation non relaxable reserved regions > is based on capability chains, added to VFIO_IOMMU_GET_INFO ioctl. > >

Re: [PATCH 7/8] iommu/arm-smmu-v3: Improve add_device() error handling

2019-07-08 Thread Auger Eric
Hi Jean, On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > Let add_device() clean up behind itself. The iommu_bus_init() function > does call remove_device() on error, but other sites (e.g. of_iommu) do > not. > > Don't free level-2 stream tables because we'd have to track if we > allocated

Re: [PATCH 3/8] iommu/arm-smmu-v3: Support platform SSID

2019-07-08 Thread Auger Eric
Hi Jean, On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > For platform devices that support SubstreamID (SSID), firmware provides > the number of supported SSID bits. Restrict it to what the SMMU supports > and cache it into master->ssid_bits. The commit message may give the impression the

Re: [PATCH 8/8] iommu/arm-smmu-v3: Add support for PCI PASID

2019-07-08 Thread Auger Eric
Hi Jean, On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > Enable PASID for PCI devices that support it. Since the SSID tables are > allocated by arm_smmu_attach_dev(), PASID has to be enabled early enough. > arm_smmu_dev_feature_enable() would be too late, since by that time the > main DMA

Re: [PATCH 2/8] dt-bindings: document PASID property for IOMMU masters

2019-07-08 Thread Auger Eric
Hi Jean, On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > On Arm systems, some platform devices behind an SMMU may support the PASID > feature, which offers multiple address space. Let the firmware tell us > when a device supports PASID. > > Reviewed-by: Rob Herring > Signed-off-by:

Re: [PATCH 4/8] iommu/arm-smmu-v3: Add support for Substream IDs

2019-07-08 Thread Auger Eric
Hi Jean, On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > At the moment, the SMMUv3 driver implements only one stage-1 or stage-2 > page directory per device. However SMMUv3 allows more than one address > space for some devices, by providing multiple stage-1 page directories. In > addition to

Re: [PATCH 5/8] iommu/arm-smmu-v3: Add second level of context descriptor table

2019-07-08 Thread Auger Eric
Hi Jean, On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > The SMMU can support up to 20 bits of SSID. Add a second level of page > tables to accommodate this. Devices that support more than 1024 SSIDs now > have a table of 1024 L1 entries (8kB), pointing to tables of 1024 context > descriptors

Re: [PATCH v2 09/19] iommu/vt-d: Enlightened PASID allocation

2019-04-24 Thread Auger Eric
Hi Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > From: Lu Baolu > > If Intel IOMMU runs in caching mode, a.k.a. virtual IOMMU, the > IOMMU driver should rely on the emulation software to allocate > and free PASID IDs. Do we make the decision depending on the CM or depending on the VCCAP_REG?

Re: [PATCH v2 10/19] iommu/vt-d: Add custom allocator for IOASID

2019-04-24 Thread Auger Eric
Hi Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > When VT-d driver runs in the guest, PASID allocation must be > performed via virtual command interface. This patch register a registers > custom IOASID allocator which takes precedence over the default > IDR based allocator. nit: s/IDR based// . It

Re: [PATCH v2 12/19] iommu/vt-d: Move domain helper to header

2019-04-24 Thread Auger Eric
Hi Jacob On 4/24/19 1:31 AM, Jacob Pan wrote: > Move domainer helper to header to be used by SVA code. s/domainer/domain > > Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Eric > --- > drivers/iommu/intel-iommu.c | 6 -- > include/linux/intel-iommu.h | 6 ++ >

Re: [PATCH v6 09/22] vfio: VFIO_IOMMU_BIND/UNBIND_MSI

2019-04-10 Thread Auger Eric
Hi Vincent, On 4/10/19 2:35 PM, Vincent Stehlé wrote: > On Thu, Apr 04, 2019 at 08:55:25AM +0200, Auger Eric wrote: >> Hi Marc, Robin, Alex, > (..) >> Do you think this is a reasonable assumption to consider devices within >> the same host iommu group share the same MS

Re: [PATCH v2 11/19] iommu/vt-d: Replace Intel specific PASID allocator with IOASID

2019-04-25 Thread Auger Eric
Hi Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > Make use of generic IOASID code to manage PASID allocation, > free, and lookup. > > Signed-off-by: Jacob Pan > --- > drivers/iommu/Kconfig | 1 + > drivers/iommu/intel-iommu.c | 9 - > drivers/iommu/intel-pasid.c | 36

Re: [PATCH v2 08/19] ioasid: Add custom IOASID allocator

2019-04-25 Thread Auger Eric
Hi Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > Sometimes, IOASID allocation must be handled by platform specific > code. The use cases are guest vIOMMU and pvIOMMU where IOASIDs need > to be allocated by the host via enlightened or paravirt interfaces. > > This patch adds an extension to the

Re: [PATCH v2 09/19] iommu/vt-d: Enlightened PASID allocation

2019-04-25 Thread Auger Eric
Hi Liu, On 4/25/19 9:12 AM, Liu, Yi L wrote: > Hi Eric, > >> From: Auger Eric [mailto:eric.au...@redhat.com] >> Sent: Thursday, April 25, 2019 1:28 AM >> To: Jacob Pan ; >> iommu@lists.linux-foundation.org; >> Subject: Re: [PATCH v2 09/19] iommu/vt-d: Enlight

Re: [PATCH v2 06/19] drivers core: Add I/O ASID allocator

2019-04-25 Thread Auger Eric
Hi Jean-Philippe, Jacob, On 4/24/19 1:31 AM, Jacob Pan wrote: > From: Jean-Philippe Brucker > > Some devices might support multiple DMA address spaces, in particular > those that have the PCI PASID feature. PASID (Process Address Space ID) > allows to share process address spaces with devices

<    1   2   3   4   5   6   7   >