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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 08:44:26PM +0100, 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) > > > +{ > > > + struct

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 07:32:57PM +, Jason Gunthorpe wrote: > On Tue, Jan 29, 2019 at 02:11:23PM -0500, 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: > > > > > > > + /* >

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 01:44:09PM -0700, Logan Gunthorpe wrote: > > > 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

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

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

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 08:24:36PM +, Jason Gunthorpe wrote: > On Tue, Jan 29, 2019 at 02:50:55PM -0500, Jerome Glisse wrote: > > > GPU driver do want more control :) GPU driver are moving things around > > all the time and they have more memory than bar space (on newer platform > > AMD GPU

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) >>> +{ >>> + struct pci_dev *pciA, *pciB; >>> +

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

2019-01-29 Thread Michael S. Tsirkin
On Tue, Jan 29, 2019 at 03:42:44PM -0200, Thiago Jung Bauermann wrote: > > Fixing address of powerpc mailing list. > > Thiago Jung Bauermann writes: > > > Hello, > > > > With Christoph's rework of the DMA API that recently landed, the patch > > below is the only change needed in virtio to make

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

2019-01-29 Thread Greg Kroah-Hartman
On Tue, Jan 29, 2019 at 12:47:25PM -0500, 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 >

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 11:26:01AM -0700, Logan Gunthorpe wrote: > > > 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 > >

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 02:56:38PM -0500, 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

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

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 02:30:49PM -0700, Logan Gunthorpe wrote: > > > 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

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 12:24:04PM -0700, Logan Gunthorpe wrote: > > > 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

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

2019-01-29 Thread Greg Kroah-Hartman
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) > > +{ > > + struct pci_dev *pciA, *pciB; > > + bool ret; > > + int tmp; > > + > > + /* > > +*

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 =

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 01:39:49PM -0700, Logan Gunthorpe wrote: > > > 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

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

2019-01-29 Thread Alex Deucher
On Tue, Jan 29, 2019 at 3:25 PM Logan Gunthorpe wrote: > > > > 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

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

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

2019-01-29 Thread Michael S. Tsirkin
On Mon, Jan 21, 2019 at 11:29:05AM +, Jean-Philippe Brucker wrote: > 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

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

2019-01-29 Thread Jerome Glisse
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 peer to peer (p2p) > > +* mapping of their vma (which can be back by some device memory) 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: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 peer to peer (p2p) >>> +* mapping of their

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

2019-01-29 Thread Alex Deucher
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 genericaly test this no > matter what the

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 08:46:05PM +0100, Greg Kroah-Hartman wrote: > On Tue, Jan 29, 2019 at 12:47:25PM -0500, 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

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: use generic DMA mapping code in powerpc V4

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 05:14:11PM +0100, Christoph Hellwig wrote: > On Tue, Jan 29, 2019 at 04:03:32PM +0100, Christian Zigotzky wrote: > > Hi Christoph, > > > > I compiled kernels for the X5000 and X1000 from your new branch > > 'powerpc-dma.6-debug.2' today. The kernels boot and the P.A. Semi

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

2019-01-29 Thread jglisse
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 inter-connect might be. However this version only support PCIE for

[RFC PATCH 0/5] Device peer to peer (p2p) through vma

2019-01-29 Thread jglisse
From: Jérôme Glisse This patchset add support for peer to peer between device in two manner. First for device memory use through HMM in process regular address space (ie inside a regular vma that is not an mmap of device file or special file). Second for special vma ie mmap of a device file, in

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

2019-01-29 Thread jglisse
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 inter-connect might be. However this version only support PCIE for

Re: [PATCH 0/3] iommu/arm-smmu: Add support to use Last level cache

2019-01-29 Thread Ard Biesheuvel
(+ Bjorn) On Mon, 28 Jan 2019 at 12:27, Vivek Gautam wrote: > > Hi Ard, > > On Thu, Jan 24, 2019 at 1:25 PM Ard Biesheuvel > wrote: > > > > On Thu, 24 Jan 2019 at 07:58, Vivek Gautam > > wrote: > > > > > > On Mon, Jan 21, 2019 at 7:55 PM Ard Biesheuvel > > > wrote: > > > > > > > > On Mon, 21

Re: use generic DMA mapping code in powerpc V4

2019-01-29 Thread Christian Zigotzky
Hi Christoph, I compiled kernels for the X5000 and X1000 from your new branch 'powerpc-dma.6-debug.2' today. The kernels boot and the P.A. Semi Ethernet works! Cheers, Christian On 28 January 2019 at 5:52PM, Christian Zigotzky wrote: Thanks a lot! I will test it tomorrow. — Christian

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

2019-01-29 Thread jglisse
From: Jérôme Glisse Allow mmap of device file to export device memory to peer to peer devices. This will allow for instance a network device to access a GPU memory or to access a storage device queue directly. The common case will be a vma created by userspace device driver that is then share

[RFC PATCH 5/5] mm/hmm: add support for peer to peer to special device vma

2019-01-29 Thread jglisse
From: Jérôme Glisse Special device vma (mmap of a device file) can correspond to device driver object that some device driver might want to share with other device (giving access to). This add support for HMM to map those special device vma if the owning device (exporter) allows it.

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

2019-01-29 Thread Auger Eric
Hi Jean-Philippe, On 1/28/19 6:32 PM, Jean-Philippe Brucker wrote: > 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 +++

[RFC PATCH 4/5] mm/hmm: add support for peer to peer to HMM device memory

2019-01-29 Thread jglisse
From: Jérôme Glisse Signed-off-by: Jérôme Glisse Cc: Logan Gunthorpe Cc: Greg Kroah-Hartman Cc: Rafael J. Wysocki Cc: Bjorn Helgaas Cc: Christian Koenig Cc: Felix Kuehling Cc: Jason Gunthorpe Cc: linux-...@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: Christoph Hellwig Cc:

Re: [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 09:43:42AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Segments can't be larger than the maximum DMA mapping size > supported on the platform. Take that into account when > setting the maximum segment size for a block device. > > Reviewed-by: Konrad Rzeszutek

Re: [PATCH 3/5] dma: Introduce dma_max_mapping_size()

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 09:43:40AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > The function returns the maximum size that can be mapped > using DMA-API functions. The patch also adds the > implementation for direct DMA and a new dma_map_ops pointer > so that other implementations can

Re: [PATCH 4/5] virtio: Introduce virtio_max_dma_size()

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 09:43:41AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > This function returns the maximum segment size for a single > dma transaction of a virtio device. The possible limit comes > from the SWIOTLB implementation in the Linux kernel, that > has an upper limit of

Re: use generic DMA mapping code in powerpc V4

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 04:03:32PM +0100, Christian Zigotzky wrote: > Hi Christoph, > > I compiled kernels for the X5000 and X1000 from your new branch > 'powerpc-dma.6-debug.2' today. The kernels boot and the P.A. Semi Ethernet > works! Thanks for testing! I'll prepare a new series that adds

Re: [PATCH 2/5] swiotlb: Add is_swiotlb_active() function

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 09:43:39AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > This function will be used from dma_direct code to determine > the maximum segment size of a dma mapping. > > Reviewed-by: Konrad Rzeszutek Wilk > Signed-off-by: Joerg Roedel Looks good, Reviewed-by:

Re: [PATCH 1/5] swiotlb: Introduce swiotlb_max_mapping_size()

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 09:43:38AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > The function returns the maximum size that can be remapped > by the SWIOTLB implementation. This function will be later > exposed to users through the DMA-API. > > Reviewed-by: Konrad Rzeszutek Wilk >

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

2019-01-29 Thread Thiago Jung Bauermann
Hello, With Christoph's rework of the DMA API that recently landed, the patch below is the only change needed in virtio to make it work in a POWER secure guest under the ultravisor. The other change we need (making sure the device's dma_map_ops is NULL so that the dma-direct/swiotlb code is

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

2019-01-29 Thread Thiago Jung Bauermann
Fixing address of powerpc mailing list. Thiago Jung Bauermann writes: > Hello, > > With Christoph's rework of the DMA API that recently landed, the patch > below is the only change needed in virtio to make it work in a POWER > secure guest under the ultravisor. > > The other change we need

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

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

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

2019-01-29 Thread Jason Gunthorpe
On Tue, Jan 29, 2019 at 02:11:23PM -0500, 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 peer to peer (p2p) > > > + *

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 Jason Gunthorpe
On Tue, Jan 29, 2019 at 03:44:00PM -0500, Jerome Glisse wrote: > > But this API doesn't seem to offer any control - I thought that > > control was all coming from the mm/hmm notifiers triggering p2p_unmaps? > > The control is within the driver implementation of those callbacks. Seems like what

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 03:58:45PM -0700, Logan Gunthorpe wrote: > > > 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

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

2019-01-29 Thread Jason Wang
On 2019/1/30 上午3:02, Michael S. Tsirkin wrote: On Tue, Jan 29, 2019 at 03:42:44PM -0200, Thiago Jung Bauermann wrote: Fixing address of powerpc mailing list. Thiago Jung Bauermann writes: Hello, With Christoph's rework of the DMA API that recently landed, the patch below is the only

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

2019-01-29 Thread Jason Gunthorpe
On Tue, Jan 29, 2019 at 02:50:55PM -0500, Jerome Glisse wrote: > GPU driver do want more control :) GPU driver are moving things around > all the time and they have more memory than bar space (on newer platform > AMD GPU do resize the bar but it is not the rule for all GPUs). So > GPU driver do

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

2019-01-29 Thread Alex Williamson
On Fri, 25 Jan 2019 17:49:20 +0100 Auger Eric wrote: > Hi Alex, > > On 1/11/19 10:30 PM, Alex Williamson wrote: > > On Tue, 8 Jan 2019 11:26:14 +0100 > > Eric Auger wrote: > > > >> From: "Liu, Yi L" > >> > >> In any virtualization use case, when the first translation stage > >> is "owned"

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 11:02:25PM +, Jason Gunthorpe wrote: > On Tue, Jan 29, 2019 at 03:44:00PM -0500, Jerome Glisse wrote: > > > > But this API doesn't seem to offer any control - I thought that > > > control was all coming from the mm/hmm notifiers triggering p2p_unmaps? > > > > The

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

2019-01-29 Thread Michael S. Tsirkin
On Wed, Jan 30, 2019 at 10:24:01AM +0800, Jason Wang wrote: > > On 2019/1/30 上午3:02, Michael S. Tsirkin wrote: > > On Tue, Jan 29, 2019 at 03:42:44PM -0200, Thiago Jung Bauermann wrote: > > > Fixing address of powerpc mailing list. > > > > > > Thiago Jung Bauermann writes: > > > > > > > Hello,

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

2019-01-29 Thread Jason Gunthorpe
On Tue, Jan 29, 2019 at 01:39:49PM -0700, Logan Gunthorpe wrote: > implement the mapping. And I don't think we should have 'special' vma's > for this (though we may need something to ensure we don't get mapping > requests mixed with different types of pages...). I think Jerome explained the

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

2019-01-29 Thread Jason Wang
On 2019/1/30 上午10:36, Michael S. Tsirkin wrote: On Wed, Jan 30, 2019 at 10:24:01AM +0800, Jason Wang wrote: On 2019/1/30 上午3:02, Michael S. Tsirkin wrote: On Tue, Jan 29, 2019 at 03:42:44PM -0200, Thiago Jung Bauermann wrote: Fixing address of powerpc mailing list. Thiago Jung Bauermann

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

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 01:43:02PM -0700, Logan Gunthorpe wrote: > It's hard to reason about an interface when you can't see what all the > layers want to do with it. Most maintainers (I'd hope) would certainly > never merge code that has no callers, and for much the same reason, I'd > rather not

Re: [PATCH 05/11] mmc: s3cmci: handle highmem pages

2019-01-29 Thread Ulf Hansson
On Mon, 14 Jan 2019 at 10:58, Christoph Hellwig wrote: > > Instead of setting up a kernel pointer to track the current PIO address, > track the offset in the current page, and do an atomic kmap for the page > while doing the actual PIO operations. > > Signed-off-by: Christoph Hellwig Nitpick:

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

2019-01-29 Thread Michael S. Tsirkin
On Wed, Jan 30, 2019 at 11:05:42AM +0800, Jason Wang wrote: > > On 2019/1/30 上午10:36, Michael S. Tsirkin wrote: > > On Wed, Jan 30, 2019 at 10:24:01AM +0800, Jason Wang wrote: > > > On 2019/1/30 上午3:02, Michael S. Tsirkin wrote: > > > > On Tue, Jan 29, 2019 at 03:42:44PM -0200, Thiago Jung

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

2019-01-29 Thread Jason Gunthorpe
On Tue, Jan 29, 2019 at 07:08:06PM -0500, Jerome Glisse wrote: > On Tue, Jan 29, 2019 at 11:02:25PM +, Jason Gunthorpe wrote: > > On Tue, Jan 29, 2019 at 03:44:00PM -0500, Jerome Glisse wrote: > > > > > > But this API doesn't seem to offer any control - I thought that > > > > control was all

[PATCH 1/2] iommu/vt-d: Remove change_pte notifier

2019-01-29 Thread Peter Xu
The change_pte() interface is tailored for PFN updates, while the other notifier invalidate_range() should be enough for Intel IOMMU cache flushing. Actually we've done similar thing for AMD IOMMU already in 8301da53fbc1 ("iommu/amd: Remove change_pte mmu_notifier call-back", 2014-07-30) but the

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

2019-01-29 Thread Peter Xu
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. Signed-off-by: Peter Xu --- drivers/iommu/amd_iommu_v2.c | 24 1 file changed, 24 deletions(-)

[PATCH 0/2] Some MMU notifier cleanups for Intel/AMD IOMMU

2019-01-29 Thread Peter Xu
Recently when I'm reading the mmu notifiers I noticed that both Intel/AMD IOMMU drivers seem to have redundancies in using the MMU notifiers. It can also be seen as a follow up of commit 8301da53fbc1 ("iommu/amd: Remove change_pte mmu_notifier call-back", 2014-07-30). I don't have hardwares to

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

2019-01-29 Thread Jason Gunthorpe
On Tue, Jan 29, 2019 at 06:17:43PM -0700, Logan Gunthorpe wrote: > This isn't answering my question at all... I specifically asked what is > backing the VMA when we are *not* using HMM. At least for RDMA what backs the VMA today is non-struct-page BAR memory filled in with io_remap_pfn. And we

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

2019-01-29 Thread Christoph Hellwig
On Tue, Jan 29, 2019 at 09:36:08PM -0500, Michael S. Tsirkin wrote: > This has been discussed ad nauseum. virtio is all about compatibility. > Losing a couple of lines of code isn't worth breaking working setups. > People that want "just use DMA API no tricks" now have the option. > Setting a flag

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

2019-01-29 Thread Jerome Glisse
On Tue, Jan 29, 2019 at 06:17:43PM -0700, Logan Gunthorpe wrote: > > > 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

Re: use generic DMA mapping code in powerpc V4

2019-01-29 Thread Christian Zigotzky
Hi Christoph, Thanks a lot for the updates. I will test the full branch tomorrow. Cheers, Christian Sent from my iPhone > On 29. Jan 2019, at 17:34, Christoph Hellwig wrote: > >> On Tue, Jan 29, 2019 at 05:14:11PM +0100, Christoph Hellwig wrote: >>> On Tue, Jan 29, 2019 at 04:03:32PM +0100,

Re: [PATCH 0/3] iommu/arm-smmu: Add support to use Last level cache

2019-01-29 Thread Vivek Gautam
On Tue, Jan 29, 2019 at 8:34 PM Ard Biesheuvel wrote: > > (+ Bjorn) > > On Mon, 28 Jan 2019 at 12:27, Vivek Gautam > wrote: > > > > Hi Ard, > > > > On Thu, Jan 24, 2019 at 1:25 PM Ard Biesheuvel > > wrote: > > > > > > On Thu, 24 Jan 2019 at 07:58, Vivek Gautam > > > wrote: > > > > > > > > On

Re: [PATCH 07/11] mmc: mvsdio: handle highmem pages

2019-01-29 Thread Ulf Hansson
On Mon, 14 Jan 2019 at 10:58, Christoph Hellwig wrote: > > Instead of setting up a kernel pointer to track the current PIO address, > track the offset in the current page, and do an atomic kmap for the page > while doing the actual PIO operations. > > Signed-off-by: Christoph Hellwig > --- >

[PATCH 0/5 v4] Fix virtio-blk issue with SWIOTLB

2019-01-29 Thread Joerg Roedel
Hi, here is the fourth version of this patch-set. Previous versions can be found here: V1: https://lore.kernel.org/lkml/20190110134433.15672-1-j...@8bytes.org/ V2: https://lore.kernel.org/lkml/20190115132257.6426-1-j...@8bytes.org/ V3:

[PATCH 4/5] virtio: Introduce virtio_max_dma_size()

2019-01-29 Thread Joerg Roedel
From: Joerg Roedel This function returns the maximum segment size for a single dma transaction of a virtio device. The possible limit comes from the SWIOTLB implementation in the Linux kernel, that has an upper limit of (currently) 256kb of contiguous memory it can map. Other DMA-API

[PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size

2019-01-29 Thread Joerg Roedel
From: Joerg Roedel Segments can't be larger than the maximum DMA mapping size supported on the platform. Take that into account when setting the maximum segment size for a block device. Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Joerg Roedel --- drivers/block/virtio_blk.c | 10

[PATCH 1/5] swiotlb: Introduce swiotlb_max_mapping_size()

2019-01-29 Thread Joerg Roedel
From: Joerg Roedel The function returns the maximum size that can be remapped by the SWIOTLB implementation. This function will be later exposed to users through the DMA-API. Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Joerg Roedel --- include/linux/swiotlb.h | 5 +

[PATCH 3/5] dma: Introduce dma_max_mapping_size()

2019-01-29 Thread Joerg Roedel
From: Joerg Roedel The function returns the maximum size that can be mapped using DMA-API functions. The patch also adds the implementation for direct DMA and a new dma_map_ops pointer so that other implementations can expose their limit. Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Joerg

[PATCH 2/5] swiotlb: Add is_swiotlb_active() function

2019-01-29 Thread Joerg Roedel
From: Joerg Roedel This function will be used from dma_direct code to determine the maximum segment size of a dma mapping. Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Joerg Roedel --- include/linux/swiotlb.h | 6 ++ kernel/dma/swiotlb.c| 9 + 2 files changed, 15

Re: [PATCH 2/2] iommu/arm-smmu: Add support for non-coherent page table mappings

2019-01-29 Thread Vivek Gautam
Hi Will, On Tue, Jan 22, 2019 at 11:14 AM Will Deacon wrote: > > On Mon, Jan 21, 2019 at 11:35:30AM +0530, Vivek Gautam wrote: > > On Sun, Jan 20, 2019 at 5:31 AM Will Deacon wrote: > > > On Thu, Jan 17, 2019 at 02:57:18PM +0530, Vivek Gautam wrote: > > > > Adding a device tree option for arm