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

2019-09-19 Thread Jean-Philippe Brucker
Hi Eric, Sorry for the delay. I'll see if I can resend this for v5.5, although I can't do much testing at the moment. On Mon, Jul 08, 2019 at 09:58:22AM +0200, Auger Eric wrote: > Hi Jean, > > On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > > For platform devices that supp

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-09-16 Thread Jean-Philippe Brucker
Hi, On 13/09/2019 09:13, Guo Ren wrote: > Another idea is seperate remote TLB invalidate into two instructions: > >  - sfence.vma.b.asyc >  - sfence.vma.b.barrier // wait all async TLB invalidate operations > finished for all harts. It's not clear to me how this helps, but I probably don't have

[PATCH] iommu/virtio: Update to most recent specification

2019-07-22 Thread Jean-Philippe Brucker
://lore.kernel.org/linux-iommu/20190530170929.19366-1-jean-philippe.bruc...@arm.com/ Fixes: edcd69ab9a32 ("iommu: Add virtio-iommu driver") Reported-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 40 ++- include/

[PATCH] MAINTAINERS: Update my email address

2019-07-22 Thread Jean-Philippe Brucker
Update MAINTAINERS and .mailmap with my @linaro.org address, since I don't have access to my @arm.com address anymore. Signed-off-by: Jean-Philippe Brucker --- .mailmap| 1 + MAINTAINERS | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index

Re: [PATCH 6/8] iommu/arm-smmu-v3: Support auxiliary domains

