[PATCH v3 00/10] Support using MSI interrupts in ntb_transport

2019-03-21 Thread Logan Gunthorpe
This is version 3 of the MSI interrupts for ntb_transport patchset. I've addressed the feedback so far and rebased on the latest kernel and would like this to be considered for merging this cycle. The only outstanding issue I know of is that it still will not work with IDT hardware, but

[PATCH v3 10/10] NTB: Describe the ntb_msi_test client in the documentation.

2019-03-21 Thread Logan Gunthorpe
Add a blurb in Documentation/ntb.txt to describe the ntb_msi_test tool's debugfs interface. Similar to the (out of date) ntb_tool description. Signed-off-by: Logan Gunthorpe --- Documentation/ntb.txt | 27 +++ 1 file changed, 27 insertions(+) diff --git

[PATCH v3 09/10] NTB: Add MSI interrupt support to ntb_transport

2019-03-21 Thread Logan Gunthorpe
Introduce the module parameter 'use_msi' which, when set uses MSI interrupts instead of doorbells for each queue pair (QP). T he parameter is only available if NTB MSI support is configured into the kernel. We also require there to be more than one memory window (MW) so that an extra one is

[PATCH v3 07/10] NTB: Introduce NTB MSI Test Client

2019-03-21 Thread Logan Gunthorpe
Introduce a tool to test NTB MSI interrupts similar to the other NTB test tools. This tool creates a debugfs directory for each NTB device with the following files: port irqX_occurrences peerX/port peerX/count peerX/trigger The 'port' file tells the user the local port number and the

[PATCH v3 08/10] NTB: Add ntb_msi_test support to ntb_test

2019-03-21 Thread Logan Gunthorpe
When the ntb_msi_test module is available, the test code will trigger each of the interrupts and ensure the corresponding occurrences files gets incremented. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- tools/testing/selftests/ntb/ntb_test.sh | 54

[PATCH v3 05/10] NTB: Rename ntb.c to support multiple source files in the module

2019-03-21 Thread Logan Gunthorpe
The kbuild system does not support having multiple source files in a module if one of those source files has the same name as the module. Therefore, we must rename ntb.c to core.c, while the module remains ntb.ko. This is similar to the way the nvme modules are structured. Signed-off-by: Logan

[PATCH v3 02/10] PCI/switchtec: Add module parameter to request more interrupts

2019-03-21 Thread Logan Gunthorpe
Seeing the we want to use more interrupts in the NTB MSI code we need to be able allocate more (sometimes virtual) interrupts in the switchtec driver. Therefore add a module parameter to request to allocate additional interrupts. This puts virtually no limit on the number of MSI interrupts

[PATCH v3 01/10] PCI/MSI: Support allocating virtual MSI interrupts

2019-03-21 Thread Logan Gunthorpe
For NTB devices, we want to be able to trigger MSI interrupts through a memory window. In these cases we may want to use more interrupts than the NTB PCI device has available in its MSI-X table. We allow for this by creating a new 'virtual' interrupt. These interrupts are allocated as usual but

[PATCH v3 03/10] NTB: Introduce helper functions to calculate logical port number

2019-03-21 Thread Logan Gunthorpe
This patch introduces the "Logical Port Number" which is similar to the "Port Number" in that it enumerates the ports in the system. The original (or Physical) "Port Number" can be any number used by the hardware to uniquley identify a port in the system. The "Logical Port Number" enumerates all

Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-03-21 Thread Thiago Jung Bauermann
Michael S. Tsirkin writes: > On Wed, Mar 20, 2019 at 01:13:41PM -0300, Thiago Jung Bauermann wrote: >> >> Another way of looking at this issue which also explains our reluctance >> >> is that the only difference between a secure guest and a regular guest >> >> (at least regarding virtio) is

Re: [PATCH v2 RFC/RFT] dma-contiguous: Get normal pages for single-page allocations

2019-03-21 Thread Nicolin Chen
Hi Catalin, Thank you for the review. And I realized that the free() path is missing too. On Tue, Mar 19, 2019 at 02:43:01PM +, Catalin Marinas wrote: > On Tue, Mar 05, 2019 at 10:32:02AM -0800, Nicolin Chen wrote: > > The addresses within a single page are always contiguous, so it's > > not

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

2019-03-21 Thread Alex Williamson
On Sun, 17 Mar 2019 18:22:19 +0100 Eric Auger wrote: > This patch adds the VFIO_IOMMU_BIND/UNBIND_MSI ioctl which aim > to pass/withdraw the guest MSI binding to/from the host. > > Signed-off-by: Eric Auger > > --- > v3 -> v4: > - add UNBIND > - unwind on BIND error > > v2 -> v3: > - adapt

