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

2018-12-13 Thread Jean-Philippe Brucker
Hi Joerg, On 12/12/2018 10:35, Joerg Roedel wrote: > Hi, > > to make progress on this, we should first agree on the protocol used > between guest and host. I have a few points to discuss on the protocol > first. > > On Tue, Dec 11, 2018 at 06:20:57PM +, Jean-Philippe

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

2018-12-20 Thread Jean-Philippe Brucker
On 19/12/2018 23:09, Michael S. Tsirkin wrote: > On Thu, Dec 13, 2018 at 12:50:29PM +0000, Jean-Philippe Brucker wrote: >>>> [3] git://linux-arm.org/linux-jpb.git virtio-iommu/v0.9.1 >>>> git://linux-arm.org/kvmtool-jpb.git virtio-iommu/v0.9 >>> >>&

Re: question about broadcast invalidation and atc invalidation

2018-12-21 Thread Jean-Philippe Brucker
Hi, On 21/12/2018 09:31, Zhongmiao wrote: > Hi Jean: > Now Soft need to make sure build atc inv cmd to smmu after Execute > "TLBI" (dvm sync). I don't think it's very reasonable. Why Smmu The > smmu automatically sends the inv atc command when smmu receive > broadcast invalidation ? I'd

Re: [RFC v3 14/21] iommu: introduce device fault data

2019-01-11 Thread Jean-Philippe Brucker
reported are grouped >> and generalized based common specifications such as PCI ATS. >> >> 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 >> [

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

2019-01-11 Thread Jean-Philippe Brucker
On 11/01/2019 12:28, Joerg Roedel wrote: > Hi Jean-Philippe, > > On Thu, Dec 13, 2018 at 12:50:29PM +0000, Jean-Philippe Brucker wrote: >> We already do deferred flush: UNMAP requests are added to the queue by >> iommu_unmap(), and then flushed out by iotlb_sync(). So we

Re: [RFC v3 09/21] iommu/smmuv3: Get prepared for nested stage support

2019-01-11 Thread Jean-Philippe Brucker
Hi Eric, On 08/01/2019 10:26, Eric Auger wrote: > To allow nested stage support, we need to store both > stage 1 and stage 2 configurations (and remove the former > union). > > arm_smmu_write_strtab_ent() is modified to write both stage > fields in the STE. > > We add a nested_bypass field to th

Re: [RFC v3 11/21] iommu/smmuv3: Implement cache_invalidate

2019-01-11 Thread Jean-Philippe Brucker
On 08/01/2019 10:26, Eric Auger wrote: > Implement IOMMU_INV_TYPE_TLB invalidations. When > nr_pages is null we interpret this as a context > invalidation. > > Signed-off-by: Eric Auger > > --- > > The user API needs to be refined to discriminate context > invalidations from NH_VA invalidations

Re: [RFC v3 17/21] iommu/smmuv3: Report non recoverable faults

2019-01-11 Thread Jean-Philippe Brucker
On 08/01/2019 10:26, 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 > --- > drivers/iommu/arm-smmu-v3.c | 124 ++

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

2019-01-11 Thread Jean-Philippe Brucker
specializations of this struct, > for PASID table passing and ARM SMMUv3. Last sentence is a bit confusing. With SMMUv3 it is also used for the PASID table, even when it only has one entry and PASID is disabled. > Signed-off-by: Jean-Philippe Brucker > Signed-off-by: Liu, Yi L >

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

2019-01-15 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 v7 3/7] of: Allow the iommu-map property to omit untranslated devices

2019-01-15 Thread Jean-Philippe Brucker
ed-by: Rob 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 5226e898476e..4d12b1cab55f 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2293,8 +2293

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

2019-01-15 Thread Jean-Philippe Brucker
virtio-iommu, because MSIs bypass it. Tested-by: Bharat Bhushan Tested-by: Eric Auger 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

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

2019-01-15 Thread Jean-Philippe Brucker
-off-by: Jean-Philippe Brucker --- MAINTAINERS | 7 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/virtio-iommu.c | 916 ++ include/uapi/linux/virtio_ids.h | 1 + include/uapi/linux

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

2019-01-15 Thread Jean-Philippe Brucker
Auger Signed-off-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

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

2019-01-15 Thread Jean-Philippe Brucker
rwise, 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 v7 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2019-01-15 Thread Jean-Philippe Brucker
Reviewed-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/d

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

