Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-31 Thread Anshuman Khandual
On 07/30/2018 02:55 PM, Christoph Hellwig wrote: >> +const struct dma_map_ops virtio_direct_dma_ops; > > This belongs into a header if it is non-static. If you only > use it in this file anyway please mark it static and avoid a forward > declaration. Sure, will make it static, move the definitio

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-30 Thread Anshuman Khandual
On 07/30/2018 03:00 PM, Christoph Hellwig wrote: >>> + >>> + if (xen_domain()) >>> + goto skip_override; >>> + >>> + if (virtio_has_iommu_quirk(dev)) >>> + set_dma_ops(dev->dev.parent, &virtio_direct_dma_ops); >>> + >>> + skip_override: >>> + >> >> I prefer normal if scoping

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-30 Thread Christoph Hellwig
> > + > > + if (xen_domain()) > > + goto skip_override; > > + > > + if (virtio_has_iommu_quirk(dev)) > > + set_dma_ops(dev->dev.parent, &virtio_direct_dma_ops); > > + > > + skip_override: > > + > > I prefer normal if scoping as opposed to goto spaghetti pls. > Better yet mo

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-30 Thread Christoph Hellwig
> +const struct dma_map_ops virtio_direct_dma_ops; This belongs into a header if it is non-static. If you only use it in this file anyway please mark it static and avoid a forward declaration. > + > int virtio_finalize_features(struct virtio_device *dev) > { > int ret = dev->config->fina

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-29 Thread Anshuman Khandual
On 07/29/2018 02:46 AM, Michael S. Tsirkin wrote: > On Sat, Jul 28, 2018 at 02:26:24PM +0530, Anshuman Khandual wrote: >> On 07/20/2018 09:29 AM, Anshuman Khandual wrote: >>> Now that virtio core always needs all virtio devices to have DMA OPS, we >>> need to make sure that the structure it points

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-28 Thread Michael S. Tsirkin
On Sat, Jul 28, 2018 at 02:26:24PM +0530, Anshuman Khandual wrote: > On 07/20/2018 09:29 AM, Anshuman Khandual wrote: > > Now that virtio core always needs all virtio devices to have DMA OPS, we > > need to make sure that the structure it points is the right one. In the > > absence of VIRTIO_F_IOMM

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-28 Thread Anshuman Khandual
On 07/20/2018 09:29 AM, Anshuman Khandual wrote: > Now that virtio core always needs all virtio devices to have DMA OPS, we > need to make sure that the structure it points is the right one. In the > absence of VIRTIO_F_IOMMU_PLATFORM flag QEMU expects GPA from guest kernel. > In such case, virtio

[RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-19 Thread Anshuman Khandual
Now that virtio core always needs all virtio devices to have DMA OPS, we need to make sure that the structure it points is the right one. In the absence of VIRTIO_F_IOMMU_PLATFORM flag QEMU expects GPA from guest kernel. In such case, virtio device must use default virtio_direct_dma_ops DMA OPS str