Re: [PATCH 1/2] mm: move force_dma_unencrypted() to mem_encrypt.h

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 14:27:27 +1100 David Gibson wrote: > On Thu, Feb 20, 2020 at 05:31:35PM +0100, Christoph Hellwig wrote: > > On Thu, Feb 20, 2020 at 05:23:20PM +0100, Christian Borntraeger wrote: > > > >From a users perspective it makes absolutely perfect sense to use the > > > bounce buffers

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Halil Pasic
On Thu, 20 Feb 2020 15:55:14 -0500 "Michael S. Tsirkin" wrote: > On Thu, Feb 20, 2020 at 05:06:06PM +0100, Halil Pasic wrote: > > Currently the advanced guest memory protection technologies (AMD SEV, > > powerpc secure guest technology and s390 Protected VMs) abuse the > > VIRTIO_F_IOMMU_PLATFORM

Re: [PATCH] iommu/dmar: ignore devices with out-of-spec domain number

2020-02-21 Thread Lu Baolu
Hi, On 2020/2/11 17:03, Daniel Drake wrote: VMD subdevices are created with a PCI domain ID of 0x1 or higher. These subdevices are also handled like all other PCI devices by dmar_pci_bus_notifier(). However, when dmar_alloc_pci_notify_info() take records of such devices, it will truncate t

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 13:59:15 +1100 David Gibson wrote: > On Thu, Feb 20, 2020 at 05:13:09PM +0100, Christoph Hellwig wrote: > > On Thu, Feb 20, 2020 at 05:06:06PM +0100, Halil Pasic wrote: > > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > > > index 867c7ebd3f10..faf

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 11:41:57 +0800 Jason Wang wrote: > > I *think* what you are suggesting here is that virtio devices that > > have !F_IOMMU_PLATFORM should have their dma_ops set up so that the > > DMA API treats IOVA==PA, which will satisfy what the device expects. > > > Can this work for

Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM

2020-02-21 Thread Halil Pasic
On Thu, 20 Feb 2020 16:29:50 -0500 "Michael S. Tsirkin" wrote: > On Thu, Feb 20, 2020 at 05:06:04PM +0100, Halil Pasic wrote: > > * This usage is not congruent with standardised semantics of > > VIRTIO_F_IOMMU_PLATFORM. Guest memory protected is an orthogonal reason > > for using DMA API in virt

Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM

2020-02-21 Thread Halil Pasic
On Thu, 20 Feb 2020 16:33:35 -0500 "Michael S. Tsirkin" wrote: > On Thu, Feb 20, 2020 at 05:06:04PM +0100, Halil Pasic wrote: > > For vhost-net the feature VIRTIO_F_IOMMU_PLATFORM has the following side > > effect The vhost code assumes it the addresses on the virtio descriptor > > ring are not g

Re: [PATCH 1/2] dma-mapping: support setting memory uncached in place