2019-01-15 Thread Jean-Philippe Brucker
-IOMMU device https://www.mail-archive.com/qemu-devel@nongnu.org/msg575578.html [5] [PATCH] iommu/of: Fix probe-deferral https://www.spinics.net/lists/arm-kernel/msg698371.html Jean-Philippe Brucker (7): dt-bindings: virtio-mmio: Add IOMMU description dt-bindings: virtio: Add vir

Re: [RFC v3 17/21] iommu/smmuv3: Report non recoverable faults

2019-01-16 Thread Jean-Philippe Brucker
On 15/01/2019 21:06, Auger Eric wrote: >>> + iommu_report_device_fault(master->dev, &event); >> >> We should return here if the fault is successfully injected > > Even if the fault gets injected in the guest can't it be still useful to > get the message below on host side? I don't think

Re: [RFC v3 14/21] iommu: introduce device fault data

2019-01-16 Thread Jean-Philippe Brucker
On 14/01/2019 22:32, Jacob Pan wrote: >> [...] +/** + * struct iommu_fault - Generic fault data + * + * @type contains fault type + * @reason fault reasons if relevant outside IOMMU driver. + * IOMMU driver internal faults are not reported. + * @addr: tells the of

Re: [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()

2019-01-16 Thread Jean-Philippe Brucker
On 16/01/2019 15:27, Auger Eric wrote: > Hi Joerg, > > On 12/20/18 10:08 AM, Joerg Roedel wrote: >> From: Joerg Roedel >> >> This check needs to be there and got lost at some point >> during development. Add it again. >> >> Fixes: 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly

Re: [RFC v3 14/21] iommu: introduce device fault data

2019-01-16 Thread Jean-Philippe Brucker
On 15/01/2019 21:27, Auger Eric wrote: [...] /* iommu fault flags */ -#define IOMMU_FAULT_READ 0x0 -#define IOMMU_FAULT_WRITE 0x1 +#define IOMMU_FAULT_READ (1 << 0) +#define IOMMU_FAULT_WRITE (1 << 1) +#define IOMMU_FAULT_EXEC (1 << 2)

Re: [PATCH v1] iommu/s390: Declare s390 iommu reserved regions

2019-01-18 Thread Jean-Philippe Brucker
Hi Pierre, On 18/01/2019 13:29, Pierre Morel wrote: > On 17/01/2019 14:02, Robin Murphy wrote: >> On 15/01/2019 17:37, Pierre Morel wrote: >>> The s390 iommu can only allow DMA transactions between the zPCI device >>> entries start_dma and end_dma. >>> >>> Let's declare the regions before start_dm

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

2019-01-21 Thread Jean-Philippe Brucker
Hi, On 18/01/2019 15:51, Michael S. Tsirkin wrote: > > On Tue, Jan 15, 2019 at 12:19:52PM +, Jean-Philippe Brucker wrote: >> Implement the virtio-iommu driver, following specification v0.9 [1]. >> >> This is a simple rebase onto Linux v5.0-rc2. We now use the >>

Re: [PATCH v1] iommu/s390: Declare s390 iommu reserved regions

2019-01-21 Thread Jean-Philippe Brucker
On 21/01/2019 11:51, Pierre Morel wrote: > On 18/01/2019 14:51, Jean-Philippe Brucker wrote: >> Hi Pierre, >> >> On 18/01/2019 13:29, Pierre Morel wrote: >>> On 17/01/2019 14:02, Robin Murphy wrote: >>>> On 15/01/2019 17:37, Pierre Morel wrote: >>&g

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

2019-01-24 Thread Jean-Philippe Brucker
Hi Joerg, On 23/01/2019 08:34, Joerg Roedel wrote: > Hi Jean-Philippe, > > thanks for all your hard work on this! > > On Tue, Jan 15, 2019 at 12:19:52PM +, Jean-Philippe Brucker wrote: >> Implement the virtio-iommu driver, following specification v0.9 [1]. > >

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

2019-01-25 Thread Jean-Philippe Brucker
On 25/01/2019 08:55, Auger Eric wrote: > 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 >&

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

2019-01-28 Thread Jean-Philippe Brucker
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 >>> --- a/include/uapi/linux/iommu.h >>> +++ b/include/uapi/linux/iommu.h >>> @@ -47,4 +47,99 @@ struct iommu_pasid_table_confi

Re: [PATCH 2/2] iommu/amd: Remove clear_flush_young notifier

