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

2020-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2020 at 03:24:03PM +0100, Alexander Graf wrote: > On 24.02.20 18:16, Christoph Hellwig wrote: > > On Sat, Feb 22, 2020 at 02:07:58PM -0500, Michael S. Tsirkin wrote: > > > On Fri, Feb 21, 2020 at 03:33:40PM +0100, Halil Pasic wrote: > > > > AFAIU you have a positive attitude

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

2020-10-28 Thread Alexander Graf via iommu
On 24.02.20 18:16, Christoph Hellwig wrote: On Sat, Feb 22, 2020 at 02:07:58PM -0500, Michael S. Tsirkin wrote: On Fri, Feb 21, 2020 at 03:33:40PM +0100, Halil Pasic wrote: AFAIU you have a positive attitude towards the idea, that !F_VIRTIO_PLATFORM implies 'no DMA API is used by virtio'

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

2020-02-24 Thread Halil Pasic
On Fri, 21 Feb 2020 17:36:45 +0100 Christoph Hellwig wrote: > > By "legacy devices" I assume you mean pre-virtio-1.0 devices, that > > lack the F_VERSION_1 feature flag. Is that right? Because I don't > > see how being a legacy device or not relates to use of the DMA API. > > No. "legacy"

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

2020-02-24 Thread Christoph Hellwig
On Sat, Feb 22, 2020 at 02:07:58PM -0500, Michael S. Tsirkin wrote: > On Fri, Feb 21, 2020 at 03:33:40PM +0100, Halil Pasic wrote: > > AFAIU you have a positive attitude towards the idea, that > > !F_VIRTIO_PLATFORM implies 'no DMA API is used by virtio' > > should be scrapped. > > > > I would

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

2020-02-23 Thread David Gibson
On Fri, Feb 21, 2020 at 05:36:45PM +0100, Christoph Hellwig wrote: > 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

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

2020-02-23 Thread David Gibson
On Fri, Feb 21, 2020 at 09:39:38AM -0600, Tom Lendacky wrote: > 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

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

2020-02-22 Thread Michael S. Tsirkin
On Fri, Feb 21, 2020 at 03:33:40PM +0100, Halil Pasic wrote: > AFAIU you have a positive attitude towards the idea, that > !F_VIRTIO_PLATFORM implies 'no DMA API is used by virtio' > should be scrapped. > > I would like to accomplish that without adverse effects to virtio-ccw > (because caring

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

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

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

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

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

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

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

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

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

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

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

2020-02-20 Thread Jason Wang
On 2020/2/21 上午10:59, 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..fafc8f924955 100644 ---

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

2020-02-20 Thread David Gibson
On Thu, Feb 20, 2020 at 05:17:48PM -0800, Ram Pai wrote: > On Thu, Feb 20, 2020 at 03:55:14PM -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-20 Thread David Gibson
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..fafc8f924955 100644 > > --- a/drivers/virtio/virtio_ring.c > > +++

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

2020-02-20 Thread Ram Pai
On Thu, Feb 20, 2020 at 03:55:14PM -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 > >

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

2020-02-20 Thread Michael S. Tsirkin
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 flag to make virtio core use the DMA API, which > is in turn necessary,

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

2020-02-20 Thread Christoph Hellwig
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/drivers/virtio/virtio_ring.c > @@ -243,6 +243,9 @@ static bool