[PATCH] iommu/vt-d: Implement dma_[un]map_resource()

2019-01-18 Thread Logan Gunthorpe
ingle(). dma_unmap_resource() uses intel_unmap_page() directly as the functions are identical. Signed-off-by: Logan Gunthorpe Cc: David Woodhouse Cc: Joerg Roedel --- drivers/iommu/intel-iommu.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/

Re: [PATCH] iommu/vt-d: Implement dma_[un]map_resource()

2019-01-19 Thread Logan Gunthorpe
On 2019-01-19 2:40 a.m., Christoph Hellwig wrote: > Which resources do you plan to map? At least for PCIe P2P adding > an address translation seems wrong to me. It's mapping a PCI BAR but not for PCIe P2P. In this case, we are using the Intel I/OAT DMA engine to copy data from a PCI BAR to/fro

[PATCH v2] iommu/vt-d: Implement dma_[un]map_resource()

2019-01-22 Thread Logan Gunthorpe
ingle(). dma_unmap_resource() uses intel_unmap_page() directly as the functions are identical. Signed-off-by: Logan Gunthorpe Cc: David Woodhouse Cc: Joerg Roedel --- Changes in v2: * Revert to a single __intel_map_single() helper instead of having a second small __intel_map_page() helper. As request

Re: [RFC PATCH 1/5] pci/p2p: add a function to test peer to peer capability

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 10:47 a.m., jgli...@redhat.com wrote: > +bool pci_test_p2p(struct device *devA, struct device *devB) > +{ > + struct pci_dev *pciA, *pciB; > + bool ret; > + int tmp; > + > + /* > + * For now we only support PCIE peer to peer but other inter-connect > + * c

Re: [RFC PATCH 2/5] drivers/base: add a function to test peer to peer capability

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 10:47 a.m., jgli...@redhat.com wrote: > From: Jérôme Glisse > > device_test_p2p() return true if two devices can peer to peer to > each other. We add a generic function as different inter-connect > can support peer to peer and we want to genericaly test this no > matter what the i

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 10:47 a.m., jgli...@redhat.com wrote: > + /* > + * Optional for device driver that want to allow peer to peer (p2p) > + * mapping of their vma (which can be back by some device memory) to > + * another device. > + * > + * Note that the exporting device

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 12:11 p.m., Jerome Glisse wrote: > On Tue, Jan 29, 2019 at 11:36:29AM -0700, Logan Gunthorpe wrote: >> >> >> On 2019-01-29 10:47 a.m., jgli...@redhat.com wrote: >> >>> + /* >>> +* Optional for device driver that want to allow p

Re: [RFC PATCH 1/5] pci/p2p: add a function to test peer to peer capability

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 12:56 p.m., Alex Deucher wrote: > On Tue, Jan 29, 2019 at 12:47 PM wrote: >> >> From: Jérôme Glisse >> >> device_test_p2p() return true if two devices can peer to peer to >> each other. We add a generic function as different inter-connect >> can support peer to peer and we want to

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 12:32 p.m., Jason Gunthorpe wrote: > Jerome, I think it would be nice to have a helper scheme - I think the > simple case would be simple remapping of PCI BAR memory, so if we > could have, say something like: > > static const struct vm_operations_struct my_ops { > .p2p_map = p2

Re: [RFC PATCH 1/5] pci/p2p: add a function to test peer to peer capability

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 12:44 p.m., Greg Kroah-Hartman wrote: > On Tue, Jan 29, 2019 at 11:24:09AM -0700, Logan Gunthorpe wrote: >> >> >> On 2019-01-29 10:47 a.m., jgli...@redhat.com wrote: >>> +bool pci_test_p2p(struct device *devA, struct device *devB) >>>

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 12:44 p.m., Jerome Glisse wrote: >> I'd suggest [1] should be a part of the patchset so we can actually see >> a user of the stuff you're adding. > > I did not wanted to clutter patchset with device driver specific usage > of this. As the API can be reason about in abstract way.

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 1:57 p.m., Jerome Glisse wrote: > GPU driver must be in control and must be call to. Here there is 2 cases > in this patchset and i should have instead posted 2 separate patchset as > it seems that it is confusing things. > > For the HMM page, the physical address of the page ie t

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 2:50 p.m., Jerome Glisse wrote: > No this is the non HMM case i am talking about here. Fully ignore HMM > in this frame. A GPU driver that do not support or use HMM in anyway > has all the properties and requirement i do list above. So all the points > i was making are without HMM

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-29 Thread Logan Gunthorpe
On 2019-01-29 4:47 p.m., Jerome Glisse wrote: > The whole point is to allow to use device memory for range of virtual > address of a process when it does make sense to use device memory for > that range. So they are multiple cases where it does make sense: > [1] - Only the device is accessing th

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-29 9:18 p.m., Jason Gunthorpe wrote: > Every attempt to give BAR memory to struct page has run into major > trouble, IMHO, so I like that this approach avoids that. > > And if you don't have struct page then the only kernel object left to > hang meta data off is the VMA itself. > >

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 10:26 a.m., Christoph Hellwig wrote: > On Wed, Jan 30, 2019 at 10:55:43AM -0500, Jerome Glisse wrote: >> Even outside GPU driver, device driver like RDMA just want to share their >> doorbell to other device and they do not want to see those doorbell page >> use in direct I/O or any

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 10:44 a.m., Jason Gunthorpe wrote: > I don't see why a special case with a VMA is really that different. Well one *really* big difference is the VMA changes necessarily expose specialized new functionality to userspace which has to be supported forever and may be difficult to chan

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 12:06 p.m., Jason Gunthorpe wrote: >> Way less problems than not having struct page for doing anything >> non-trivial. If you map the BAR to userspace with remap_pfn_range >> and friends the mapping is indeed very simple. But any operation >> that expects a page structure, which

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 12:19 p.m., Jason Gunthorpe wrote: > On Wed, Jan 30, 2019 at 11:13:11AM -0700, Logan Gunthorpe wrote: >> >> >> On 2019-01-30 10:44 a.m., Jason Gunthorpe wrote: >>> I don't see why a special case with a VMA is really that different. >> >&

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 12:22 p.m., Jerome Glisse wrote: > On Wed, Jan 30, 2019 at 06:56:59PM +, Jason Gunthorpe wrote: >> On Wed, Jan 30, 2019 at 10:17:27AM -0700, Logan Gunthorpe wrote: >>> >>> >>> On 2019-01-29 9:18 p.m., Jason Gunthorpe wrote: >>>>

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 12:38 p.m., Jason Gunthorpe wrote: > On Wed, Jan 30, 2019 at 02:22:34PM -0500, Jerome Glisse wrote: > >> For GPU it would not work, GPU might want to use main memory (because >> it is running out of BAR space) it is a lot easier if the p2p_map >> callback calls the right dma map f

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 12:59 p.m., Jason Gunthorpe wrote: > On Wed, Jan 30, 2019 at 12:45:46PM -0700, Logan Gunthorpe wrote: >> >> >> On 2019-01-30 12:06 p.m., Jason Gunthorpe wrote: >>>> Way less problems than not having struct page for doing anything >>>>

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-30 Thread Logan Gunthorpe
On 2019-01-30 2:50 p.m., Jason Gunthorpe wrote: > On Wed, Jan 30, 2019 at 02:01:35PM -0700, Logan Gunthorpe wrote: > >> And I feel the GUP->SGL->DMA flow should still be what we are aiming >> for. Even if we need a special GUP for special pages, and a special DMA >&

[PATCH 3/9] PCI/switchtec: Add module parameter to request more interrupts

2019-01-31 Thread Logan Gunthorpe
available to NTB clients. Signed-off-by: Logan Gunthorpe Cc: Bjorn Helgaas --- drivers/pci/switch/switchtec.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index e22766c79fe9..8b1db78197d9 100644 --- a

[PATCH 8/9] NTB: Add ntb_msi_test support to ntb_test

2019-01-31 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 7/9] NTB: Introduce NTB MSI Test Client

2019-01-31 Thread Logan Gunthorpe
mber of local interrupts. By default this is 4. This is only limited by the number of unused MSI interrupts registered by the hardware (this will require support of the hardware driver) and there must be at least 2*num_irqs + 1 spads registers available. Signed-off-by: Logan Gunthorpe Cc: Jon Mason

[PATCH 9/9] NTB: Add MSI interrupt support to ntb_transport

2019-01-31 Thread Logan Gunthorpe
d 14.1Gb/s which is a more than 3x improvement. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/ntb_transport.c | 134 +++- 1 file changed, 133 insertions(+), 1 deletion(-) diff --git a/drivers/ntb/ntb_transport.c b/d

[PATCH 6/9] NTB: Introduce MSI library

2019-01-31 Thread Logan Gunthorpe
the interrupt. The triggering peer, once having received the descriptor, can trigger the interrupt by calling ntb_msi_peer_trigger(). Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/Kconfig | 10 ++ drivers/ntb/Makefile | 3 +- drivers/ntb/msi.c

[PATCH 4/9] NTB: Introduce functions to calculate multi-port resource index

2019-01-31 Thread Logan Gunthorpe
peer resource number that will correspond with the local peer index on the remote peer. Also, introduce ntb_peer_highest_mw_idx() which will use ntb_peer_resource_idx() but return the MW index starting with the highest index and working down. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave

[PATCH 5/9] NTB: Rename ntb.c to support multiple source files in the module

2019-01-31 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 2/9] PCI/MSI: Support allocating virtual MSI interrupts

2019-01-31 Thread Logan Gunthorpe
usual but are not programmed into the MSI-X table (as there may not be space for them). The MSI address and data will then handled through an NTB MSI library introduced later in this series. Signed-off-by: Logan Gunthorpe Cc: Bjorn Helgaas --- drivers/pci/ms

[PATCH 0/9] Support using MSI interrupts in ntb_transport

2019-01-31 Thread Logan Gunthorpe
is available here: https://github.com/sbates130272/linux-p2pmem/ ntb_transport_msi_v1 Thanks, Logan -- Logan Gunthorpe (9): iommu/vt-d: Allow interrupts from the entire bus for aliased devices PCI/MSI: Support allocating virtual MSI interrupts PCI/switchtec: Add module parameter to requ

[PATCH 1/9] iommu/vt-d: Allow interrupts from the entire bus for aliased devices

2019-01-31 Thread Logan Gunthorpe
When a device has multiple aliases that all are from the same bus, we program the IRTE to accept requests from any matching device on the bus. This is so NTB devices which can have requests from multiple bus-devfns can pass MSI interrupts through across the bridge. Signed-off-by: Logan Gunthorpe

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 12:02 p.m., Jason Gunthorpe wrote: > I still think the right direction is to build on what Logan has done - > realize that he created a DMA-only SGL - make that a formal type of > the kernel and provide the right set of APIs to work with this type, > without being forced to expose

Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 12:35 p.m., Jerome Glisse wrote: > So what is this O_DIRECT thing that keep coming again and again here :) > What is the use case ? Note that bio will always have valid struct page > of regular memory as using PCIE BAR for filesystem is crazy (you do not > have atomic or cache cohe

Re: [PATCH 0/9] Support using MSI interrupts in ntb_transport

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 1:20 p.m., Dave Jiang wrote: > Does this work when the system moves the MSI vector either via software > (irqbalance) or BIOS APIC programming (some modes cause round robin > behavior)? I don't know how irqbalance works, and I'm not sure what you are referring to by BIOS APIC p

Re: [PATCH 0/9] Support using MSI interrupts in ntb_transport

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 1:58 p.m., Dave Jiang wrote: > > On 1/31/2019 1:48 PM, Logan Gunthorpe wrote: >> >> On 2019-01-31 1:20 p.m., Dave Jiang wrote: >>> Does this work when the system moves the MSI vector either via software >>> (irqbalance) or BIOS APIC progr

Re: [PATCH 2/9] PCI/MSI: Support allocating virtual MSI interrupts

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 3:39 p.m., Bjorn Helgaas wrote: > I assume you'll merge this along with the rest of the series, so: > > Acked-by: Bjorn Helgaas Thanks! >> diff --git a/include/linux/msi.h b/include/linux/msi.h >> index 784fb52b9900..6458ab049852 100644 >> --- a/include/linux/msi.h >> +++ b/inc

Re: [PATCH 0/9] Support using MSI interrupts in ntb_transport

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 3:46 p.m., Dave Jiang wrote: > I believe irqbalance writes to the file /proc/irq/N/smp_affinity. So > maybe take a look at the code that starts from there and see if it would > have any impact on your stuff. Ok, well on my system I can write to the smp_affinity all day and the M

Re: [PATCH 0/9] Support using MSI interrupts in ntb_transport

2019-01-31 Thread Logan Gunthorpe
On 2019-01-31 4:48 p.m., Dave Jiang wrote: > > On 1/31/2019 4:41 PM, Logan Gunthorpe wrote: >> >> On 2019-01-31 3:46 p.m., Dave Jiang wrote: >>> I believe irqbalance writes to the file /proc/irq/N/smp_affinity. So >>> maybe take a look at the code that s

Re: [PATCH 1/9] iommu/vt-d: Allow interrupts from the entire bus for aliased devices

2019-02-01 Thread Logan Gunthorpe
On 2019-02-01 9:44 a.m., Joerg Roedel wrote: > On Thu, Jan 31, 2019 at 11:56:48AM -0700, Logan Gunthorpe wrote: >> @@ -394,6 +402,10 @@ static int set_msi_sid(struct irte *irte, struct >> pci_dev *dev) >> set_irte_sid(irte, SVT_

Re: [PATCH 1/9] iommu/vt-d: Allow interrupts from the entire bus for aliased devices

2019-02-05 Thread Logan Gunthorpe
On 2019-02-05 12:19 p.m., Jacob Pan wrote: > On Fri, 1 Feb 2019 10:27:29 -0700 > Logan Gunthorpe wrote: > >> On 2019-02-01 9:44 a.m., Joerg Roedel wrote: >>> On Thu, Jan 31, 2019 at 11:56:48AM -0700, Logan Gunthorpe wrote: >>>> @@ -394,6 +402,10 @@ stat

[PATCH v2 07/12] NTB: Introduce functions to calculate multi-port resource index

2019-02-13 Thread Logan Gunthorpe
peer resource number that will correspond with the local peer index on the remote peer. Also, introduce ntb_peer_highest_mw_idx() which will use ntb_peer_resource_idx() but return the MW index starting with the highest index and working down. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave

[PATCH v2 02/12] NTB: ntb_transport: Ensure the destination buffer is mapped for TX DMA

2019-02-13 Thread Logan Gunthorpe
/ Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/ntb_transport.c | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 3bfdb4562408..526b65afc16a

[PATCH v2 11/12] NTB: Add ntb_msi_test support to ntb_test

2019-02-13 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 v2 00/12] Support using MSI interrupts in ntb_transport

2019-02-13 Thread Logan Gunthorpe
-p2pmem/ ntb_transport_msi_v2 Thanks, Logan -- Logan Gunthorpe (12): iommu/vt-d: Implement dma_[un]map_resource() NTB: ntb_transport: Ensure the destination buffer is mapped for TX DMA iommu/vt-d: Add helper to set an IRTE to verify only the bus number iommu/vt-d: Allow interrupts from

[PATCH v2 04/12] iommu/vt-d: Allow interrupts from the entire bus for aliased devices

2019-02-13 Thread Logan Gunthorpe
When a device has multiple aliases that all are from the same bus, we program the IRTE to accept requests from any matching device on the bus. This is so NTB devices which can have requests from multiple bus-devfns can pass MSI interrupts through across the bridge. Signed-off-by: Logan Gunthorpe

[PATCH v2 12/12] NTB: Add MSI interrupt support to ntb_transport

2019-02-13 Thread Logan Gunthorpe
d 14.1Gb/s which is a more than 3x improvement. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/ntb_transport.c | 169 +++- 1 file changed, 168 insertions(+), 1 deletion(-) diff --git a/drivers/ntb/ntb_transport.c b/d

[PATCH v2 08/12] NTB: Rename ntb.c to support multiple source files in the module

2019-02-13 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 v2 03/12] iommu/vt-d: Add helper to set an IRTE to verify only the bus number

2019-02-13 Thread Logan Gunthorpe
called a second time in an subsequent patch. Signed-off-by: Logan Gunthorpe Cc: David Woodhouse Cc: Joerg Roedel Cc: Jacob Pan --- drivers/iommu/intel_irq_remapping.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel_irq_remapping.c b

[PATCH v2 01/12] iommu/vt-d: Implement dma_[un]map_resource()

2019-02-13 Thread Logan Gunthorpe
ingle(). dma_unmap_resource() uses intel_unmap_page() directly as the functions are identical. Signed-off-by: Logan Gunthorpe Cc: David Woodhouse Cc: Joerg Roedel --- drivers/iommu/intel-iommu.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/

[PATCH v2 05/12] PCI/MSI: Support allocating virtual MSI interrupts

2019-02-13 Thread Logan Gunthorpe
usual but are not programmed into the MSI-X table (as there may not be space for them). The MSI address and data will then handled through an NTB MSI library introduced later in this series. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/ms

[PATCH v2 10/12] NTB: Introduce NTB MSI Test Client

2019-02-13 Thread Logan Gunthorpe
mber of local interrupts. By default this is 4. This is only limited by the number of unused MSI interrupts registered by the hardware (this will require support of the hardware driver) and there must be at least 2*num_irqs + 1 spads registers available. Signed-off-by: Logan Gunthorpe Cc: Jon Mason

[PATCH v2 06/12] PCI/switchtec: Add module parameter to request more interrupts

2019-02-13 Thread Logan Gunthorpe
available to NTB clients. Signed-off-by: Logan Gunthorpe Cc: Bjorn Helgaas --- drivers/pci/switch/switchtec.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index e22766c79fe9..8b1db78197d9 100644 --- a

[PATCH v2 09/12] NTB: Introduce MSI library

2019-02-13 Thread Logan Gunthorpe
the interrupt. The triggering peer, once having received the descriptor, can trigger the interrupt by calling ntb_msi_peer_trigger(). Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/Kconfig | 11 ++ drivers/ntb/Makefile | 3 +- drivers/ntb/msi.c

Re: [PATCH v2 01/12] iommu/vt-d: Implement dma_[un]map_resource()

2019-02-13 Thread Logan Gunthorpe
Oops, sorry. Please ignore the first two patches in this series. They have already been merged independently. Logan On 2019-02-13 10:54 a.m., Logan Gunthorpe wrote: > Currently the Intel IOMMU uses the default dma_[un]map_resource() > implementations does nothing and simply retur

Re: [PATCH v2 00/12] Support using MSI interrupts in ntb_transport

2019-02-26 Thread Logan Gunthorpe
On 2019-02-26 2:34 a.m., Joerg Roedel wrote: > On Wed, Feb 13, 2019 at 10:54:42AM -0700, Logan Gunthorpe wrote: >> iommu/vt-d: Add helper to set an IRTE to verify only the bus number >> iommu/vt-d: Allow interrupts from the entire bus for aliased devices > > Applied t

Re: [PATCH v2 07/12] NTB: Introduce functions to calculate multi-port resource index

2019-03-06 Thread Logan Gunthorpe
On 2019-03-05 6:24 p.m., Serge Semin wrote: >> + * In a 5 peer system, this function will return the following matrix >> + * >> + * pidx \ port01234 >> + * 0 00123 >> + * 1 01234 >> + * 2 0123

Re: [PATCH v2 09/12] NTB: Introduce MSI library

2019-03-06 Thread Logan Gunthorpe
On 2019-03-06 1:26 p.m., Serge Semin wrote: > First of all, It might be unsafe to have some resources consumed by NTB > MSI or some other library without a simple way to warn NTB client drivers > about their attempts to access that resources, since it might lead to random > errors. When I though

Re: [PATCH v2 10/12] NTB: Introduce NTB MSI Test Client

2019-03-06 Thread Logan Gunthorpe
On 2019-03-06 1:44 p.m., Serge Semin wrote: > Alas the test driver is not going to work with IDT NTB hardware, > since it uses Spad only, which aren't supported by IDT devices. IDT NTB > PCIe functions provide message registers to communicate with peers. See > ntb_perf driver code for reference

Re: [PATCH v2 07/12] NTB: Introduce functions to calculate multi-port resource index

2019-03-06 Thread Logan Gunthorpe
On 2019-03-06 3:45 p.m., Serge Semin wrote: [Snip] Pretty sure everything above is just agreement... > So your current approach is inbound MW-centralized, while mine is developed > around the outbound MWs. I don't think this has anything to do with inbound vs outbound. The problem is the sa

Re: [PATCH v2 07/12] NTB: Introduce functions to calculate multi-port resource index

2019-03-12 Thread Logan Gunthorpe
On 2019-03-12 2:42 p.m., Serge Semin wrote: > If you don't want to add a large semantic and infrastructure change at > this point, then it would be better to leave NTB port API the way it is > now, and use logical port indexes in the ntb_peer_resource_idx() method. > You'd also need to use this

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

2019-03-21 Thread Logan Gunthorpe
available to NTB clients. Signed-off-by: Logan Gunthorpe Cc: Bjorn Helgaas --- drivers/pci/switch/switchtec.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index e22766c79fe9..8b1db78197d9 100644 --- a

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

2019-03-21 Thread Logan Gunthorpe
usual but are not programmed into the MSI-X table (as there may not be space for them). The MSI address and data will then handled through an NTB MSI library introduced later in this series. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/ms

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

2019-03-21 Thread Logan Gunthorpe
l port number is useful when calculating which resources to use for which peers. So we thus define two helper functions: ntb_logical_port_number() and ntb_peer_logical_port_number() which provide the "Logical Port Number" for the local port and any peer respectively. Signed-off-by: Logan G

[PATCH v3 06/10] NTB: Introduce MSI library

2019-03-21 Thread Logan Gunthorpe
the interrupt. The triggering peer, once having received the descriptor, can trigger the interrupt by calling ntb_msi_peer_trigger(). Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/Kconfig | 11 ++ drivers/ntb/Makefile | 3 +- drivers/ntb/msi.c

[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 04/10] NTB: Introduce functions to calculate multi-port resource index

2019-03-21 Thread Logan Gunthorpe
peer resource number that will correspond with the local peer index on the remote peer. Also, introduce ntb_peer_highest_mw_idx() which will use ntb_peer_resource_idx() but return the MW index starting with the highest index and working down. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave

[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 09/10] NTB: Add MSI interrupt support to ntb_transport

2019-03-21 Thread Logan Gunthorpe
d 14.1Gb/s which is a more than 3x improvement. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave Jiang Cc: Allen Hubbe --- drivers/ntb/ntb_transport.c | 169 +++- 1 file changed, 168 insertions(+), 1 deletion(-) diff --git a/drivers/ntb/ntb_transport.c b/d

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

2019-03-21 Thread Logan Gunthorpe
mber of local interrupts. By default this is 4. This is only limited by the number of unused MSI interrupts registered by the hardware (this will require support of the hardware driver) and there must be at least 2*num_irqs + 1 spads registers available. Signed-off-by: Logan Gunthorpe Cc: Jon Mason

[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 a/Document

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

2019-03-21 Thread Logan Gunthorpe
ches in this series add a library for dealing with MSI interrupts, a test client and finally support in ntb_transport. The series is based off of v5.1-rc1 plus the patches in ntb-next. A git repo is available here: https://github.com/sbates130272/linux-p2pmem/ ntb_transport_msi_v3 Thanks, L

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

2019-03-25 Thread Logan Gunthorpe
On 2019-03-22 10:47 a.m., Bjorn Helgaas wrote: > Hi Logan, > > Drive-by nits: Thanks Bjorn! I've updated my patches for v4 which I'll send out in a week or two. Logan ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundat

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-05-28 Thread Logan Gunthorpe
found no issues. I hope this can make progress soon and get merged soon. If you like you can add: Tested-By: Logan Gunthorpe > While converting the driver I exposed a bug in the intel i915 driver which > causes a huge amount of artifacts on the screen of my laptop. You can see a > p

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-05-29 Thread Logan Gunthorpe
On 2020-05-29 6:45 a.m., Christoph Hellwig wrote: > On Thu, May 28, 2020 at 06:00:44PM -0600, Logan Gunthorpe wrote: >>> This issue is most likely in the i915 driver and is most likely caused by >>> the driver not respecting the return value of the dma_map_ops::map_sg >

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-05-29 Thread Logan Gunthorpe
On 2020-05-29 3:11 p.m., Marek Szyprowski wrote: > Patches are pending: > https://lore.kernel.org/linux-iommu/20200513132114.6046-1-m.szyprow...@samsung.com/T/ Cool, nice! Though, I still don't think that fixes the issue in i915_scatterlist.h given it still ignores sg_dma_len() and strictly rel

Re: [PATCH] iommu/vt-d: Fix wrong analysis whether devices share the same bus

2019-08-23 Thread Logan Gunthorpe
ch longer and other errors. > > Fix it by checking comparing the alias with the previous one instead. > > Fixes: 3f0c625c6ae71 ("iommu/vt-d: Allow interrupts from the entire bus for > aliased devices") > Cc: sta...@vger.kernel.org > Cc: Logan Gunthorpe > Cc: Dav

[PATCH 3/3] iommu/amd: Support multiple PCI DMA aliases in IRQ Remapping

2019-10-08 Thread Logan Gunthorpe
. This is analogous to the functionality added to the Intel IRQ remapping code in commit 3f0c625c6ae7 ("iommu/vt-d: Allow interrupts from the entire bus for aliased devices") Signed-off-by: Logan Gunthorpe --- drivers/iommu/amd_iommu.c | 46 +--

[PATCH 2/3] iommu/amd: Support multiple PCI DMA aliases in device table

2019-10-08 Thread Logan Gunthorpe
s the IVRS alias every time it is changed. Signed-off-by: Logan Gunthorpe --- drivers/iommu/amd_iommu.c | 133 +++- drivers/iommu/amd_iommu_types.h | 2 +- 2 files changed, 62 insertions(+), 73 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/dri

[PATCH 1/3] iommu/amd: Implement dma_[un]map_resource()

2019-10-08 Thread Logan Gunthorpe
_addr passed instead of a page. dma_unmap_resource() uses unmap_page() directly as the functions are identical. Signed-off-by: Kit Chow [log...@deltatee.com: Cleaned up into a propper commit and wrote the commit message] Signed-off-by: Logan Gunthorpe --- drivers/iommu/amd_iommu.c

[PATCH 0/3] AMD IOMMU Changes for NTB

2019-10-08 Thread Logan Gunthorpe
d5d27c042d ("iommu/vt-d: Implement dma_[un]map_resource()") commit 3f0c625c6ae7 ("iommu/vt-d: Allow interrupts from the entire bus for aliased devices") Thanks, Logan -- Kit Chow (1): iommu/amd: Implement dma_[un]map_resource() Logan Gunthorpe (2): iommu/amd: Support mult

Re: [PATCH 1/3] iommu/amd: Implement dma_[un]map_resource()

2019-10-09 Thread Logan Gunthorpe
On 2019-10-09 12:57 a.m., Christoph Hellwig wrote: > On Tue, Oct 08, 2019 at 04:18:35PM -0600, Logan Gunthorpe wrote: >> From: Kit Chow >> >> Currently the Intel IOMMU uses the default dma_[un]map_resource() > > s/Intel/AMD/ ? Oops, yes, my mistake. >> +stat

Re: [PATCH 3/3] iommu/amd: Support multiple PCI DMA aliases in IRQ Remapping

2019-10-15 Thread Logan Gunthorpe
On 2019-10-15 7:37 a.m., Joerg Roedel wrote: > On Tue, Oct 08, 2019 at 04:18:37PM -0600, Logan Gunthorpe wrote: >> -static struct irq_remap_table *alloc_irq_table(u16 devid) >> +static int set_remap_table_entry_alias(struct pci_dev *pdev, u16 alias, >> +

[PATCH v2 1/2] iommu/amd: Support multiple PCI DMA aliases in device table

2019-10-22 Thread Logan Gunthorpe
s the IVRS alias every time it is changed. Signed-off-by: Logan Gunthorpe --- drivers/iommu/amd_iommu.c | 133 +++- drivers/iommu/amd_iommu_types.h | 2 +- 2 files changed, 62 insertions(+), 73 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/dri

[PATCH v2 0/2] AMD IOMMU Changes for NTB

2019-10-22 Thread Logan Gunthorpe
ar functionality has already been added with the generic iommu interface * Rebased onto joro/iommu.git next branch * Reworked the set_remap_table_entry_alias() function to also do the flushing by getting the iommu from amd_iommu_rlookup_table (per suggestion from Joerg) Logan Guntho

[PATCH v2 2/2] iommu/amd: Support multiple PCI DMA aliases in IRQ Remapping

2019-10-22 Thread Logan Gunthorpe
. This is analogous to the functionality added to the Intel IRQ remapping code in commit 3f0c625c6ae7 ("iommu/vt-d: Allow interrupts from the entire bus for aliased devices") Signed-off-by: Logan Gunthorpe --- drivers/iommu/amd_iommu.c | 37 ++---

Re: [PATCH] Ensure pci transactions coming from PLX NTB are handled when IOMMU is turned on

2019-11-20 Thread Logan Gunthorpe
On 2019-11-20 10:48 a.m., Dmitry Safonov wrote: > +Cc: linux-...@vger.kernel.org > +Cc: Bjorn Helgaas > +Cc: Logan Gunthorpe > > On 11/5/19 12:17 PM, James Sewart wrote: >> Any comments on this? >> >> Cheers, >> James. >> >>> On 24 Oct 20

Re: [PATCH v2] PCI: Add DMA alias quirk for PLX PEX NTB

2019-11-26 Thread Logan Gunthorpe
: James Sewart Looks good to me, save a nit below; and you may want to split this into two patches: one that introduces the new interface and one that uses it. Reviewed-by: Logan Gunthorpe > --- > drivers/pci/pci.c| 29 ++--- > drivers/pci/quirks.c | 15 +

Re: [PATCH v3 1/2] PCI: Add parameter nr_devfns to pci_add_dma_alias

2019-11-27 Thread Logan Gunthorpe
On 2019-11-27 6:27 a.m., James Sewart wrote: > * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask > * which is used to program permissible bus-devfn source addresses for DMA > @@ -5873,8 +5874,12 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, > * cannot be l

Re: [PATCH v4 1/2] PCI: Add parameter nr_devfns to pci_add_dma_alias

2019-11-29 Thread Logan Gunthorpe
On 2019-11-29 5:49 a.m., James Sewart wrote: > pci_add_dma_alias can now be used to create a dma alias for a range of > devfns. > > Signed-off-by: James Sewart > --- > drivers/pci/pci.c| 23 ++- > drivers/pci/quirks.c | 14 +++--- > include/linux/pci.h | 2 +-

Re: [PATCH v4 1/2] PCI: Add parameter nr_devfns to pci_add_dma_alias

2019-11-29 Thread Logan Gunthorpe
On 2019-11-29 10:19 a.m., James Sewart wrote: > > >> On 29 Nov 2019, at 16:50, Logan Gunthorpe wrote: >> >> >> >> On 2019-11-29 5:49 a.m., James Sewart wrote: >>> pci_add_dma_alias can now be used to create a dma alias for a range of &g

Re: [PATCH v5 1/3] PCI: Fix off by one in dma_alias_mask allocation size

2019-11-29 Thread Logan Gunthorpe
On 2019-11-29 10:56 a.m., James Sewart wrote: > The number of possible devfns is 256 so the size of the bitmap for > allocations should be U8_MAX+1. > > Signed-off-by: James Sewart Looks good to me. Thanks! For the whole series: Reviewed-by: Logan Gunthorpe > --- >

Re: [PATCH] x86/calgary: fix bitcast type warnings

2019-03-29 Thread Logan Gunthorpe
On 2019-03-29 3:19 p.m., Jann Horn wrote: >>> Can the existing api's not be used here like iowrite64be/ioread64be/ or >>> similar variant in "include/asm-generic/io.h" >> >> Oooh! I didn't realize that those exist. I'll change that and send a v2. Yes, they are very new! It took me a while to get

Re: [PATCH] x86/calgary: fix bitcast type warnings

2019-03-29 Thread Logan Gunthorpe
On 2019-03-29 3:40 p.m., Jann Horn wrote: > So what is the right thing to do in the context of > arch/x86/kernel/pci-calgary_64.c? That code wants to perform MMIO with > endianness conversion, and these accesses are always performed as > MMIO. Using the non-atomic 64-bit I/O helpers for this wou

Re: [PATCH v2 56/79] docs: Documentation/*.txt: rename all ReST files to *.rst

2019-04-22 Thread Logan Gunthorpe
Documentation/s390/vfio-ccw.rst | 6 +- > Documentation/{sgi-ioc4.txt => sgi-ioc4.rst} | 2 + > Documentation/{siphash.txt => siphash.rst}| 2 + > .../{smsc_ece1099.txt => smsc_ece1099.rst}| 2 + > .../{speculation.txt => speculation.rst} | 2 + > .../{static-keys.txt => static-keys.rst} | 2 + > Documentation/{svga.txt => svga.rst} | 2 + > .../{switchtec.txt => switchtec.rst} | 4 +- For all the switchtec changes: Acked-by: Logan Gunthorpe Thanks, Logan ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2019-04-22 Thread Logan Gunthorpe
usual but are not programmed into the MSI-X table (as there may not be space for them). The MSI address and data will then handled through an NTB MSI library introduced later in this series. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/ms

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

2019-04-22 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 v4 04/10] NTB: Introduce functions to calculate multi-port resource index

2019-04-22 Thread Logan Gunthorpe
peer resource number that will correspond with the local peer index on the remote peer. Also, introduce ntb_peer_highest_mw_idx() which will use ntb_peer_resource_idx() but return the MW index starting with the highest index and working down. Signed-off-by: Logan Gunthorpe Cc: Jon Mason Cc: Dave

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

2019-04-22 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

  1   2   3   4   5   6   >