Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp586813imm; Wed, 13 Jun 2018 05:28:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKYmFGw8JkOYJvBeIf9Vc0dGhhSci45XWumZAMvXCpjyee5udAcp0OiyL90uETegg2TmhqX X-Received: by 2002:a63:af50:: with SMTP id s16-v6mr4014086pgo.263.1528892894355; Wed, 13 Jun 2018 05:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528892894; cv=none; d=google.com; s=arc-20160816; b=ll3fEc/p+LtoKp4Kcscq2mMPixnUnanmMv9glK4Dt0nN3hj59wf/NdDinzQ1+d7fVB KiCRk9berIyRJtBpgUHcMEytVjmyC6psaY5cn22hTlUHGr1vS6wErPK2pKzweSHRJmGQ cTrBPInmffFQgmxxI0rJryhQTAEcrIs+li+71sY+1n/bX03R29YFs2lcagADs1RAJO1L Jo5Q6vOB4gEoDTW6imRCnXTdMmVkTc2PggXcfD2THrQGtMfG3gfEDgJy0s5vDfyXI1Ug EFnKjaGa/FxxBtolbostSePC/oT+DFWKMNEurtD3A1zoSYNhQ2C3b/i2d4rG3pNl4h/o FNNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=aTry+e7LWTt2063MQEVFFVX1mQpwkUma7738L7MHwGM=; b=CORJwUFliKk2H41VOsyR9vghorfxKtlJ+z7zfqHVNKuM5iQtEW7A/dHqDCc0Z5tF2Y R1Niu5rvrjY8+6deNgGI9x9L1fV87/JKHJqTC1E0ZUwFPa5XFRmRWfxhLsKSpBPz7EnN O+AWL6pYHVspCj5lmSJPwtF9Kc2xaAhCTTLOtAqnD7jm0MW18vOT9++4j26FETuZGCaW 6FsK2nbHlBoExE47dziyLF11T2GjgX0cav0LUyMZw/ZVcDxit9mZJcSZopVEhAOWo8vN H4fea7nY8puuFxa3pYnNCGi83q5lSpW8ZEoOJlCbGtNX8F39XiY6tkdKVYYMtYUcpyFX c3Cw== ARC-Authentication-Results: i=1; mx.google.com; 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 l26-v6si2697988pfe.299.2018.06.13.05.27.58; Wed, 13 Jun 2018 05:28:14 -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; 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 S1754478AbeFMM1W (ORCPT + 99 others); Wed, 13 Jun 2018 08:27:22 -0400 Received: from gate.crashing.org ([63.228.1.57]:45826 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935286AbeFMM1V (ORCPT ); Wed, 13 Jun 2018 08:27:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w5DCPUcS031471; Wed, 13 Jun 2018 07:25:32 -0500 Message-ID: <5dbcafa73b065bc619fd6adc9ef47eb6367b8378.camel@kernel.crashing.org> Subject: Re: [RFC V2] virtio: Add platform specific DMA API translation for virito devices From: Benjamin Herrenschmidt To: Christoph Hellwig Cc: Ram Pai , "Michael S. Tsirkin" , 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 Date: Wed, 13 Jun 2018 22:25:30 +1000 In-Reply-To: <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> <20180613074141.GA12033@infradead.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1 (3.28.1-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-06-13 at 00:41 -0700, Christoph Hellwig wrote: > 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. By direct ops I didn't mean *the* dma_direct_ops but a virtio-local variants that effectively reproduces the existing expectations (ie, virtio-dma-legacy-ops or something). > 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. Ben.