2019-01-30 Thread Jean-Philippe Brucker
Hi Peter, On 30/01/2019 05:57, Peter Xu wrote: > AMD IOMMU driver is using the clear_flush_young() to do cache flushing > but that's actually already covered by invalidate_range(). Remove the > extra notifier and the chunks. Aren't uses of clear_flush_young() and invalidate_range() orthogonal? I

Re: [PATCH 2/2] iommu/amd: Remove clear_flush_young notifier

2019-01-31 Thread Jean-Philippe Brucker
On 31/01/2019 07:59, Peter Xu wrote: > On Wed, Jan 30, 2019 at 12:27:40PM +0000, Jean-Philippe Brucker wrote: >> Hi Peter, > > Hi, Jean, > >> >> On 30/01/2019 05:57, Peter Xu wrote: >>> AMD IOMMU driver is using the clear_flush_young() to do cache flushing

Re: [PATCH RFC 1/1] iommu: set the default iommu-dma mode as non-strict

2019-01-31 Thread Jean-Philippe Brucker
Hi, On 31/01/2019 13:52, Zhen Lei wrote: > Currently, many peripherals are faster than before. For example, the top > speed of the older netcard is 10Gb/s, and now it's more than 25Gb/s. But > when iommu page-table mapping enabled, it's hard to reach the top speed > in strict mode, because of freq

Re: [PATCH 2/2] iommu/amd: Remove clear_flush_young notifier

2019-02-01 Thread Jean-Philippe Brucker
On 01/02/2019 03:51, Peter Xu wrote: > On Thu, Jan 31, 2019 at 12:25:40PM +0000, Jean-Philippe Brucker wrote: >> On 31/01/2019 07:59, Peter Xu wrote: >>> On Wed, Jan 30, 2019 at 12:27:40PM +0000, Jean-Philippe Brucker wrote: >>>> Hi Peter, >>> >>> Hi

Re: [PATCH v6 1/9] iommu: Add APIs for multiple domains per device

2019-02-13 Thread Jean-Philippe Brucker
IOV needs >     to write this ID to the device register so that DMA >     requests could be tagged with a right PASID prefix. > > This has been updated with the latest proposal from Joerg > posted here [5]. > > Many people involved in discussions of this design. > > Kevin