2019-07-05 Thread Jean-Philippe Brucker
On 26/06/2019 18:59, Will Deacon wrote: >> +static void arm_smmu_aux_detach_dev(struct iommu_domain *domain, struct >> device *dev) >> +{ >> +struct iommu_domain *parent_domain; >> +struct arm_smmu_domain *parent_smmu_domain; >> +struct arm_smmu_master *master = dev_to_master(dev); >>

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

2019-07-04 Thread Jean-Philippe Brucker
On 26/06/2019 19:00, Will Deacon wrote: > On Mon, Jun 10, 2019 at 07:47:10PM +0100, 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 >> s

[PATCH] iommu/arm-smmu-v3: Invalidate ATC when detaching a device

2019-07-03 Thread Jean-Philippe Brucker
anoj Kumar Reported-by: Robin Murphy Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4d5a694f02c2..0fee8f7957ec 100644 --- a/drivers/iommu/arm

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

2019-07-02 Thread Jean-Philippe Brucker
On 01/07/2019 18:41, Robin Murphy wrote: > Hi Jean-Philippe, > > I realise it's a bit late for a "review", but digging up the original > patch seemed as good a place as any to raise this... > > On 17/04/2019 19:24, Jean-Philippe Brucker wrote: > [...] >&

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

2019-06-24 Thread Jean-Philippe Brucker
On 24/06/2019 16:06, Auger Eric wrote: > 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

Re: [PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-19 Thread Jean-Philippe Brucker
On 18/06/2019 18:05, Jacob Pan wrote: > On Tue, 18 Jun 2019 15:22:20 +0100 > Jean-Philippe Brucker wrote: > >> On 11/06/2019 19:13, Jacob Pan wrote: >>>>>> +/** >>>>>> + * ioasid_find - Find IOASID data >>>>>> + * @set: the

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

2019-06-19 Thread Jean-Philippe Brucker
On 18/06/2019 19:08, Will Deacon wrote: >> +/* >> + * If the SMMU doesn't support 2-stage CD, limit the linear >> + * tables to a reasonable number of contexts, let's say >> + * 64kB / sizeof(ctx_desc) = 1024 = 2^10 >> + */ >> +if (!(smmu->features &

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

2019-06-19 Thread Jean-Philippe Brucker
On 19/06/2019 01:19, Jacob Pan wrote: >>> I see this as a future extension due to limited testing, >> >> I'm wondering how we deal with: >> (1) old userspace that won't fill the new private_data field in >> page_response. A new kernel still has to support it. >> (2) old kernel that won't

Re: [PATCH v4 11/22] iommu: Introduce guest PASID bind function

2019-06-18 Thread Jean-Philippe Brucker
On 09/06/2019 14:44, Jacob Pan wrote: > Guest shared virtual address (SVA) may require host to shadow guest > PASID tables. Guest PASID can also be allocated from the host via > enlightened interfaces. In this case, guest needs to bind the guest > mm, i.e. cr3 in guest physical address to the

Re: [PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-18 Thread Jean-Philippe Brucker
On 11/06/2019 19:13, Jacob Pan wrote: +/** + * ioasid_find - Find IOASID data + * @set: the IOASID set + * @ioasid: the IOASID to find + * @getter: function to call on the found object + * + * The optional getter function allows to take a reference to the

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

2019-06-18 Thread Jean-Philippe Brucker
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 among mdevs belong to the >>> same PF. >> >> But from the IOMMU fault

[PATCH] iommu: Add padding to struct iommu_fault

2019-06-12 Thread Jean-Philippe Brucker
respectively. Signed-off-by: Jean-Philippe Brucker --- include/uapi/linux/iommu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h index f45d8e9e59c3..fc00c5d4741b 100644 --- a/include/uapi/linux/iommu.h +++ b/include/uapi/linux/iommu.h

Re: [PATCH v2 0/4] iommu: Add device fault reporting API

2019-06-12 Thread Jean-Philippe Brucker
On 12/06/2019 09:19, Joerg Roedel wrote: > On Mon, Jun 03, 2019 at 03:57:45PM +0100, Jean-Philippe Brucker wrote: >> Jacob Pan (3): >> driver core: Add per device iommu param >> iommu: Introduce device fault data >> iommu: Introduce device fault report API >

Re: [PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-12 Thread Jean-Philippe Brucker
On 11/06/2019 18:10, Jacob Pan wrote: >> The issue is theoretical at the moment because no users do this, but >> I'd be more comfortable taking the xa_lock, which prevents a >> concurrent xa_erase()+free(). (I commented on your v3 but you might >> have missed it) >> > Did you reply to my v3? I did

Re: [PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-11 Thread Jean-Philippe Brucker
On 11/06/2019 13:26, Jacob Pan wrote: >> +/** >> + * ioasid_set_data - Set private data for an allocated ioasid >> + * @ioasid: the ID to set data >> + * @data: the private data >> + * >> + * For IOASID that is already allocated, private data can be set >> + * via this API. Future lookup can be

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

2019-06-11 Thread Jean-Philippe Brucker
On 11/06/2019 11:45, Jonathan Cameron wrote: >> +pci_disable_pasid(pdev); >> +master->ssid_bits = 0; > > If we are being really fussy about ordering, why have this set of > ssid_bits after pci_disable_pasid rather than before (to reverse order > of .._enable_pasid)? Sure, I'll change

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

2019-06-11 Thread Jean-Philippe Brucker
On 11/06/2019 11:19, Jonathan Cameron wrote: >> +static int arm_smmu_alloc_cd_tables(struct arm_smmu_domain *smmu_domain, >> +struct arm_smmu_master *master) >> +{ >> +struct arm_smmu_device *smmu = smmu_domain->smmu; >> +struct arm_smmu_s1_cfg *cfg =

Re: [PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-11 Thread Jean-Philippe Brucker
On 11/06/2019 10:36, Jonathan Cameron wrote: >> +/** >> + * ioasid_alloc - Allocate an IOASID >> + * @set: the IOASID set >> + * @min: the minimum ID (inclusive) >> + * @max: the maximum ID (inclusive) >> + * @private: data private to the caller >> + * >> + * Allocate an ID between @min and @max.

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

2019-06-11 Thread Jean-Philippe Brucker
On 11/06/2019 10:42, Jonathan Cameron wrote: >> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >> index 519e40fb23ce..b91df613385f 100644 >> --- a/include/linux/iommu.h >> +++ b/include/linux/iommu.h >> @@ -536,6 +536,7 @@ struct iommu_fwspec { >> struct fwnode_handle

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

2019-06-11 Thread Jean-Philippe Brucker
On 10/06/2019 22:31, Jacob Pan wrote: > On Mon, 10 Jun 2019 13:45:02 +0100 > Jean-Philippe Brucker wrote: > >> On 07/06/2019 18:43, Jacob Pan wrote: >>>>> So it seems we agree on the following: >>>>> - iommu_unregister_device_fault_handler() will

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

2019-06-10 Thread Jean-Philippe Brucker
the hassle since they are managed resources. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 633d829f246f..972bfb80f964

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

2019-06-10 Thread Jean-Philippe Brucker
. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 51 - 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 972bfb80f964..a8a516d9ff10 100644 --- a/drivers/iommu/arm-smmu

[PATCH 6/8] iommu/arm-smmu-v3: Support auxiliary domains

2019-06-10 Thread Jean-Philippe Brucker
container, it simply falls back to allocating two separate IOMMU domains. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig | 1 + drivers/iommu/arm-smmu-v3.c | 276 +--- 2 files changed, 260 insertions(+), 17 deletions(-) diff --git a/dri

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

2019-06-10 Thread Jean-Philippe Brucker
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. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 11 +++ drivers/iommu/of_iomm

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

2019-06-10 Thread Jean-Philippe Brucker
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: Jean-Philippe Brucker --- Previous discussion on this patch last year: https

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

2019-06-10 Thread Jean-Philippe Brucker
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 (64kB), allocated on demand. Signed-off-by: Jean-Philippe Brucker

[PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-10 Thread Jean-Philippe Brucker
as IOMMU. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Jacob Pan --- The most recent discussion on this patch was at: https://lkml.kernel.org/lkml/1556922737-76313-4-git-send-email-jacob.jun@linux.intel.com/ I fixed it up a bit following comments in that series, and removed the definitions

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

2019-06-10 Thread Jean-Philippe Brucker
support SSID when user selects iommu.passthrough. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 238 +--- 1 file changed, 192 insertions(+), 46 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c

[PATCH 0/8] iommu: Add auxiliary domain and PASID support to Arm SMMUv3

2019-06-10 Thread Jean-Philippe Brucker
https://lkml.kernel.org/lkml/1556922737-76313-4-git-send-email-jacob.jun@linux.intel.com/ Jean-Philippe Brucker (8): iommu: Add I/O ASID allocator dt-bindings: document PASID property for IOMMU masters iommu/arm-smmu-v3: Support platform SSID iommu/arm-smmu-v3: Add support for Substream ID

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

2019-06-10 Thread Jean-Philippe Brucker
On 07/06/2019 18:43, Jacob Pan wrote: >>> So it seems we agree on the following: >>> - iommu_unregister_device_fault_handler() will never fail >>> - iommu driver cleans up all pending faults when handler is >>> unregistered >>> - assume device driver or guest not sending more page response >>>

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

2019-06-07 Thread Jean-Philippe Brucker
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 vfio_region_fault_prod *prod_region = > + (struct

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

2019-06-07 Thread Jean-Philippe Brucker
On 07/06/2019 09:28, Auger Eric wrote: >>> +static const struct vfio_pci_fault_abi fault_abi_versions[] = { >>> + [0] = { >>> + .entry_size = sizeof(struct iommu_fault), >>> + }, >>> +}; >>> + >>> +#define NR_FAULT_ABIS ARRAY_SIZE(fault_abi_versions) >> >> This looks like it's

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

2019-06-07 Thread Jean-Philippe Brucker
On 06/06/2019 21:29, Jacob Pan wrote: >> iommu_unregister_device_fault_handler(>pdev->dev); > > > But this can fail if there are pending faults which leaves a > device reference and then the system is broken :( This series only features unrecoverable errors and for

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

2019-06-06 Thread Jean-Philippe Brucker
On 05/06/2019 23:45, Jacob Pan wrote: > On Tue, 4 Jun 2019 18:11:08 +0200 > Auger Eric wrote: > >> 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

Re: [PATCH v2 0/4] iommu: Add device fault reporting API

2019-06-05 Thread Jean-Philippe Brucker
On 03/06/2019 22:59, Jacob Pan wrote: > On Mon, 3 Jun 2019 15:57:45 +0100 > Jean-Philippe Brucker wrote: > >> Allow device drivers and VFIO to get notified on IOMMU translation >> fault, and handle recoverable faults (PCI PRI). Several series require >> this API

Re: [PATCH v2 2/4] iommu: Introduce device fault data

2019-06-05 Thread Jean-Philippe Brucker
On 05/06/2019 09:51, Tian, Kevin wrote: >> From: Jacob Pan >> Sent: Tuesday, June 4, 2019 6:09 AM >> >> On Mon, 3 Jun 2019 15:57:47 +0100 >> Jean-Philippe Brucker wrote: >> >>> +/** >>> + * struct iommu_fault_page_request - Page Request

Re: [PATCH v8 05/29] iommu: Add a timeout parameter for PRQ response

2019-06-04 Thread Jean-Philippe Brucker
On 03/06/2019 23:32, Alex Williamson wrote: > It doesn't seem to make much sense to include this patch without also > including "iommu: handle page response timeout". Was that one lost? > Dropped? Lives elsewhere? The first 7 patches come from my sva/api branch, where I had forgotten to add the

[PATCH v2 1/4] driver core: Add per device iommu param

2019-06-03 Thread Jean-Philippe Brucker
From: Jacob Pan DMA faults can be detected by IOMMU at device level. Adding a pointer to struct device allows IOMMU subsystem to report relevant faults back to the device driver for further handling. For direct assigned device (or user space drivers), guest OS holds responsibility to handle and

[PATCH v2 3/4] iommu: Introduce device fault report API

2019-06-03 Thread Jean-Philippe Brucker
led faults will come later. Signed-off-by: Jacob Pan Signed-off-by: Ashok Raj Signed-off-by: Jean-Philippe Brucker Signed-off-by: Eric Auger --- drivers/iommu/iommu.c | 146 +- include/linux/iommu.h | 29 + 2 files changed, 172 insertions(+), 3

[PATCH v2 4/4] iommu: Add recoverable fault reporting

2019-06-03 Thread Jean-Philippe Brucker
the validity of this field. * Introduce a new iommu_page_response_X structure with a different version number. The kernel must then support both versions. Signed-off-by: Jacob Pan Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/iommu.c | 94

[PATCH v2 2/4] iommu: Introduce device fault data

2019-06-03 Thread Jean-Philippe Brucker
care about non internal faults that are likely to be reported to an external subsystem. Signed-off-by: Jacob Pan Signed-off-by: Jean-Philippe Brucker Signed-off-by: Liu, Yi L Signed-off-by: Ashok Raj Signed-off-by: Eric Auger --- include/linux/iommu.h | 39 include/uapi/linux

[PATCH v2 0/4] iommu: Add device fault reporting API

2019-06-03 Thread Jean-Philippe Brucker
device fault data iommu: Introduce device fault report API Jean-Philippe Brucker (1): iommu: Add recoverable fault reporting drivers/iommu/iommu.c | 236 - include/linux/device.h | 3 + include/linux/iommu.h | 87 ++ include/uapi

Re: [PATCH 3/4] iommu: Introduce device fault report API

2019-05-31 Thread Jean-Philippe Brucker
On 23/05/2019 19:56, Robin Murphy wrote: > On 23/05/2019 19:06, Jean-Philippe Brucker wrote: >> From: Jacob Pan >> >> Traditionally, device specific faults are detected and handled within >> their own device drivers. When IOMMU is enabled, faults such as DMA >>

Re: [virtio-dev] Re: [PATCH v8 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2019-05-31 Thread Jean-Philippe Brucker
On 30/05/2019 18:45, Michael S. Tsirkin wrote: > On Thu, May 30, 2019 at 06:09:24PM +0100, Jean-Philippe Brucker wrote: >> Some systems implement virtio-iommu as a PCI endpoint. The operating >> system needs to discover the relationship between IOMMU and masters long >> be

Re: [PATCH 4/4] iommu: Add recoverable fault reporting

2019-05-31 Thread Jean-Philippe Brucker
On 24/05/2019 19:14, Jacob Pan wrote: > On Thu, 23 May 2019 19:06:13 +0100 >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index d546f7baa0d4..b09b3707f0e4 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -872,7 +872,14 @@ >>

[PATCH v8 7/7] iommu/virtio: Add event queue

2019-05-30 Thread Jean-Philippe Brucker
-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 115 +++--- include/uapi/linux/virtio_iommu.h | 19 + 2 files changed, 125 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 5d4947c47420

[PATCH v8 6/7] iommu/virtio: Add probe request

2019-05-30 Thread Jean-Philippe Brucker
in the virtio-iommu, because MSIs bypass it. Acked-by: Joerg Roedel Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 157 -- include/uapi/linux/virtio_iommu.h | 36 +++ 2 files changed, 187 insertions(+), 6 deletions

[PATCH v8 4/7] PCI: OF: Initialize dev->fwnode appropriately

2019-05-30 Thread Jean-Philippe Brucker
For PCI devices that have an OF node, set the fwnode as well. This way drivers that rely on fwnode don't need the special case described by commit f94277af03ea ("of/platform: Initialise dev->fwnode appropriately"). Acked-by: Bjorn Helgaas Signed-off-by: Jean-Philippe Brucker ---

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

2019-05-30 Thread Jean-Philippe Brucker
into corresponding virtio requests. Mappings are kept in an interval tree instead of page tables. A little more work is required for modular and x86 support, so for the moment the driver depends on CONFIG_VIRTIO=y and CONFIG_ARM64. Acked-by: Joerg Roedel Signed-off-by: Jean-Philippe Brucker --- MAINTAINERS

[PATCH v8 3/7] of: Allow the iommu-map property to omit untranslated devices

2019-05-30 Thread Jean-Philippe Brucker
Herring Signed-off-by: Jean-Philippe Brucker --- drivers/of/base.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 20e0e7ee4edf..55e7f5bb0549 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2294,8 +2294,12 @@ int

[PATCH v8 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2019-05-30 Thread Jean-Philippe Brucker
ewed-by: Rob Herring Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings/virtio/iommu.txt | 66 +++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/virtio/iommu.txt diff --git a/Documentation/device

[PATCH v8 1/7] dt-bindings: virtio-mmio: Add IOMMU description

2019-05-30 Thread Jean-Philippe Brucker
Otherwise, the virtio-mmio device may perform DMA through an IOMMU, which requires an "iommus" property. Describe these requirements in the device-tree bindings documentation. Reviewed-by: Rob Herring Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bind

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

2019-05-30 Thread Jean-Philippe Brucker
/kvmtool-jpb.git virtio-iommu/v0.12 Jean-Philippe Brucker (7): dt-bindings: virtio-mmio: Add IOMMU description dt-bindings: virtio: Add virtio-pci-iommu node of: Allow the iommu-map property to omit untranslated devices PCI: OF: Initialize dev->fwnode appropriately iommu: Add virtio-io

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

2019-05-28 Thread Jean-Philippe Brucker
On 27/05/2019 16:15, Michael S. Tsirkin wrote: > On Mon, May 27, 2019 at 11:26:04AM +0200, Joerg Roedel wrote: >> On Sun, May 12, 2019 at 12:31:59PM -0400, Michael S. Tsirkin wrote: >>> OK this has been in next for a while. >>> >>> Last time IOMMU maintainers objected. Are objections >>> still in

Re: [PATCH 2/4] iommu: Introduce device fault data

2019-05-24 Thread Jean-Philippe Brucker
On 24/05/2019 14:49, Jacob Pan wrote: > On Thu, 23 May 2019 19:43:46 +0100 > Robin Murphy wrote: >>> +/** >>> + * struct iommu_fault_event - Generic fault event >>> + * >>> + * Can represent recoverable faults such as a page requests or >>> + * unrecoverable faults such as DMA or IRQ remapping

[PATCH 2/4] iommu: Introduce device fault data

2019-05-23 Thread Jean-Philippe Brucker
care about non internal faults that are likely to be reported to an external subsystem. Signed-off-by: Jacob Pan Signed-off-by: Jean-Philippe Brucker Signed-off-by: Liu, Yi L Signed-off-by: Ashok Raj Signed-off-by: Eric Auger --- include/linux/iommu.h | 43 ++ include/uapi

[PATCH 4/4] iommu: Add recoverable fault reporting

2019-05-23 Thread Jean-Philippe Brucker
OS. Once handled, the fault must be completed by sending a page response back to the IOMMU. Add an iommu_page_response() function to complete a page fault. Signed-off-by: Jacob Pan Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/iommu.c | 95

[PATCH 3/4] iommu: Introduce device fault report API

2019-05-23 Thread Jean-Philippe Brucker
led faults will come later. Signed-off-by: Jacob Pan Signed-off-by: Ashok Raj Signed-off-by: Jean-Philippe Brucker Signed-off-by: Eric Auger --- drivers/iommu/iommu.c | 127 ++ include/linux/iommu.h | 29 ++ 2 files changed, 156 insertions(+)

[PATCH 0/4] iommu: Add device fault reporting API

2019-05-23 Thread Jean-Philippe Brucker
: Add per device iommu param iommu: Introduce device fault data iommu: Introduce device fault report API Jean-Philippe Brucker (1): iommu: Add recoverable fault reporting drivers/iommu/iommu.c | 218 + include/linux/device.h | 3 + include/linux

[PATCH 1/4] driver core: Add per device iommu param

2019-05-23 Thread Jean-Philippe Brucker
From: Jacob Pan DMA faults can be detected by IOMMU at device level. Adding a pointer to struct device allows IOMMU subsystem to report relevant faults back to the device driver for further handling. For direct assigned device (or user space drivers), guest OS holds responsibility to handle and

Re: [PATCH v3 09/16] iommu: Introduce guest PASID bind function

2019-05-22 Thread Jean-Philippe Brucker
On 21/05/2019 23:50, Jacob Pan wrote: >>> /** >>> * struct gpasid_bind_data - Information about device and guest >>> PASID binding >>> * @version:Version of this data structure >>> * @format: PASID table entry format >>> * @flags: Additional information on guest bind request >>> *

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

2019-05-22 Thread Jean-Philippe Brucker
On 21/05/2019 18:03, Jacob Pan wrote: > On Tue, 21 May 2019 10:21:55 +0200 > Auger Eric wrote: >>> +config IOASID >>> + bool >> don't we want a tristate here too? >> >> Also refering to the past discussions we could add "# The IOASID >> library may also be used by non-IOMMU_API users" > I

Re: [PATCH v3 09/16] iommu: Introduce guest PASID bind function

2019-05-21 Thread Jean-Philippe Brucker
On 20/05/2019 20:22, Jacob Pan wrote: > On Thu, 16 May 2019 09:14:29 -0700 > Jacob Pan wrote: > >> On Thu, 16 May 2019 15:14:40 +0100 >> Jean-Philippe Brucker wrote: >> >>> Hi Jacob, >>> >>> On 03/05/2019 23:32, Jacob Pan wrote: >>

Re: [RFC/PATCH 0/4] Initial support for modular IOMMU drivers

2019-05-21 Thread Jean-Philippe Brucker
Hi Isaac, On 17/05/2019 19:47, Isaac J. Manjarres wrote: > This series adds initial support for being able to use the ARM > SMMU driver as a loadable kernel module. The series also adds > to the IOMMU framework, so that it can defer probing for devices > that depend on an IOMMU driver that may be

Re: [PATCH v3 09/16] iommu: Introduce guest PASID bind function

2019-05-16 Thread Jean-Philippe Brucker
Hi Jacob, On 03/05/2019 23:32, Jacob Pan wrote: > +/** > + * struct gpasid_bind_data - Information about device and guest PASID binding > + * @gcr3:Guest CR3 value from guest mm > + * @pasid: Process address space ID used for the guest mm > + * @addr_width: Guest address width. Paging

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

2019-05-16 Thread Jean-Philippe Brucker
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 moment the sysfs ABI is not changed. However I wonder >>> whether it wouldn't be prefe

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

2019-05-16 Thread Jean-Philippe Brucker
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 the same direct > region is used by 2 devices, one USB/GFX and another not

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

2019-05-15 Thread Jean-Philippe Brucker
On 15/05/2019 14:06, Auger Eric wrote: > 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..532a64075

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

2019-05-15 Thread Jean-Philippe Brucker
On 14/05/2019 18:55, Jacob Pan wrote: > Yes, I agree to replace the standalone __64 pasid with this struct. > Looks more inline with address selective info., Just to double confirm > the new struct. > > Jean, will you put this in your sva/api repo? Yes, I pushed it along with some documentation

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

2019-05-15 Thread Jean-Philippe Brucker
On 15/05/2019 15:47, Tian, Kevin wrote: >> From: Jean-Philippe Brucker >> Sent: Wednesday, May 15, 2019 7:04 PM >> >> On 14/05/2019 18:44, Jacob Pan wrote: >>> Hi Thank you both for the explanation. >>> >>> On Tue, 14 May 2019 11:41:24 +0100 >&

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

2019-05-15 Thread Jean-Philippe Brucker
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 > @@ -112,4 +112,51 @@ struct iommu_fault { > struct

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

2019-05-15 Thread Jean-Philippe Brucker
On 14/05/2019 18:44, Jacob Pan wrote: > Hi Thank you both for the explanation. > > On Tue, 14 May 2019 11:41:24 +0100 > Jean-Philippe Brucker wrote: > >> On 14/05/2019 08:36, Auger Eric wrote: >>> Hi Jacob, >>> >>> On 5/14/19 12:16 AM, Jacob Pan

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

2019-05-14 Thread Jean-Philippe Brucker
On 14/05/2019 08:36, Auger Eric wrote: > 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 {

Re: [RFC] iommu: arm-smmu: stall support

2019-05-13 Thread Jean-Philippe Brucker
Hi Rob, On 10/05/2019 19:23, Rob Clark wrote: > On Fri, Sep 22, 2017 at 2:58 AM Jean-Philippe Brucker > wrote: >> >> On 22/09/17 10:02, Joerg Roedel wrote: >>> On Tue, Sep 19, 2017 at 10:23:43AM -0400, Rob Clark wrote: >>>> I would like to decide

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

2019-05-13 Thread Jean-Philippe Brucker
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) >> __u32 flags; >> __u32 archid; >> __u64 pasid; >> }; > I agree it does the job now. However it looks a

Re: [ARM SMMU] Dynamic StreamID allocation

2019-05-13 Thread Jean-Philippe Brucker
On 13/05/2019 08:09, Pankaj Bansal wrote: > Hi Jean, > >> -Original Message----- >> From: Jean-Philippe Brucker >> Sent: Friday, 10 May, 2019 07:07 PM >> To: Pankaj Bansal ; Will Deacon >> ; Robin Murphy ; Joerg >> Roedel >> Cc: iommu@lists.l

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

2019-05-13 Thread Jean-Philippe Brucker
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 > invalidation command). So I think we also need ARCHID invalidation. > Sorry for the late notice. >>

Re: [ARM SMMU] Dynamic StreamID allocation

2019-05-10 Thread Jean-Philippe Brucker
On 10/05/2019 13:33, Pankaj Bansal wrote: > Hi Will/Robin/Joerg, > > I am s/w engineer from NXP India Pvt. Ltd. > We are using SMMU-V3 in one of NXP SOC. > I have a question about the SMMU Stream ID allocation in linux. > > Right now the Stream IDs allocated to a device are mapped via device

Re: [PATCH v7 11/23] iommu/arm-smmu-v3: Maintain a SID->device structure

2019-05-08 Thread Jean-Philippe Brucker
On 08/05/2019 15:05, Robin Murphy wrote: > On 08/04/2019 13:18, Eric Auger wrote: >> From: Jean-Philippe Brucker >> >> When handling faults from the event or PRI queue, we need to find the >> struct device associated to a SID. Add a rb_tree to keep track of SIDs. >

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

2019-05-07 Thread Jean-Philippe Brucker
On 02/05/2019 17:46, Jacob Pan wrote: > On Thu, 2 May 2019 11:53:34 +0100 > Jean-Philippe Brucker wrote: > >> On 02/05/2019 07:58, Auger Eric wrote: >>> Hi Jean-Philippe, >>> >>> On 5/1/19 12:38 PM, Jean-Philippe Brucker wrote: >>>&g

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

2019-05-02 Thread Jean-Philippe Brucker
On 02/05/2019 07:58, Auger Eric wrote: > 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, >>> + s

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

2019-05-01 Thread Jean-Philippe Brucker
On 30/04/2019 21:24, Jacob Pan wrote: > On Thu, 25 Apr 2019 11:41:05 +0100 > Jean-Philippe Brucker wrote: > >> On 25/04/2019 11:17, Auger Eric wrote: >>>> +/** >>>> + * ioasid_alloc - Allocate an IOASID >>>> + * @set: the IOASID set >

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

2019-05-01 Thread Jean-Philippe Brucker
) > + return -ENODEV; > + > + ret = domain->ops->cache_invalidate(domain, dev, inv_info); > + > + return ret; Nit: you don't really need ret The UAPI looks good to me, so Reviewed-by: Jean-Philippe Brucker ___

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

2019-04-29 Thread Jean-Philippe Brucker
On 27/04/2019 09:38, Auger Eric wrote: --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5153,7 +5153,7 @@ static void auxiliary_unlink_device(struct dmar_domain *domain, domain->auxd_refcnt--; if (!domain->auxd_refcnt &&

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

2019-04-26 Thread Jean-Philippe Brucker
On 25/04/2019 19:19, Jacob Pan wrote: > Hi Christoph, > > On Tue, 23 Apr 2019 23:19:03 -0700 > Christoph Hellwig wrote: > >> On Tue, Apr 23, 2019 at 04:31:06PM -0700, Jacob Pan wrote: >>> The allocator doesn't really belong in drivers/iommu because some >>> drivers would like to allocate PASIDs

Re: [PATCH v2 02/19] iommu: introduce device fault data

2019-04-25 Thread Jean-Philippe Brucker
On 25/04/2019 14:21, Auger Eric wrote: We could add a >> IOMMU_FAULT_PAGE_REQUEST_PERM_VALID bit instead, but I still find it >> weird to denote the validity of a bitfield using a separate bit. >> >> Given that three different series now rely on this, how about we send >> the fault patches

Re: [PATCH v2 02/19] iommu: introduce device fault data

2019-04-25 Thread Jean-Philippe Brucker
On 24/04/2019 00:31, Jacob Pan wrote: > diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h > new file mode 100644 > index 000..edcc0dd > --- /dev/null > +++ b/include/uapi/linux/iommu.h > @@ -0,0 +1,115 @@ > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >

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

2019-04-25 Thread Jean-Philippe Brucker
On 25/04/2019 11:17, Auger Eric wrote: >> +/** >> + * ioasid_alloc - Allocate an IOASID >> + * @set: the IOASID set >> + * @min: the minimum ID (inclusive) >> + * @max: the maximum ID (exclusive) >> + * @private: data private to the caller >> + * >> + * Allocate an ID between @min and @max (or %0

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

2019-04-23 Thread Jean-Philippe Brucker
On 19/04/2019 05:29, Jacob Pan wrote: > If it is OK with you, I will squash my changes into your ioasid patch > and address the review comments in the v2 of this set, OK? > i.e. > [PATCH 02/18] ioasid: Add custom IOASID allocator > [PATCH 03/18] ioasid: Convert ioasid_idr to XArray That's fine

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

2019-04-18 Thread Jean-Philippe Brucker
On 16/04/2019 00:10, Jacob Pan wrote:[...] >> > +   /* >> > +    * Register a custom ASID allocator if we >> > are running >> > +    * in a guest, the purpose is to have a >> > system wide PASID >> > +    * namespace among all PASID

[PATCH v3 9/9] iommu/arm-smmu-v3: Disable tagged pointers

2019-04-17 Thread Jean-Philippe Brucker
Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 3bde137a3755..99b83fda11e4 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1057,7 +1057,6

[PATCH v3 8/9] iommu/arm-smmu-v3: Add support for PCI ATS

2019-04-17 Thread Jean-Philippe Brucker
tually allowed to send translated requests. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 201 ++-- 1 file changed, 195 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 3e7198ee9530..

[PATCH v3 3/9] ACPI/IORT: Check ATS capability in root complex nodes

2019-04-17 Thread Jean-Philippe Brucker
. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 11 +++ include/linux/iommu.h | 4 2 files changed, 15 insertions(+) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index e48894e002ba..4000902e57f0 100644 --- a/drivers/acpi/arm64/iort.c +++ b

[PATCH v3 0/9] Add PCI ATS support to Arm SMMUv3

2019-04-17 Thread Jean-Philippe Brucker
for v5.2. [1] https://www.spinics.net/lists/arm-kernel/msg719722.html [2] git://linux-arm.org/linux-jpb.git ats/current Jean-Philippe Brucker (9): PCI: Move ATS declarations outside of CONFIG_PCI PCI: Add a stub for pci_ats_disabled() ACPI/IORT: Check ATS capability in root complex nodes

[PATCH v3 7/9] iommu/arm-smmu-v3: Link domains and devices

2019-04-17 Thread Jean-Philippe Brucker
-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 7b425483f4b6..3e7198ee9530 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers

[PATCH v3 5/9] iommu/arm-smmu-v3: Store SteamIDs in master

2019-04-17 Thread Jean-Philippe Brucker
Simplify the attach/detach code a bit by keeping a pointer to the stream IDs in the master structure. Although not completely obvious here, it does make the subsequent support for ATS, PRI and PASID a bit simpler. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 30

<    5   6   7   8   9   10   11   12   13   14   >