Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp327400imm; Wed, 13 Jun 2018 00:42:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJaMq7esbKdLxnFiGXvkaD9J5JwhNaaghKTrSCqGBdJrjQNbwe1P4HsqxAh86DfEY+kqnRC X-Received: by 2002:a62:3ad8:: with SMTP id v85-v6mr3829700pfj.184.1528875762050; Wed, 13 Jun 2018 00:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528875762; cv=none; d=google.com; s=arc-20160816; b=bderkkgFjf8mZMU32bBNntwskZGPcSDS5mVfeDjn0ZjL2ETjBh2xb38/jIg3BcmGGo +jOkwzsk8VSOcMPBj/4gac2lYXMAgJONC/1VQyLox3pMEmrrtuZDYh0ObeNhkWiPYnzp 0OssvQVbBaEpe5HdOnlhphcbcm9JUnmnqUNYROlnsYev5YMVTVHc3teF8fj8DwIwfvHw IiCeyVf5GPhO2de3XpY5RBMxKRzg2i3/bTYSNOjrTqJRZR2ECaJDK1OvhQpO5ThnNM1E wl7eykf7sGDLqBiTYtLR/XhFGVVRgKbWvOwi/z8R5lFIbZ6k/tnJXr8rGW+cBM7sWavl FRoA== 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=oohRmM6XIpwCupB6S6+SVaE2yvOq+ENRUZwzW+aYdzI=; b=d43lASuFr/7cgj0E0FPfp1dggXJlWjuEQopX1elzaSReATtPK3lcVkr1PuUmw1Ia7B BNYA2z0fJOgs3dGSmyIxJrbOrWn1HxYFkNpSdZkf76OwJQEui2qsfQcQJMYJ2YaPNBsr qvs6zn7W264q14IgclsnTY6TDSVuE8wb/lQkDIx//4dKjuQG5sguUxsgtBV29CoDfXJD 7EmzlczeijLESMVRg3tbI6uSXkN3RAPefpbVOgVHfYPRNHCWqzXERYlVc/17fvlimepZ v9Pn1q22ThUPCK5mGp6uL6UaZfVhYTDI0bFIo7ZzYt0KbDaMT99vgc6VZAiJwaSUuMVj BqSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Fm5olaNB; 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 a21-v6si2146991pls.237.2018.06.13.00.42.27; Wed, 13 Jun 2018 00:42:42 -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=Fm5olaNB; 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 S934548AbeFMHlw (ORCPT + 99 others); Wed, 13 Jun 2018 03:41:52 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47882 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754476AbeFMHlu (ORCPT ); Wed, 13 Jun 2018 03:41:50 -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=oohRmM6XIpwCupB6S6+SVaE2yvOq+ENRUZwzW+aYdzI=; b=Fm5olaNB4WseSDN76h0KPd4ey OMa1qq7Wef/kJM7pMgld3a7URE+YER+MzAKgpp5GxXeUiFZ8++ro6Zb8UYsGyaoXDp8RDI6HeZu+Y XMIkAJqxp4i7Nmc27tzhGv2FN2IH1fzyHKnhDEJUUMxxR/qRX3rJtFC8wdZzcOjPrDQD7qWX2BKXa gb7MeCIkIa/wziAms6lKLqQ5M4QCIklvK2sjwheO5yEkEADHDB28sy3YTdUNMGr9XbtcVKX8dtLxc KuBX+UV2/eXEQOEXKAADGxOyVoFScS79vIcrrx73tR0syqb1qnq79hgjM0rFA4TotFNoIsy8e9qV6 llHZHkI9w==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT0PW-0006Yd-4h; Wed, 13 Jun 2018 07:41:42 +0000 Date: Wed, 13 Jun 2018 00:41:41 -0700 From: Christoph Hellwig To: Benjamin Herrenschmidt Cc: Ram Pai , "Michael S. Tsirkin" , Christoph Hellwig , robh@kernel.org, pawel.moll@arm.com, Tom Lendacky , aik@ozlabs.ru, jasowang@redhat.com, cohuck@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, joe@perches.com, "Rustad, Mark D" , david@gibson.dropbear.id.au, linuxppc-dev@lists.ozlabs.org, elfring@users.sourceforge.net, Anshuman Khandual Subject: Re: [RFC V2] virtio: Add platform specific DMA API translation for virito devices Message-ID: <20180613074141.GA12033@infradead.org> References: <20180522063317.20956-1-khandual@linux.vnet.ibm.com> <20180523213703-mutt-send-email-mst@kernel.org> <20180524072104.GD6139@ram.oc3035372033.ibm.com> <0c508eb2-08df-3f76-c260-90cf7137af80@linux.vnet.ibm.com> <20180531204320-mutt-send-email-mst@kernel.org> <20180607052306.GA1532@infradead.org> <20180607185234-mutt-send-email-mst@kernel.org> <20180611023909.GA5726@ram.oc3035372033.ibm.com> <07b804fccd7373c650be79ac9fa77ae7f2375ced.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <07b804fccd7373c650be79ac9fa77ae7f2375ced.camel@kernel.crashing.org> 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 Mon, Jun 11, 2018 at 01:29:18PM +1000, Benjamin Herrenschmidt wrote: > At the risk of repeating myself, let's just do the first pass which is > to switch virtio over to always using the DMA API in the actual data > flow code, with a hook at initialization time that replaces the DMA ops > with some home cooked "direct" ops in the case where the IOMMU flag > isn't set. > > This will be equivalent to what we have today but avoids having 2 > separate code path all over the driver. > > Then a second stage, I think, is to replace this "hook" so that the > architecture gets a say in the matter. I don't think we can actually use dma_direct_ops. It still allows architectures to override parts of the dma setup, which virtio seems to blindly assume phys == dma and not cache flushing. I think the right way forward is to either add a new VIRTIO_F_IS_PCI_DEVICE (or redefine the existing iommu flag if deemed possible). And then make sure recent qemu always sets it.