Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp581348imm; Wed, 1 Aug 2018 01:37:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkywNvbUMTlooVYqUruXL1VbxB942wxdfjFOjrr/FM0yvamZL9qtZBB+2ALuLHSo8kMZXk X-Received: by 2002:a63:ac57:: with SMTP id z23-v6mr22954168pgn.74.1533112672147; Wed, 01 Aug 2018 01:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533112672; cv=none; d=google.com; s=arc-20160816; b=ngnZjM0Nl0hqOJZYtBvtD4OVR/FqyM4Z71irIsAVDB+LTWMAXDXLV3aty08ipjNk9f eE6FlecWpN3+d1v2J8HkWNZATFIbOzInuzyNA6Xp4TK5j1wMthAoKq5jzYDxy73bXGUy 38oRpCcry2Dkaqav8jLfmNOgSgNJ2Z15fPZls5ywWAvE/EUKLC/MLWnnuLaL7tX8xtXH H8F7tuLbDFXgHmAkpImqgZUah+rpSoRbWC439qb/Z26qXQwmFUHPgUYHSfe/vc8QtpdA G2ljKH8wZ4egij1IcEX5/Oq6FGO7BOsLS/jd1oWMhQHGQULD+WivNzLW535Fw60vjnWj 7MEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Mf3XNY3mBtK6dbzk/xdtOh4J+lkXum6gACUqD3Xo5c8=; b=tAFKlXdfZoMFoYtW5OhYUWbW41L63RCeLWp7YEmZRv2/R9EJtma0yLBAhyRf75dPyS 5t070oCbt2J8Qr8HqigpXHoAANgPCEd0OppnBlDYyDTKMLGb8O+U+Q4Jpct/BcpeLgPN j387GzQa7MDpjGb7AWLoyNYX6KP/3Stzib2W+fO4yCPBExuTG4tt6f8IBraYFtINz/k/ hAjpzftvUZ1/AP7ryxF1ctNlGGGlax6ZWDM8dUwLkO5dAZcoE3l3oTDODRGvODrJ9Hv8 y0Fwf/1SS9zGLflm0O1/IBFNZj8kuDL9VhIOTcLrdxL1IBYdHDHuWQPzmZjl+3PLKftD Jb+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dsVHbpYj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v190-v6si15937023pgd.668.2018.08.01.01.37.37; Wed, 01 Aug 2018 01:37:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dsVHbpYj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388660AbeHAKVX (ORCPT + 99 others); Wed, 1 Aug 2018 06:21:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34726 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387644AbeHAKVX (ORCPT ); Wed, 1 Aug 2018 06:21:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Mf3XNY3mBtK6dbzk/xdtOh4J+lkXum6gACUqD3Xo5c8=; b=dsVHbpYjgTVYdwkMz1PcRCeJp 0uW12N1Prb7J5Mi2Yzq7GT9bPoYeguMw/f8QWvjW3rzJxp9x4pRp257Sc5XTBHdDFBcPhd8UXJw8f EkNAtyCiMGnUrsBciP7rEUtQsRfSzFZ5lB2VqSord+fz6bj1+CRvC/f/q0SGbmK9d0zCMe8oFMYXm jWC2BizMEd2ABHxOXmBpq0U9GA+//GIDxaiEAUsxGKHoip/MIezqdunIVqq7yEkQ4sObSVBoRJ7qC J2/R7mnNNEoboUvjYu+oaQloMIhGXchjC463dXtba9/nnZ7WOMHpQeW0F55wozLEV31dEi/DGUwWn j3MOAOfQA==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkmca-0007Mm-3d; Wed, 01 Aug 2018 08:36:40 +0000 Date: Wed, 1 Aug 2018 01:36:39 -0700 From: Christoph Hellwig To: Will Deacon Cc: Benjamin Herrenschmidt , Christoph Hellwig , "Michael S. Tsirkin" , Anshuman Khandual , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aik@ozlabs.ru, robh@kernel.org, joe@perches.com, elfring@users.sourceforge.net, david@gibson.dropbear.id.au, jasowang@redhat.com, mpe@ellerman.id.au, linuxram@us.ibm.com, haren@linux.vnet.ibm.com, paulus@samba.org, srikar@linux.vnet.ibm.com, robin.murphy@arm.com, jean-philippe.brucker@arm.com, marc.zyngier@arm.com Subject: Re: [RFC 0/4] Virtio uses DMA API for all devices Message-ID: <20180801083639.GF26378@infradead.org> References: <20180720035941.6844-1-khandual@linux.vnet.ibm.com> <20180727095804.GA25592@arm.com> <20180730093414.GD26245@infradead.org> <20180730125100-mutt-send-email-mst@kernel.org> <20180730111802.GA9830@infradead.org> <20180730155633-mutt-send-email-mst@kernel.org> <20180731173052.GA17153@infradead.org> <3d6e81511571260de1c8047aaffa8ac4df093d2e.camel@kernel.crashing.org> <20180801081637.GA14438@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180801081637.GA14438@arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 01, 2018 at 09:16:38AM +0100, Will Deacon wrote: > On arm/arm64, the problem we have is that legacy virtio devices on the MMIO > transport (so definitely not PCI) have historically been advertised by qemu > as not being cache coherent, but because the virtio core has bypassed DMA > ops then everything has happened to work. If we blindly enable the arch DMA > ops, No one is suggesting that as far as I can tell. > we'll plumb in the non-coherent ops and start getting data corruption, > so we do need a way to quirk virtio as being "always coherent" if we want to > use the DMA ops (which we do, because our emulation platforms have an IOMMU > for all virtio devices). From all that I've gather so far: no you do not want that. We really need to figure out virtio "dma" interacts with the host / device. If you look at the current iommu spec it does talk of physical address with a little careveout for VIRTIO_F_IOMMU_PLATFORM. So between that and our discussion in this thread and its previous iterations I think we need to stick to the current always physical, bypass system dma ops mode of virtio operation as the default. We just need to figure out how to deal with devices that deviate from the default. One things is that VIRTIO_F_IOMMU_PLATFORM really should become VIRTIO_F_PLATFORM_DMA to cover the cases of non-iommu dma tweaks (offsets, cache flushing), which seems well in spirit of the original design. The other issue is VIRTIO_F_IO_BARRIER which is very vaguely defined, and which needs a better definition. And last but not least we'll need some text explaining the challenges of hardware devices - I think VIRTIO_F_PLATFORM_DMA + VIRTIO_F_IO_BARRIER is what would basically cover them, but a good description including an explanation of why these matter.