[PATCH 5/7] arm: use a dummy struct device for ISA DMA use of the DMA API

2019-03-21 Thread Christoph Hellwig
This gets rid of the last NULL dev argument passed to the DMA API. Signed-off-by: Christoph Hellwig --- arch/arm/kernel/dma-isa.c | 8 +++- arch/arm/mach-rpc/dma.c | 8 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/dma-isa.c

[PATCH 7/7] x86: remove the x86_dma_fallback_dev hack

2019-03-21 Thread Christoph Hellwig
Now that we removed support for the NULL device argument in the DMA API, there is no need to cater for that in the x86 code. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/dma-mapping.h | 10 -- arch/x86/kernel/amd_gart_64.c | 6 -- arch/x86/kernel/pci-dma.c

[PATCH 6/7] dma-mapping: remove leftover NULL device support

2019-03-21 Thread Christoph Hellwig
Most dma_map_ops implementations already had some issues with a NULL device, or did simply crash if one was fed to them. Now that we have cleaned up all the obvious offenders we can stop to pretend we support this mode. Signed-off-by: Christoph Hellwig --- Documentation/DMA-API-HOWTO.txt | 13

[PATCH 1/7] parport_ip32: pass struct device to DMA API functions

2019-03-21 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig --- drivers/parport/parport_ip32.c | 18 ++

remove NULL struct device support in the DMA API

2019-03-21 Thread Christoph Hellwig
We still have a few drivers which pass a NULL struct device pointer to DMA API functions, which generally is a bad idea as the API implementations rely on the device not only for ops selection, but also the dma mask and various other attributes, and many implementations have been broken for NULL

[PATCH 3/7] gbefb: switch to managed version of the DMA allocator

2019-03-21 Thread Christoph Hellwig
gbefb uses managed resources, so it should do the same for DMA allocations. Signed-off-by: Christoph Hellwig --- drivers/video/fbdev/gbefb.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c

[PATCH 2/7] da8xx-fb: pass struct device to DMA API functions

2019-03-21 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig --- drivers/video/fbdev/da8xx-fb.c | 13 +++-- 1

[PATCH 4/7] pxa3xx-gcu: pass struct device to dma_mmap_coherent

2019-03-21 Thread Christoph Hellwig
Just like we do for all other DMA operations. Signed-off-by: Christoph Hellwig --- drivers/video/fbdev/pxa3xx-gcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 69cfb337c857..047a2fa4b87e 100644

Re: [PATCH v6 08/22] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2019-03-21 Thread Alex Williamson
On Sun, 17 Mar 2019 18:22:18 +0100 Eric Auger wrote: > From: "Liu, Yi L" > > When the guest "owns" the stage 1 translation structures, the host > IOMMU driver has no knowledge of caching structure updates unless > the guest invalidation requests are trapped and passed down to the > host. > >

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

2019-03-21 Thread Alex Williamson
On Sun, 17 Mar 2019 18:22:17 +0100 Eric Auger wrote: > From: "Liu, Yi L" > > This patch adds VFIO_IOMMU_ATTACH/DETACH_PASID_TABLE ioctl > which aims to pass/withdraw the virtual iommu guest configuration > to/from the VFIO driver downto to the iommu subsystem. > > Signed-off-by: Jacob Pan >

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

2019-03-21 Thread Jacob Pan
On Thu, 21 Mar 2019 15:32:45 +0100 Auger Eric wrote: > Hi jean, Jacob, > > On 3/21/19 3:13 PM, Jean-Philippe Brucker wrote: > > On 21/03/2019 13:54, Auger Eric wrote: > >> Hi Jacob, Jean-Philippe, > >> > >> On 3/20/19 5:50 PM, Jean-Philippe Brucker wrote: > >>> On 20/03/2019 16:37, Jacob

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

2019-03-21 Thread Jacob Pan
On Sun, 17 Mar 2019 18:22:12 +0100 Eric Auger wrote: > From: Jacob Pan > > Device faults detected by IOMMU can be reported outside the IOMMU > subsystem for further processing. This patch introduces > a generic device fault data structure. > > The fault can be either an unrecoverable fault or

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

2019-03-21 Thread Alex Williamson
On Sun, 17 Mar 2019 18:22:13 +0100 Eric Auger 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 > related transactions are detected by IOMMU. There is no generic > reporting

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

2019-03-21 Thread Sinan Kaya
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, ); + + if (!err && !iort_pci_rc_supports_ats(node)) + dev->iommu_fwspec->flags |=

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

2019-03-21 Thread Sinan Kaya
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() validates this via. if (!dev->ats_cap) return -EINVAL;

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

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

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_ADDR_FLAGS_PASID(1 << 0) +#define

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

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