diff mbox

[4/4] s390/virtio: use noop dma ops

Message ID 1445986131-239566-5-git-send-email-borntraeger@de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian Borntraeger Oct. 27, 2015, 10:48 p.m. UTC
With all infrastructure in place, lets provide dma_ops for virtio
devices on s390.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 drivers/s390/virtio/kvm_virtio.c | 2 ++
 drivers/s390/virtio/virtio_ccw.c | 2 ++
 2 files changed, 4 insertions(+)

Comments

Joerg Roedel Oct. 28, 2015, 12:43 a.m. UTC | #1
On Tue, Oct 27, 2015 at 11:48:51PM +0100, Christian Borntraeger wrote:
> @@ -1093,6 +1094,7 @@ static void virtio_ccw_auto_online(void *data, async_cookie_t cookie)
>  	struct ccw_device *cdev = data;
>  	int ret;
>  
> +	cdev->dev.archdata.dma_ops = &dma_noop_ops;
>  	ret = ccw_device_set_online(cdev);
>  	if (ret)
>  		dev_warn(&cdev->dev, "Failed to set online: %d\n", ret);

Hmm, drivers usually don't deal with setting the dma_ops for their
devices, as they depend on the platform and not so much on the device
itself.

Can you do this special-case handling from device independent platform
code, where you also setup dma_ops for other devices?


	Joerg

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Cornelia Huck Oct. 28, 2015, 8:44 a.m. UTC | #2
On Wed, 28 Oct 2015 09:43:34 +0900
Joerg Roedel <jroedel@suse.de> wrote:

> On Tue, Oct 27, 2015 at 11:48:51PM +0100, Christian Borntraeger wrote:
> > @@ -1093,6 +1094,7 @@ static void virtio_ccw_auto_online(void *data, async_cookie_t cookie)
> >  	struct ccw_device *cdev = data;
> >  	int ret;
> >  
> > +	cdev->dev.archdata.dma_ops = &dma_noop_ops;
> >  	ret = ccw_device_set_online(cdev);
> >  	if (ret)
> >  		dev_warn(&cdev->dev, "Failed to set online: %d\n", ret);
> 
> Hmm, drivers usually don't deal with setting the dma_ops for their
> devices, as they depend on the platform and not so much on the device
> itself.
> 
> Can you do this special-case handling from device independent platform
> code, where you also setup dma_ops for other devices?

Hm, maybe at the bus level?

pci devices get s390_dma_ops, ccw devices get the noop dma ops (just a
bit of dead weight for non-virtio ccw devices, I guess).

The old style s390-virtio devices are the odd ones around, but I'd like
to invest the least time possible there to keep them going.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christian Borntraeger Oct. 30, 2015, 12:56 p.m. UTC | #3
Am 28.10.2015 um 01:43 schrieb Joerg Roedel:
> On Tue, Oct 27, 2015 at 11:48:51PM +0100, Christian Borntraeger wrote:
>> @@ -1093,6 +1094,7 @@ static void virtio_ccw_auto_online(void *data, async_cookie_t cookie)
>>  	struct ccw_device *cdev = data;
>>  	int ret;
>>  
>> +	cdev->dev.archdata.dma_ops = &dma_noop_ops;
>>  	ret = ccw_device_set_online(cdev);
>>  	if (ret)
>>  		dev_warn(&cdev->dev, "Failed to set online: %d\n", ret);
> 
> Hmm, drivers usually don't deal with setting the dma_ops for their
> devices, as they depend on the platform and not so much on the device
> itself.
> 
> Can you do this special-case handling from device independent platform
> code, where you also setup dma_ops for other devices?
> 

Yes, fixed in v2.

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

Patch

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;
 	kdev->vdev.dev.parent = kvm_root;
 	kdev->vdev.id.device = d->type;
 	kdev->vdev.config = &kvm_vq_configspace_ops;
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 1cda784..8fb7a6b 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.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>
@@ -1093,6 +1094,7 @@  static void virtio_ccw_auto_online(void *data, async_cookie_t cookie)
 	struct ccw_device *cdev = data;
 	int ret;
 
+	cdev->dev.archdata.dma_ops = &dma_noop_ops;
 	ret = ccw_device_set_online(cdev);
 	if (ret)
 		dev_warn(&cdev->dev, "Failed to set online: %d\n", ret);