Re: [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management

2019-02-15 Thread Jean-Philippe Brucker
success. >> >> * iommu_pasid_free(pasid, ioasid) >> - Free a PASID to the pool so that it could be consumed by >> others. >> >> This also adds below helpers to lookup or iterate PASID items >> associated with a consumer. >> >> * iommu_pasid_for

Re: [PATCH v6 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-15 Thread Jean-Philippe Brucker
ps.  Where do > we go from here?  I think we need an ack from Kirti since they have an > interest here.  Presumably this looks ok to the ARM folks. Looks great from my point of view. I focused on patch 1 since I'm planning to reuse iommu_dev_features for SVA. I don't have time to test

[PATCH 0/1] IOMMU SVA device driver interface

2019-02-20 Thread Jean-Philippe Brucker
The core mm handles translation faults from the IOMMU. * MMU and IOMMU implement compatible page table formats. --- Jean-Philippe Brucker (1): iommu: Bind process address spaces to devices drivers/iommu/iommu.c | 104 ++

[PATCH 1/1] iommu: Bind process address spaces to devices

2019-02-20 Thread Jean-Philippe Brucker
driver should disable DMA from the given context, so that the core IOMMU can reallocate the PASID. To use these functions, device driver must first enable the IOMMU_DEV_FEAT_SVA device feature with iommu_dev_enable_feature(). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/iommu.c | 104

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

2019-02-22 Thread Jean-Philippe Brucker
Hi Thiago, On 21/02/2019 22:18, Thiago Jung Bauermann wrote: > > Hello Jean-Philippe, > > Jean-Philippe Brucker writes: >> Makes sense, though I think other virtio devices have been developed a >> little more organically: device and driver code got upstreame

Re: [PATCH 1/1] iommu: Bind process address spaces to devices

2019-02-26 Thread Jean-Philippe Brucker
On 26/02/2019 11:17, Joerg Roedel wrote: > Hi Jean-Philippe, > > Thanks for the patch! I think this is getting close to be applied after > the next merge window. > > On Wed, Feb 20, 2019 at 02:27:59PM +0000, Jean-Philippe Brucker wrote: >> +int iommu_sva_bind_device(st

Re: [PATCH 1/1] iommu: Bind process address spaces to devices

2019-02-28 Thread Jean-Philippe Brucker
On 27/02/2019 21:41, Jacob Pan wrote: > On Tue, 26 Feb 2019 12:17:43 +0100 > Joerg Roedel wrote: > >> Hi Jean-Philippe, >> >> Thanks for the patch! I think this is getting close to be applied >> after the next merge window. >> >> On Wed, Feb 20, 20

Re: [PATCH RFC 1/1] iommu: set the default iommu-dma mode as non-strict

2019-03-01 Thread Jean-Philippe Brucker
Hi Leizhen, On 01/03/2019 04:44, Leizhen (ThunderTown) wrote: > > > On 2019/2/26 20:36, Hanjun Guo wrote: >> Hi Jean, >> >> On 2019/1/31 22:55, Jean-Philippe Brucker wrote: >>> Hi, >>> >>> On 31/01/2019 13:52, Zhen Lei wrote: >>>&g

Re: [RFC PATCH v1 05/15] iommu/arm-smmu: Add auxiliary domain support for arm-smmuv2

2019-03-04 Thread Jean-Philippe Brucker
Hi Jordan, On 01/03/2019 19:38, Jordan Crouse wrote: > Support the new auxiliary domain API for arm-smmuv2 to initialize and > support multiple pagetables for a SMMU device. Since the smmu-v2 hardware > doesn't have any built in support for switching the pagetable base it is > left as an exercise

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

2019-03-05 Thread Jean-Philippe Brucker
ult or a page request, > also referred to as a recoverable fault. > > We only 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 >

Re: [PATCH v4 03/22] iommu: introduce device fault report API

2019-03-05 Thread Jean-Philippe Brucker
On 18/02/2019 13:54, Eric Auger wrote: [...]> +/** > + * iommu_register_device_fault_handler() - Register a device fault handler > + * @dev: the device > + * @handler: the fault handler > + * @data: private data passed as argument to the handler > + * > + * When an IOMMU fault event is received, ca

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

2019-03-05 Thread Jean-Philippe Brucker
iommu driver. > > This patch adds a new API to the iommu subsystem that allows > to set/unset the pasid table information. > > A generic iommu_pasid_table_config struct is introduced in > a new iommu.h uapi header. This is going to be used by the VFIO > user API. > > S

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

2019-03-05 Thread Jean-Philippe Brucker
re, > model specific IOMMU drivers need to convert them into their own format. > > Signed-off-by: Liu, Yi L > Signed-off-by: Jean-Philippe Brucker > Signed-off-by: Jacob Pan > Signed-off-by: Ashok Raj > Signed-off-by: Eric Auger > > --- > v3 -> v4: > -

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

2019-03-06 Thread Jean-Philippe Brucker
On 06/03/2019 09:38, Auger Eric wrote: >>> +struct iommu_fault_unrecoverable { >>> +    __u32   reason; /* enum iommu_fault_reason */ >>> +#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0) >>> +#define IOMMU_FAULT_UNRECOV_PERM_VALID  (1 << 1) >> >> Not needed, since @perm is

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

2019-03-06 Thread Jean-Philippe Brucker
On 06/03/2019 14:30, Auger Eric wrote: >>> +#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) >>> +#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) >>> + __u32 flags; >>> + __u32 pasid; >>> + __u32 grpid; >>> + __u32 perm; >>> + __u64 addr; >> >> Given that we'll be reporti

Re: [PATCH v4 03/22] iommu: introduce device fault report API

2019-03-07 Thread Jean-Philippe Brucker
On 06/03/2019 23:46, Jacob Pan wrote: > On Tue, 5 Mar 2019 15:03:41 + > Jean-Philippe Brucker wrote: > >> On 18/02/2019 13:54, Eric Auger wrote: >> [...]> +/** >> > + * iommu_register_device_fault_handler() - Register a device fault >> > handler &

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

2019-03-18 Thread Jean-Philippe Brucker
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.h >>> +++ b/include/uapi/linux/iommu.h >>> @@ -159,4 +159,75 @@ struct iommu_pasid_table_config { >>> };

[PATCH v2 1/1] iommu: Bind process address spaces to devices

2019-03-20 Thread Jean-Philippe Brucker
. Whether the process exited or nor, the device driver should always release the handle with unbind(). To use these functions, device driver must first enable the IOMMU_DEV_FEAT_SVA device feature with iommu_dev_enable_feature(). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/iommu.c | 105

[PATCH v2 0/1] IOMMU SVA device driver interface

2019-03-20 Thread Jean-Philippe Brucker
http://www.linux-arm.org/git?p=linux-jpb.git;a=shortlog;h=refs/heads/sva/current Jean-Philippe Brucker (1): iommu: Bind process address spaces to devices drivers/iommu/iommu.c | 105 ++ include/linux/iommu.h | 71 2 files ch

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

2019-03-20 Thread Jean-Philippe Brucker
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 IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2) >> +__u32 flags; >> +__u32 archid; >> +__u64 pasid; >> +

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

2019-03-20 Thread Jean-Philippe Brucker
break anything. [1] https://www.spinics.net/lists/kvm/msg168742.html [2] https://patchwork.kernel.org/patch/10781793/ Jean-Philippe Brucker (4): ACPI/IORT: Check ATS capability in root complex nodes iommu/arm-smmu-v3: Link domains and devices iommu/arm-smmu-v3: Add support for PCI ATS

[PATCH 3/4] iommu/arm-smmu-v3: Add support for PCI ATS

2019-03-20 Thread Jean-Philippe Brucker
hat the device is actually allowed to send translated requests. Signed-off-by: Jean-Philippe Brucker --- Since last version: * Refresh * Don't enable ATS for untrusted devices, or when pci.noats is on the kernel command line. --- drivers/iommu/arm-smmu-v3.c | 221 ++

[PATCH 1/4] ACPI/IORT: Check ATS capability in root complex nodes

2019-03-20 Thread Jean-Philippe Brucker
ed in other firmware descriptions. The SMMU has a feature bit telling if it supports ATS, which might be sufficient in most systems for deciding whether or not we should enable the ATS capability in endpoints. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 11 +++ in

[PATCH 2/4] iommu/arm-smmu-v3: Link domains and devices

2019-03-20 Thread Jean-Philippe Brucker
r. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index d3880010c6cf..66a29c113dbc 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/dri

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

2019-03-20 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 c605d6f1b2df..69afffdaf907 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1076,7 +1

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

2019-03-21 Thread Jean-Philippe Brucker
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: >> [...] >>>> +struct iommu_inv_addr_info { >>>> +#define IOMMU_INV_A

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

2019-03-25 Thread Jean-Philippe Brucker
On 21/03/2019 15:52, Sinan Kaya wrote: > On 3/20/2019 1:36 PM, Jean-Philippe Brucker wrote: >> pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ATS); >> +    if (!pos) >> +    return -ENOSYS; >> + > > You don't need this. pci_enable_ats() validate

Re: [PATCH 1/4] ACPI/IORT: Check ATS capability in root complex nodes

2019-03-25 Thread Jean-Philippe Brucker
On 21/03/2019 16:00, Sinan Kaya wrote: > On 3/20/2019 1:36 PM, Jean-Philippe Brucker wrote: >>   err = pci_for_each_dma_alias(to_pci_dev(dev), >>    iort_pci_iommu_init, &info); >> + >> +    if (!err && !iort_pci_rc_

[PATCH 3/3] iommu/virtio: Enable x86 support

2020-02-14 Thread Jean-Philippe Brucker
With the built-in topology description in place, x86 platforms can now use the virtio-iommu. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 068d4e0e3541

[PATCH 2/3] PCI: Add DMA configuration for virtual platforms

2020-02-14 Thread Jean-Philippe Brucker
ltiple DMA configuration methods. Signed-off-by: Jean-Philippe Brucker --- drivers/pci/pci-driver.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 0454ca0e4e3f..69303a814f21 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pc

[PATCH 1/3] iommu/virtio: Add topology description to virtio-iommu config space

2020-02-14 Thread Jean-Philippe Brucker
sting virtio-iommu implementations. It also enables an IOMMU for lightweight hypervisors that do not rely on firmware methods for booting. Signed-off-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- MAINTAINERS | 2 + drivers/iommu/Kconfig

[PATCH 0/3] virtio-iommu on non-devicetree platforms

2020-02-14 Thread Jean-Philippe Brucker
rnel.org/linux-iommu/20191122105000.800410-1-jean-phili...@linaro.org/ [2] https://jpbrucker.net/git/qemu virtio-iommu/devel Jean-Philippe Brucker (3): iommu/virtio: Add topology description to virtio-iommu config space PCI: Add DMA configuration for virtual platforms iommu/virtio

[PATCH] iommu/virtio: Build virtio-iommu as module

2020-02-14 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker Now that the infrastructure changes are in place, enable virtio-iommu to be built as a module. Remove the redundant pci_request_acs() call, since it's not exported but is already invoked during DMA setup. Signed-off-by: Jean-Philippe Brucker --- This conflicts

Re: [PATCH 3/3] iommu/virtio: Enable x86 support

2020-02-17 Thread Jean-Philippe Brucker
On Sun, Feb 16, 2020 at 04:50:33AM -0500, Michael S. Tsirkin wrote: > On Fri, Feb 14, 2020 at 04:57:11PM +, Robin Murphy wrote: > > On 14/02/2020 4:04 pm, Jean-Philippe Brucker wrote: > > > With the built-in topology description in place, x86 platforms can now > >

Re: [PATCH 2/3] PCI: Add DMA configuration for virtual platforms

2020-02-17 Thread Jean-Philippe Brucker
On Fri, Feb 14, 2020 at 05:03:16PM +, Robin Murphy wrote: > On 14/02/2020 4:04 pm, Jean-Philippe Brucker wrote: > > Hardware platforms usually describe the IOMMU topology using either > > device-tree pointers or vendor-specific ACPI tables. For virtual > > platforms

Re: [PATCH 03/11] PCI: OF: Check whether the host bridge supports ATS

2020-02-17 Thread Jean-Philippe Brucker
On Thu, Feb 13, 2020 at 12:26:46PM -0600, Rob Herring wrote: > On Thu, Feb 13, 2020 at 10:52 AM Jean-Philippe Brucker > wrote: > > > > Copy the ats-supported flag into the pci_host_bridge structure. > > > > Signed-off-by: Jean-Philippe Brucker > > ---

Re: [PATCH 02/11] PCI: Add ats_supported host bridge flag

2020-02-17 Thread Jean-Philippe Brucker
On Sat, Feb 15, 2020 at 03:10:47PM -0600, Bjorn Helgaas wrote: > On Thu, Feb 13, 2020 at 05:50:40PM +0100, Jean-Philippe Brucker wrote: > > Each vendor has their own way of describing whether a host bridge > > supports ATS. The Intel and AMD ACPI tables selectively enable or >

Re: [PATCH v2] iommu/arm-smmu-v3: Batch ATC invalidation commands

2020-02-17 Thread Jean-Philippe Brucker
one-by-one. > > As there is only one caller of arm_smmu_atc_inv_master() left, we can > simplify it and avoid passing in struct arm_smmu_cmdq_ent. > > Cc: Jean-Philippe Brucker > Cc: Will Deacon > Cc: Robin Murphy > Cc: Joerg Roedel > Signed-off-by: Rob Herring Re

Re: [PATCH] iommu/virtio: Build virtio-iommu as module

2020-02-19 Thread Jean-Philippe Brucker
Hi Joerg, On Wed, Feb 19, 2020 at 12:16:04PM +0100, Joerg Roedel wrote: > On Fri, Feb 14, 2020 at 05:38:27PM +0100, Jean-Philippe Brucker wrote: > > From: Jean-Philippe Brucker > > > > Now that the infrastructure changes are in place, enable virtio-iommu to > > be bu

[PATCH v2 0/6] iommu/arm-smmu-v3: Finish PASID support and command queue batching

2020-02-24 Thread Jean-Philippe Brucker
/20200213205600.19690-1-r...@kernel.org/ Jean-Philippe Brucker (5): PCI/ATS: Export symbols of PASID functions iommu/arm-smmu-v3: Add support for PCI PASID iommu/arm-smmu-v3: Write level-1 descriptors atomically iommu/arm-smmu-v3: Add command queue batching helpers iommu/arm-smmu-v3: Batch context

[PATCH v2 5/6] iommu/arm-smmu-v3: Batch context descriptor invalidation

2020-02-24 Thread Jean-Philippe Brucker
Rather than publishing one command at a time when invalidating a context descriptor, batch the commands for all SIDs in the domain. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm

[PATCH v2 3/6] iommu/arm-smmu-v3: Write level-1 descriptors atomically

2020-02-24 Thread Jean-Philippe Brucker
Use WRITE_ONCE() to make sure that the SMMU doesn't read incomplete stream table descriptors. Refer to the comment about 64-bit accesses, and add the comment to the equivalent context descriptor code. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 4 +++- 1 file ch

[PATCH v2 2/6] iommu/arm-smmu-v3: Add support for PCI PASID

2020-02-24 Thread Jean-Philippe Brucker
Enable PASID for PCI devices that support it. Initialize PASID early in add_device() because it must be enabled before ATS. Tested-by: Zhangfei Gao Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 62 - 1

[PATCH v2 1/6] PCI/ATS: Export symbols of PASID functions

2020-02-24 Thread Jean-Philippe Brucker
The Arm SMMUv3 driver uses pci_{enable,disable}_pasid() and related functions. Export them to allow the driver to be built as a module. Signed-off-by: Jean-Philippe Brucker --- drivers/pci/ats.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c index

[PATCH v2 4/6] iommu/arm-smmu-v3: Add command queue batching helpers

2020-02-24 Thread Jean-Philippe Brucker
As more functions will implement command queue batching, add two helpers to simplify building a command list. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers

[PATCH v2 6/6] iommu/arm-smmu-v3: Batch ATC invalidation commands

2020-02-24 Thread Jean-Philippe Brucker
master() left, we can simplify it and avoid passing in struct arm_smmu_cmdq_ent. Cc: Jean-Philippe Brucker Cc: Will Deacon Cc: Robin Murphy Cc: Joerg Roedel Signed-off-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 31 ++- 1

[PATCH v4 08/26] iommu/io-pgtable-arm: Move some definitions to a header

2020-02-24 Thread Jean-Philippe Brucker
Extract some of the most generic TCR defines, so they can be reused by the page table sharing code. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/io-pgtable-arm.c | 27 ++- drivers/iommu/io-pgtable-arm.h | 30 ++ 2 files changed, 32

[PATCH v4 11/26] iommu/arm-smmu-v3: Share process page tables

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker With Shared Virtual Addressing (SVA), we need to mirror CPU TTBR, TCR, MAIR and ASIDs in SMMU contexts. Each SMMU has a single ASID space split into two sets, shared and private. Shared ASIDs correspond to those obtained from the arch ASID allocator, and private ASIDs

[PATCH v4 05/26] iommu/iopf: Handle mm faults

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker When a recoverable page fault is handled by the fault workqueue, find the associated mm and call handle_mm_fault. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/io-pgfault.c | 86 +- 1 file changed, 84 insertions(+), 2

[PATCH v4 04/26] iommu/sva: Search mm by PASID

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker The fault handler will need to find an mm given its PASID. This is the reason we have an IDR for storing address spaces, so hook it up. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/iommu-sva.c | 19 +++ include/linux/iommu.h | 9

[PATCH v4 12/26] iommu/arm-smmu-v3: Seize private ASID

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker The SMMU has a single ASID space, the union of shared and private ASID sets. This means that the SMMU driver competes with the arch allocator for ASIDs. Shared ASIDs are those of Linux processes, allocated by the arch, and contribute in broadcast TLB maintenance

[PATCH v4 10/26] arm64: cpufeature: Export symbol read_sanitised_ftr_reg()

2020-02-24 Thread Jean-Philippe Brucker
The SMMUv3 driver would like to read the MMFR0 PARANGE field in order to share CPU page tables with devices. Allow the driver to be built as module by exporting the read_sanitized_ftr_reg() cpufeature symbol. Signed-off-by: Jean-Philippe Brucker --- arch/arm64/kernel/cpufeature.c | 1 + 1 file

[PATCH v4 07/26] arm64: mm: Pin down ASIDs for sharing mm with devices

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker To enable address space sharing with the IOMMU, introduce mm_context_get() and mm_context_put(), that pin down a context and ensure that it will keep its ASID after a rollover. Export the symbols to let the modular SMMUv3 driver use them. Pinning is necessary because

[PATCH v4 17/26] iommu/arm-smmu-v3: Implement mm operations

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker Hook SVA operations to support sharing page tables with the SMMUv3: * dev_enable/disable/has_feature for device drivers to modify the SVA state. * sva_bind/unbind and sva_get_pasid to bind device and address spaces. * The mm_attach/detach/invalidate/free callbacks

[PATCH v4 02/26] iommu/sva: Manage process address spaces

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker Add a small library to help IOMMU drivers manage process address spaces bound to their devices. Register an MMU notifier to track modification on each address space bound to one or more devices. IOMMU drivers must implement the io_mm_ops and can then use the helpers

[PATCH v4 01/26] mm/mmu_notifiers: pass private data down to alloc_notifier()

2020-02-24 Thread Jean-Philippe Brucker
ned-off-by: Jean-Philippe Brucker --- drivers/misc/sgi-gru/grutlbpurge.c | 4 ++-- include/linux/mmu_notifier.h | 10 ++ mm/mmu_notifier.c | 6 -- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/mi

[PATCH v4 16/26] iommu/arm-smmu-v3: Add dev_to_master() helper

2020-02-24 Thread Jean-Philippe Brucker
We'll need to frequently find the SMMU master associated to a device when implementing SVA. Move it to a separate function. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iomm

[PATCH v4 03/26] iommu: Add a page fault handler

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker Some systems allow devices to handle I/O Page Faults in the core mm. For example systems implementing the PCI PRI extension or Arm SMMU stall model. Infrastructure for reporting these recoverable page faults was recently added to the IOMMU core. Add a page fault

[PATCH v4 13/26] iommu/arm-smmu-v3: Add support for VHE

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker ARMv8.1 extensions added Virtualization Host Extensions (VHE), which allow to run a host kernel at EL2. When using normal DMA, Device and CPU address spaces are dissociated, and do not need to implement the same capabilities, so VHE hasn't been used in the SMMU

[PATCH v4 19/26] iommu/arm-smmu-v3: Add support for Hardware Translation Table Update

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker If the SMMU supports it and the kernel was built with HTTU support, enable hardware update of access and dirty flags. This is essential for shared page tables, to reduce the number of access faults on the fault queue. We can enable HTTU even if CPUs don't suppo

[PATCH v4 00/26] iommu: Shared Virtual Addressing and SMMUv3 support

2020-02-24 Thread Jean-Philippe Brucker
https://lore.kernel.org/linux-iommu/20180511190641.23008-1-jean-philippe.bruc...@arm.com/ [3] https://lore.kernel.org/linux-iommu/1581407665-13504-1-git-send-email-zhangfei....@linaro.org/ Jean-Philippe Brucker (26): mm/mmu_notifiers: pass private data down to alloc_notifier() iommu/sva:

[PATCH v4 09/26] iommu/arm-smmu-v3: Manage ASIDs with xarray

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker In preparation for sharing some ASIDs with the CPU, use a global xarray to store ASIDs and their context. ASID#1 is not reserved, and the ASID space is global. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 27 ++- 1

[PATCH v4 06/26] iommu/sva: Register page fault handler

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker When enabling SVA, register the fault handler. Device driver will register an I/O page fault queue before or after calling iommu_sva_enable. The fault queue must be flushed before any io_mm is freed, to make sure that its PASID isn't used in any fault queue, an

[PATCH v4 26/26] iommu/arm-smmu-v3: Add support for PRI

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker For PCI devices that support it, enable the PRI capability and handle PRI Page Requests with the generic fault handler. It is enabled on demand by iommu_sva_device_init(). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 278

[PATCH v4 20/26] iommu/arm-smmu-v3: Maintain a SID->device structure

2020-02-24 Thread Jean-Philippe Brucker
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. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 177 +--- 1 file

[PATCH v4 15/26] iommu/arm-smmu-v3: Add SVA feature checking

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker Aggregate all sanity-checks for sharing CPU page tables with the SMMU under a single ARM_SMMU_FEAT_SVA bit. For PCIe SVA, users also need to check FEAT_ATS and FEAT_PRI. For platform SVA, they will most likely have to check FEAT_STALLS. Signed-off-by: Jean-Philippe

[PATCH v4 21/26] iommu/arm-smmu-v3: Ratelimit event dump

2020-02-24 Thread Jean-Philippe Brucker
When a device or driver misbehaves, it is possible to receive events much faster than we can print them out. Ratelimit the printing of events. Signed-off-by: Jean-Philippe Brucker --- During the SVA tests when the device driver didn't properly stop DMA before unbinding, the event queue t

[PATCH v4 14/26] iommu/arm-smmu-v3: Enable broadcast TLB maintenance

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker The SMMUv3 can handle invalidation targeted at TLB entries with shared ASIDs. If the implementation supports broadcast TLB maintenance, enable it and keep track of it in a feature bit. The SMMU will then be affected by inner-shareable TLB invalidations from other

<    1   2   3   4   5   6   7   8   9   10   >