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

2020-03-11 Thread Jean-Philippe Brucker
When setting up a generic host on a device-tree based system, copy the ats-supported flag into the pci_host_bridge structure. Signed-off-by: Jean-Philippe Brucker --- v1->v2: keep the helper in pci-host-common.c --- drivers/pci/controller/pci-host-common.c | 11 +++ 1 file changed,

[PATCH v2 06/11] iommu/amd: Use pci_ats_supported()

2020-03-11 Thread Jean-Philippe Brucker
such as thunderbolt). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/amd_iommu.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index aac132bd1ef0..084f0b2e132e 100644 --- a/drivers/iommu/amd_iommu.c

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

2020-03-06 Thread Jean-Philippe Brucker
On Fri, Mar 06, 2020 at 10:52:45AM -0400, Jason Gunthorpe wrote: > On Fri, Mar 06, 2020 at 03:35:56PM +0100, Jean-Philippe Brucker wrote: > > On Fri, Mar 06, 2020 at 09:09:19AM -0400, Jason Gunthorpe wrote: > > > On Fri, Mar 06, 2020 at 10:56:14AM +0100, Jean-Philippe Brucke

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

2020-03-06 Thread Jean-Philippe Brucker
On Fri, Mar 06, 2020 at 09:09:19AM -0400, Jason Gunthorpe wrote: > On Fri, Mar 06, 2020 at 10:56:14AM +0100, Jean-Philippe Brucker wrote: > > I tried to keep it simple like that: normally mmu_notifier_get() is called > > in bind(), and mmu_notifier_put() is called in unbind(). &g

Re: [PATCH 00/14] iommu: Move iommu_fwspec out of 'struct device'

2020-03-06 Thread Jean-Philippe Brucker
On Fri, Mar 06, 2020 at 04:39:37PM +0800, Hanjun Guo wrote: > Hi Joerg, > > On 2020/2/28 23:08, Joerg Roedel wrote: > > Hi, > > > > here is a patch-set to rename iommu_param to dev_iommu and > > establish it as a struct for generic per-device iommu-data. > > Also move the iommu_fwspec pointer

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

2020-03-06 Thread Jean-Philippe Brucker
On Fri, Feb 28, 2020 at 11:13:40AM -0400, Jason Gunthorpe wrote: > On Fri, Feb 28, 2020 at 04:04:27PM +0100, Jean-Philippe Brucker wrote: > > On Fri, Feb 28, 2020 at 10:48:44AM -0400, Jason Gunthorpe wrote: > > > On Fri, Feb 28, 2020 at 03:39:35PM +0100, Jean-Phil

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

2020-03-04 Thread Jean-Philippe Brucker
On Wed, Mar 04, 2020 at 02:37:08PM +0100, Joerg Roedel wrote: > Hi Michael, > > On Tue, Mar 03, 2020 at 11:09:41AM -0500, Michael S. Tsirkin wrote: > > No. It's coded into the hardware. Which might even be practical > > for bare-metal (e.g. on-board flash), but is very practical > > when the

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

2020-03-04 Thread Jean-Philippe Brucker
On Thu, Feb 27, 2020 at 05:43:51PM +, Jonathan Cameron wrote: > On Mon, 24 Feb 2020 19:23:42 +0100 > Jean-Philippe Brucker wrote: > > > From: Jean-Philippe Brucker > > > > To enable address space sharing with the IOMMU, introduce mm_context_get() > > an

Re: [PATCH v4 23/26] iommu/arm-smmu-v3: Add stall support for platform devices

2020-03-04 Thread Jean-Philippe Brucker
On Wed, Feb 26, 2020 at 04:44:53PM +0800, Xu Zaibo wrote: > Hi, > > > On 2020/2/25 2:23, Jean-Philippe Brucker wrote: > > From: Jean-Philippe Brucker > > > > The SMMU provides a Stall model for handling page faults in platform > > devices. It is similar to

Re: [PATCH v4 23/26] iommu/arm-smmu-v3: Add stall support for platform devices

