From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH 4/4] s390/virtio: use noop dma ops Date: Fri, 30 Oct 2015 13:26:09 +0100 Message-ID: <563361E1.2040605@de.ibm.com> References: <1445986131-239566-1-git-send-email-borntraeger@de.ibm.com> <1445986131-239566-5-git-send-email-borntraeger@de.ibm.com> <20151030131746.49f6b129.cornelia.huck@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Andy Lutomirski , Sebastian Ott , Paolo Bonzini , Christoph Hellwig , benh@kernel.crashing.org, KVM , dwmw2@infradead.org, Joerg Roedel , Martin Schwidefsky , linux-s390 To: Cornelia Huck Return-path: Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:33768 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750971AbbJ3M0S (ORCPT ); Fri, 30 Oct 2015 08:26:18 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 30 Oct 2015 12:26:16 -0000 In-Reply-To: <20151030131746.49f6b129.cornelia.huck@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Am 30.10.2015 um 13:17 schrieb Cornelia Huck: > On Tue, 27 Oct 2015 23:48:51 +0100 > Christian Borntraeger wrote: > >> With all infrastructure in place, lets provide dma_ops for virtio >> devices on s390. >> >> Signed-off-by: Christian Borntraeger >> --- >> 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 >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -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. I am currently reworking this to static inline struct dma_map_ops *get_dma_ops(struct device *dev) { if (dev && dev->archdata.dma_ops) return dev->archdata.dma_ops; return &dma_noop_ops; } Which uses the dma_noop_ops for everything unless the device overrides (PCI does)