On Tue, 27 Oct 2015 23:48:51 +0100
Christian Borntraeger <borntrae...@de.ibm.com> wrote:

> With all infrastructure in place, lets provide dma_ops for virtio
> devices on s390.
> 
> Signed-off-by: Christian Borntraeger <borntrae...@de.ibm.com>
> ---
>  drivers/s390/virtio/kvm_virtio.c | 2 ++
>  drivers/s390/virtio/virtio_ccw.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/s390/virtio/kvm_virtio.c 
> b/drivers/s390/virtio/kvm_virtio.c
> index 53fb975..05adaa9 100644
> --- a/drivers/s390/virtio/kvm_virtio.c
> +++ b/drivers/s390/virtio/kvm_virtio.c
> @@ -13,6 +13,7 @@
>  #include <linux/kernel_stat.h>
>  #include <linux/init.h>
>  #include <linux/bootmem.h>
> +#include <linux/dma-mapping.h>
>  #include <linux/err.h>
>  #include <linux/virtio.h>
>  #include <linux/virtio_config.h>
> @@ -318,6 +319,7 @@ static void add_kvm_device(struct kvm_device_desc *d, 
> unsigned int offset)
>               return;
>       }
> 
> +     kdev->vdev.dev.archdata.dma_ops = &dma_noop_ops;

This provides dma_ops for the vdev, while Andy's virtio code looks for
dma_ops in the vdev's parent (in the ccw and pci cases, the proxy
device; in this case, it would be our root device).

With

diff --git a/drivers/s390/virtio/kvm_virtio.c b/drivers/s390/virtio/kvm_virtio.c
index 05adaa9..5f79c52 100644
--- a/drivers/s390/virtio/kvm_virtio.c
+++ b/drivers/s390/virtio/kvm_virtio.c
@@ -319,7 +319,6 @@ static void add_kvm_device(struct kvm_device_desc *d, 
unsigned int offset)
                return;
        }
 
-       kdev->vdev.dev.archdata.dma_ops = &dma_noop_ops;
        kdev->vdev.dev.parent = kvm_root;
        kdev->vdev.id.device = d->type;
        kdev->vdev.config = &kvm_vq_configspace_ops;
@@ -473,6 +472,7 @@ static int __init kvm_devices_init(void)
                vmem_remove_mapping(total_memory_size, PAGE_SIZE);
                return rc;
        }
+       kvm_root->archdata.dma_ops = &dma_noop_ops;
 
        INIT_WORK(&hotplug_work, hotplug_devices);
 
applied (and the endianness fix in the virtio code), I can boot a
s390-virtio guest as well.

>       kdev->vdev.dev.parent = kvm_root;
>       kdev->vdev.id.device = d->type;
>       kdev->vdev.config = &kvm_vq_configspace_ops;

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to