2020-02-21 Thread Christoph Hellwig
On Thu, Feb 20, 2020 at 05:21:35PM +, Robin Murphy wrote: >> @@ -196,10 +192,15 @@ void *dma_direct_alloc_pages(struct device *dev, >> size_t size, >> memset(ret, 0, size); >> - if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) && >> -dma_alloc_need_uncached(dev, attrs)) { >> +

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Halil Pasic
On Thu, 20 Feb 2020 17:13:09 +0100 Christoph Hellwig wrote: > On Thu, Feb 20, 2020 at 05:06:06PM +0100, Halil Pasic wrote: > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > > index 867c7ebd3f10..fafc8f924955 100644 > > --- a/drivers/virtio/virtio_ring.c > > +++ b/driv

Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 14:22:26 +0800 Jason Wang wrote: > > On 2020/2/21 上午12:06, Halil Pasic wrote: > > Currently if one intends to run a memory protection enabled VM with > > virtio devices and linux as the guest OS, one needs to specify the > > VIRTIO_F_IOMMU_PLATFORM flag for each virtio device

Re: [PATCH 1/2] mm: move force_dma_unencrypted() to mem_encrypt.h

2020-02-21 Thread Michael S. Tsirkin
On Fri, Feb 21, 2020 at 02:06:39PM +0100, Halil Pasic wrote: > On Fri, 21 Feb 2020 14:27:27 +1100 > David Gibson wrote: > > > On Thu, Feb 20, 2020 at 05:31:35PM +0100, Christoph Hellwig wrote: > > > On Thu, Feb 20, 2020 at 05:23:20PM +0100, Christian Borntraeger wrote: > > > > >From a users persp

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Michael S. Tsirkin
On Fri, Feb 21, 2020 at 02:12:30PM +0100, Halil Pasic wrote: > On Thu, 20 Feb 2020 15:55:14 -0500 > "Michael S. Tsirkin" wrote: > > > On Thu, Feb 20, 2020 at 05:06:06PM +0100, Halil Pasic wrote: > > > Currently the advanced guest memory protection technologies (AMD SEV, > > > powerpc secure guest

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Tom Lendacky
On 2/21/20 7:12 AM, Halil Pasic wrote: > On Thu, 20 Feb 2020 15:55:14 -0500 > "Michael S. Tsirkin" wrote: > >> On Thu, Feb 20, 2020 at 05:06:06PM +0100, Halil Pasic wrote: >>> Currently the advanced guest memory protection technologies (AMD SEV, >>> powerpc secure guest technology and s390 Protec

Re: [PATCH v2] iommu/arm-smmu-v3: Add SMMUv3.2 range invalidation support

2020-02-21 Thread Robin Murphy
On 20/02/2020 5:54 pm, Rob Herring wrote: On Mon, Feb 17, 2020 at 1:17 PM Robin Murphy wrote: On 13/02/2020 9:49 pm, Rob Herring wrote: On Thu, Jan 30, 2020 at 11:34 AM Robin Murphy wrote: On 30/01/2020 3:06 pm, Auger Eric wrote: Hi Rob, On 1/17/20 10:16 PM, Rob Herring wrote: Arm SMMUv3

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Christoph Hellwig
On Fri, Feb 21, 2020 at 10:56:45AM -0500, Michael S. Tsirkin wrote: > > > - DMA API is giving us addresses that are actually also physical > > > addresses > > > > In case of s390 this is given. > > I talked with the power people before > > posting this, and they ensured me they can are willi

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Christoph Hellwig
On Fri, Feb 21, 2020 at 01:59:15PM +1100, David Gibson wrote: > > Hell no. This is a detail of the platform DMA direct implementation. > > Drivers have no business looking at this flag, and virtio finally needs > > to be fixed to use the DMA API properly for everything but legacy devices. > > So,

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Christoph Hellwig
On Fri, Feb 21, 2020 at 03:33:40PM +0100, Halil Pasic wrote: > > Hell no. This is a detail of the platform DMA direct implementation. > > I beg to differ. If it was a detail of the DMA direct implementation, it > should have/would have been private to kernel/dma/direct.c. It can't given that pl

Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM

2020-02-21 Thread Christoph Hellwig
On Thu, Feb 20, 2020 at 04:33:35PM -0500, Michael S. Tsirkin wrote: > So it sounds like a host issue: the emulation of s390 unnecessarily > complicated. > Working around it by the guest looks wrong ... Yes. If your host (and I don't care if you split hypervisor, ultravisor and megavisor out in y

Re: [PATCH v2] iommu/arm-smmu-v3: Add SMMUv3.2 range invalidation support

2020-02-21 Thread Rob Herring
On Fri, Feb 21, 2020 at 10:19 AM Robin Murphy wrote: > > On 20/02/2020 5:54 pm, Rob Herring wrote: > > On Mon, Feb 17, 2020 at 1:17 PM Robin Murphy wrote: > >> > >> On 13/02/2020 9:49 pm, Rob Herring wrote: > >>> On Thu, Jan 30, 2020 at 11:34 AM Robin Murphy > >>> wrote: > > On 30/01/

Re: [PATCH v2] iommu/arm-smmu-v3: Add SMMUv3.2 range invalidation support

2020-02-21 Thread Robin Murphy
On 21/02/2020 4:47 pm, Rob Herring wrote: On Fri, Feb 21, 2020 at 10:19 AM Robin Murphy wrote: On 20/02/2020 5:54 pm, Rob Herring wrote: On Mon, Feb 17, 2020 at 1:17 PM Robin Murphy wrote: On 13/02/2020 9:49 pm, Rob Herring wrote: On Thu, Jan 30, 2020 at 11:34 AM Robin Murphy wrote: On

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 10:56:45 -0500 "Michael S. Tsirkin" wrote: > On Fri, Feb 21, 2020 at 02:12:30PM +0100, Halil Pasic wrote: > > On Thu, 20 Feb 2020 15:55:14 -0500 > > "Michael S. Tsirkin" wrote: [..] > > > To summarize, the necessary conditions for a hack along these lines > > > (using DMA API

Re: [PATCH 1/2] mm: move force_dma_unencrypted() to mem_encrypt.h

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 10:48:15 -0500 "Michael S. Tsirkin" wrote: > On Fri, Feb 21, 2020 at 02:06:39PM +0100, Halil Pasic wrote: > > On Fri, 21 Feb 2020 14:27:27 +1100 > > David Gibson wrote: > > > > > On Thu, Feb 20, 2020 at 05:31:35PM +0100, Christoph Hellwig wrote: > > > > On Thu, Feb 20, 2020

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-21 Thread Halil Pasic
On Fri, 21 Feb 2020 17:39:38 +0100 Christoph Hellwig wrote: > On Fri, Feb 21, 2020 at 03:33:40PM +0100, Halil Pasic wrote: > > > Hell no. This is a detail of the platform DMA direct implementation. > > > > I beg to differ. If it was a detail of the DMA direct implementation, it > > should have/

Re: [PATCH V9 06/10] iommu/vt-d: Add svm/sva invalidate function

2020-02-21 Thread Jacob Pan
On Fri, 21 Feb 2020 06:34:35 + "Liu, Yi L" wrote: > > From: Jacob Pan > > Sent: Wednesday, January 29, 2020 2:02 PM > > Subject: [PATCH V9 06/10] iommu/vt-d: Add svm/sva invalidate > > function > > > > When Shared Virtual Address (SVA) is enabled for a guest OS via > > vIOMMU, we need to pr

Re: [PATCH V9 07/10] iommu/vt-d: Cache virtual command capability register

2020-02-21 Thread Jacob Pan
On Wed, 12 Feb 2020 14:00:22 +0100 Auger Eric wrote: > Hi Jacob, > > On 1/29/20 7:01 AM, Jacob Pan wrote: > > Virtual command registers are used in the guest only, to prevent > > vmexit cost, we cache the capability and store it during > > initialization. > > > > Signed-off-by: Jacob Pan > I

Re: [PATCH 2/2] openrisc: use the generic in-place uncached DMA allocator

2020-02-21 Thread Stafford Horne
On Thu, Feb 20, 2020 at 09:01:39AM -0800, Christoph Hellwig wrote: > Switch openrisc to use the dma-direct allocator and just provide the > hooks for setting memory uncached or cached. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stafford Horne Also, I test booted openrisc with linux 5.5

Re: [PATCH v13 0/4] Add uacce module for Accelerator

2020-02-21 Thread Herbert Xu
On Tue, Feb 11, 2020 at 03:54:21PM +0800, Zhangfei Gao wrote: > Uacce (Unified/User-space-access-intended Accelerator Framework) targets to > provide Shared Virtual Addressing (SVA) between accelerators and processes. > So accelerator can access any data structure of the main cpu. > This differs fr

Re: [PATCH v13 0/4] Add uacce module for Accelerator

2020-02-21 Thread zhangfei
On 2020/2/22 上午9:41, Herbert Xu wrote: On Tue, Feb 11, 2020 at 03:54:21PM +0800, Zhangfei Gao wrote: Uacce (Unified/User-space-access-intended Accelerator Framework) targets to provide Shared Virtual Addressing (SVA) between accelerators and processes. So accelerator can access any data struct