2020-03-04 Thread Jean-Philippe Brucker
On Thu, Feb 27, 2020 at 06:17:26PM +, Jonathan Cameron wrote: > On Mon, 24 Feb 2020 19:23:58 +0100 > Jean-Philippe Brucker wrote: > > > From: Jean-Philippe Brucker > > > > The SMMU provides a Stall model for handling page faults in platform > >

Re: [PATCH v12 2/4] uacce: add uacce driver

2020-03-03 Thread Jean-Philippe Brucker
On Mon, Feb 24, 2020 at 10:22:02AM -0800, Raj, Ashok wrote: > Hi Kenneth, > > sorry for waking up late on this patchset. > > > On Wed, Jan 15, 2020 at 10:12:46PM +0800, Zhangfei Gao wrote: > [... trimmed] > > > + > > +static int uacce_fops_open(struct inode *inode, struct file *filep) > > +{ >

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

2020-02-28 Thread Jean-Philippe Brucker
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/pci-driver.c

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

2020-02-28 Thread Jean-Philippe Brucker
Kconfig to select it. 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 f8cb45d84bb0..87efc48c244e 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig

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

2020-02-28 Thread Jean-Philippe Brucker
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 | 10

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

2020-02-28 Thread Jean-Philippe Brucker
[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: Enable x86 support MAINTAINERS | 2 + drivers/iom

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

2020-02-28 Thread Jean-Philippe Brucker
On Fri, Feb 28, 2020 at 10:48:44AM -0400, Jason Gunthorpe wrote: > On Fri, Feb 28, 2020 at 03:39:35PM +0100, Jean-Philippe Brucker wrote: > > > > + list_for_each_entry_rcu(bond, _mm->devices, mm_head) { > > > > + /* > > > > +

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

2020-02-28 Thread Jean-Philippe Brucker
On Wed, Feb 26, 2020 at 11:39:59AM -0800, Jacob Pan wrote: > > @@ -442,11 +444,20 @@ static void iommu_sva_unbind_locked(struct > > iommu_bond *bond) > > void iommu_sva_unbind_generic(struct iommu_sva *handle) > > { > > + int pasid; > > struct iommu_param *param =

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

2020-02-28 Thread Jean-Philippe Brucker
On Wed, Feb 26, 2020 at 01:59:33PM +, Jonathan Cameron wrote: > > +static int iopf_complete(struct device *dev, struct iopf_fault *iopf, > > +enum iommu_page_response_code status) > > This is called once per group. Should name reflect that? Ok [...] > > +/** > > + *

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

2020-02-28 Thread Jean-Philippe Brucker
On Wed, Feb 26, 2020 at 12:35:06PM +, Jonathan Cameron wrote: > > + * A single Process Address Space ID (PASID) is allocated for each mm. In > > the > > + * example, devices use PASID 1 to read/write into address space X and > > PASID 2 > > + * to read/write into address space Y. Calling

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

2020-02-28 Thread Jean-Philippe Brucker
my list to look at > On Mon, 24 Feb 2020 19:23:37 +0100 > Jean-Philippe Brucker wrote: > > > 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 >

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

2020-02-28 Thread Jean-Philippe Brucker
On Tue, Feb 25, 2020 at 10:08:14AM -0400, Jason Gunthorpe wrote: > On Tue, Feb 25, 2020 at 10:24:39AM +0100, Jean-Philippe Brucker wrote: > > On Mon, Feb 24, 2020 at 03:00:56PM -0400, Jason Gunthorpe wrote: > > > On Mon, Feb 24, 2020 at 07:23:36PM +0100, Jean-Phil

Re: [PATCH 2/2] iommu/vt-d: Replace intel SVM APIs with generic SVA APIs

2020-02-25 Thread Jean-Philippe Brucker
On Tue, Feb 25, 2020 at 11:10:34AM -0800, Christoph Hellwig wrote: > On Mon, Feb 24, 2020 at 03:26:37PM -0800, Jacob Pan wrote: > > This patch is an initial step to replace Intel SVM code with the > > following IOMMU SVA ops: > > intel_svm_bind_mm() => iommu_sva_bind_device() > >

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

2020-02-25 Thread Jean-Philippe Brucker
Hi Zaibo, On Tue, Feb 25, 2020 at 11:30:05AM +0800, Xu Zaibo wrote: > > +struct iopf_queue * > > +iopf_queue_alloc(const char *name, iopf_queue_flush_t flush, void *cookie) > > +{ > > + struct iopf_queue *queue; > > + > > + queue = kzalloc(sizeof(*queue), GFP_KERNEL); > > + if (!queue) > >

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

2020-02-25 Thread Jean-Philippe Brucker
On Mon, Feb 24, 2020 at 03:00:56PM -0400, Jason Gunthorpe wrote: > On Mon, Feb 24, 2020 at 07:23:36PM +0100, Jean-Philippe Brucker wrote: > > The new allocation scheme introduced by 2c7933f53f6b ("mm/mmu_notifiers: > > add a get/put scheme for the registration")

[PATCH v4 22/26] dt-bindings: document stall property for IOMMU masters

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker On ARM systems, some platform devices behind an IOMMU may support stall, which is the ability to recover from page faults. Let the firmware tell us when a device supports stall. Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- .../devicetree

[PATCH v4 24/26] PCI/ATS: Add PRI stubs

2020-02-24 Thread Jean-Philippe Brucker
f-by: Jean-Philippe Brucker --- include/linux/pci-ats.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index f75c307f346d..e9e266df9b37 100644 --- a/include/linux/pci-ats.h +++ b/include/linux/pci-ats.h @@ -28,6 +28,14 @@ int pci_enable_

[PATCH v4 18/26] iommu/arm-smmu-v3: Hook up ATC invalidation to mm ops

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker The core calls us when an mm is modified. Perform the required ATC invalidations. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 44 - 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers

[PATCH v4 25/26] PCI/ATS: Export symbols of PRI functions

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

[PATCH v4 23/26] iommu/arm-smmu-v3: Add stall support for platform devices

2020-02-24 Thread Jean-Philippe Brucker
From: Jean-Philippe Brucker The SMMU provides a Stall model for handling page faults in platform devices. It is similar to PCI PRI, but doesn't require devices to have their own translation cache. Instead, faulting transactions are parked and the OS is given a chance to fix the page tables

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

[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

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

[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, and can

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

2020-02-24 Thread Jean-Philippe Brucker
Signed-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/iommu/arm

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

[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 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 00/26] iommu: Shared Virtual Addressing and SMMUv3 support

2020-02-24 Thread Jean-Philippe Brucker
-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: Manage process address spaces

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

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

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

2020-02-17 Thread Jean-Philippe Brucker
nstead of > 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 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 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 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 > > platfor

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

[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

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

2020-02-14 Thread Jean-Philippe Brucker
/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: Enable x86 support

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

2020-02-14 Thread Jean-Philippe Brucker
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 | 10

[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 02/11] PCI: Add ats_supported host bridge flag

2020-02-13 Thread Jean-Philippe Brucker
. Signed-off-by: Jean-Philippe Brucker --- drivers/pci/probe.c | 7 +++ include/linux/pci.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 512cb4312ddd..75c0a25af44e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -598,6

[PATCH 04/11] ACPI/IORT: Check ATS capability in root complex node

2020-02-13 Thread Jean-Philippe Brucker
When initializing a PCI root bridge, copy its "ATS supported" attribute into the root bridge. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 27 +++ drivers/acpi/pci_root.c | 3 +++ include/linux/acpi_iort.h | 8 3 files c

[PATCH 09/11] ACPI/IORT: Drop ATS fwspec flag

2020-02-13 Thread Jean-Philippe Brucker
Now that the ats_supported flag is in the host bridge structure where it belongs, we can remove it from the per-device fwspec structure. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 11 --- include/linux/iommu.h | 4 2 files changed, 15 deletions

[PATCH 08/11] iommu/vt-d: Use pci_ats_supported()

2020-02-13 Thread Jean-Philippe Brucker
The pci_ats_supported() function checks if a device supports ATS and is allowed to use it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/intel-iommu.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c

[PATCH 01/11] dt-bindings: PCI: generic: Add ats-supported property

2020-02-13 Thread Jean-Philippe Brucker
-generic for the moment. For non-generic root controllers, availability of ATS can be inferred from the compatible string. Signed-off-by: Jean-Philippe Brucker --- Documentation/devicetree/bindings/pci/host-generic-pci.yaml | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation

[PATCH 06/11] iommu/amd: Use pci_ats_supported()

2020-02-13 Thread Jean-Philippe Brucker
such as thunderbolt). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/amd_iommu.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index aac132bd1ef0..084f0b2e132e 100644 --- a/drivers/iommu/amd_iommu.c

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

2020-02-13 Thread Jean-Philippe Brucker
Copy the ats-supported flag into the pci_host_bridge structure. Signed-off-by: Jean-Philippe Brucker --- drivers/pci/controller/pci-host-common.c | 1 + drivers/pci/of.c | 9 + include/linux/of_pci.h | 3 +++ 3 files changed, 13 insertions

[PATCH 05/11] PCI/ATS: Gather checks into pci_ats_supported()

2020-02-13 Thread Jean-Philippe Brucker
is trusted. Devices plugged into external-facing ports such as thunderbolt are untrusted. * whether the host bridge supports ATS, which defaults to true unless the firmware description states that ATS isn't supported by the host bridge. Signed-off-by: Jean-Philippe Brucker --- drivers/pci

[PATCH 07/11] iommu/arm-smmu-v3: Use pci_ats_supported()

2020-02-13 Thread Jean-Philippe Brucker
The new pci_ats_supported() function checks if a device supports ATS and is allowed to use it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu

[PATCH 11/11] Documentation: Generalize the "pci=noats" boot parameter

2020-02-13 Thread Jean-Philippe Brucker
The "pci=noats" kernel parameter disables PCIe ATS globally, and affects any ATS-capable IOMMU driver. So rather than adding Arm SMMUv3, which recently gained ATS support, to the list of relevant build options, simplify the noats description. Signed-off-by: Jean-Philip

[PATCH 10/11] arm64: dts: fast models: Enable PCIe ATS for Base RevC FVP

2020-02-13 Thread Jean-Philippe Brucker
Declare that the host controller supports ATS, so the OS can enable it for ATS-capable PCIe endpoints. Signed-off-by: Jean-Philippe Brucker --- All endpoints support ATS provided they have the ats_supported=1 model parameter. "lspci -vv" shows whether ATS is supported and enabled.

[PATCH 00/10] PCI/ATS: Device-tree support and other improvements

2020-02-13 Thread Jean-Philippe Brucker
ats_supported host bridge property for IORT. Patch 9 removes the old method that set a flag in each endpoint's fwspec. Patches 5-8 put all checks required for enabling ATS in common, along with the new host bridge check. Jean-Philippe Brucker (11): dt-bindings: PCI: generic: Add ats-supported

[PATCH 4/4] iommu/arm-smmu-v3: Write level-1 descriptors atomically

2020-02-13 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 changed

[PATCH 0/4] iommu: Finish off PASID support for Arm SMMUv3

2020-02-13 Thread Jean-Philippe Brucker
e, another feature introduced in Linux v5.6. Export the relevant symbols in patch 1 before using them in patch 2. Patches 3 and 4 address the other remaining comments for the PASID series [1]. [1] https://lore.kernel.org/linux-iommu/20200114154007.GC2579@willie-the-truck/ Jean-Philippe Brucker (4):

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

2020-02-13 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 3/4] iommu/arm-smmu-v3: Batch context descriptor invalidation

2020-02-13 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 | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers

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

2020-02-13 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

Re: [PATCH 3/3] iommu/uapi: Add helper function for size lookup

2020-02-07 Thread Jean-Philippe Brucker
On Mon, Feb 03, 2020 at 02:41:02PM -0800, Jacob Pan wrote: > Yeah, that would work as well. I just feel IOMMU UAPI is unlikely to get > updated frequently, should be much less than adding new capabilities. > I think argsz could be viewed as the version field set by the > user, minsz is what kernel

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

2020-01-22 Thread Jean-Philippe Brucker
nstead of > one-by-one. > > Cc: Jean-Philippe Brucker > Cc: Will Deacon > Cc: Robin Murphy > Cc: Joerg Roedel > Signed-off-by: Rob Herring > --- > drivers/iommu/arm-smmu-v3.c | 23 +++ > 1 file changed, 19 insertions(+), 4 deletions(-) > > di

Re: [PATCH v5 00/13] iommu: Add PASID support to Arm SMMUv3

2020-01-15 Thread Jean-Philippe Brucker
On Wed, Jan 15, 2020 at 04:42:56PM +, Will Deacon wrote: > On Wed, Jan 15, 2020 at 01:52:26PM +0100, Jean-Philippe Brucker wrote: > > Since v4 [1] I addressed some of Will's comment. > > Thanks! I've tentatively managed to queue all of this apart from the last > patch,

[PATCH v5 05/13] iommu/arm-smmu-v3: Prepare arm_smmu_s1_cfg for SSID support

2020-01-15 Thread Jean-Philippe Brucker
When adding SSID support to the SMMUv3 driver, we'll need to manipulate leaf pasid tables and context descriptors. Extract the context descriptor structure and align with the way stream tables are handled. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 46

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

2020-01-15 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 v5 06/13] iommu/arm-smmu-v3: Add context descriptor tables allocators

2020-01-15 Thread Jean-Philippe Brucker
Support for SSID will require allocating context descriptor tables. Move the context descriptor allocation to separate functions. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 47 +++-- 1 file changed, 34 insertions(+), 13 deletions

[PATCH v5 08/13] iommu/arm-smmu-v3: Propagate ssid_bits

2020-01-15 Thread Jean-Philippe Brucker
size is less of a concern, since the PCIe specification "highly recommends" that devices supporting PASID implement all 20 bits of it. Tested-by: Zhangfei Gao Reviewed-by: Eric Auger Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu

[PATCH v5 00/13] iommu: Add PASID support to Arm SMMUv3

2020-01-15 Thread Jean-Philippe Brucker
should be good to go, but anything in between would be good too, and I'll send the rest for 5.7. Thanks, Jean [1] https://lore.kernel.org/linux-iommu/20191219163033.2608177-1-jean-phili...@linaro.org/ Jean-Philippe Brucker (13): iommu/arm-smmu-v3: Drop __GFP_ZERO flag from DMA allocation dt

[PATCH v5 12/13] PCI/ATS: Add PASID stubs

2020-01-15 Thread Jean-Philippe Brucker
Reviewed-by: Eric Auger Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- include/linux/pci-ats.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index 5d62e78946a3..d08f0869f121 100644 --- a/include/linux/pci-ats.h +++

[PATCH v5 07/13] iommu/arm-smmu-v3: Add support for Substream IDs

2020-01-15 Thread Jean-Philippe Brucker
th stream and page tables, an SSID can be split to index multiple levels of tables. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 135 ++-- 1 file changed, 112 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/i

[PATCH v5 10/13] iommu/arm-smmu-v3: Add second level of context descriptor table

2020-01-15 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 v5 01/13] iommu/arm-smmu-v3: Drop __GFP_ZERO flag from DMA allocation

2020-01-15 Thread Jean-Philippe Brucker
vert DMA buffer allocations to the managed API"), since the managed API didn't provide a dmam_zalloc_coherent() function. Reviewed-by: Eric Auger Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 9 - 1 file changed, 4 insertions(+),

[PATCH v5 03/13] iommu/arm-smmu-v3: Parse PASID devicetree property of platform devices

2020-01-15 Thread Jean-Philippe Brucker
ean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 13 + drivers/iommu/of_iommu.c| 6 +- include/linux/iommu.h | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index d4e8b7f8d

[PATCH v5 11/13] iommu/arm-smmu-v3: Improve add_device() error handling

2020-01-15 Thread Jean-Philippe Brucker
the hassle since they are managed resources. Reviewed-by: Eric Auger Reviewed-by: Jonathan Cameron 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

[PATCH v5 09/13] iommu/arm-smmu-v3: Prepare for handling arm_smmu_write_ctx_desc() failure

2020-01-15 Thread Jean-Philippe Brucker
Second-level context descriptor tables will be allocated lazily in arm_smmu_write_ctx_desc(). Help with handling allocation failure by moving the CD write into arm_smmu_domain_finalise_s1(). Reviewed-by: Eric Auger Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers

<    3   4   5   6   7   8   9   10   11   12   >