Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp453062imm; Mon, 4 Jun 2018 21:52:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKlyPnHWOo/HQOn3AcoqKJOFCqZ9G+bjRnRWBM7eze+1DjE9fAyCuDBNGPe/mI9+POqk3fy X-Received: by 2002:a17:902:7883:: with SMTP id q3-v6mr25039465pll.71.1528174376863; Mon, 04 Jun 2018 21:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528174376; cv=none; d=google.com; s=arc-20160816; b=vIB1m3Ng+3XIwKMZECXsP5+QPUvoJBfA0PNnYzhU0re+wZ6ZckGRSEqigChM3SGelU 8MVKwCDdIvtJaKmFZtCAKQIpumkLiCcGfpILgKLhBz/Qk4yMb06CjE5UJTmd2APbG9CR I6k2We9o00D9RPVtkkYpFByZK2SlHSoIeq5+RdoRRH2u1nqS8eVPNtu9LaykUM/dUl5d SMsNxfhY+j3PIdSV3uX1Hl8zZo1dZCvpU+yABFNXC147QgU4CcFdiT1YcfChw61HA62k UF4yFvRz7vaGsIMOQixTnlV/BAKlJPLuW1WKHkEje/kWv+0rZdUikHxOxJQOEn0J67pg Ty2g== 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=2IqOuVFLfShaz2b8GmC8zDcaTC9xc8YChjw21Ns2ll8=; b=c439DSdlKM+EIF/hwLZ8MsnJDp8qf85Gq/MrIQ+9YTdlZBRuV0nWc2z8d3g4z10UPh zLPosZjYW11E/M36aXb8Nyl21N89B9xhaZwbvtukfmMYHHc/wToafR7P9HzMq6/lpwbI a3o/7oDrMTiGf2wtUrpGVelHxZ6k6VvQBfZvcenjIKb3hSfOYi7g4jCavaC0ue+Cszhy HGO6S4PSKSUgaue+PnBn6F1ef5LjWXIJYOVbD1/FTpPF47TJ6GbPs6GzE9Rlb1/aLPv/ MHw4t8fZw2j5gGSzDeYhRKcILjidFKON+lgtEaeBCnvTaLXGXaHVj7euueyWDDHlYy2P DfJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sFdOK7fZ; 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 89-v6si49457407plc.59.2018.06.04.21.52.42; Mon, 04 Jun 2018 21:52:56 -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=sFdOK7fZ; 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 S1751544AbeFEEwO (ORCPT + 99 others); Tue, 5 Jun 2018 00:52:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36284 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751498AbeFEEwN (ORCPT ); Tue, 5 Jun 2018 00:52:13 -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=2IqOuVFLfShaz2b8GmC8zDcaTC9xc8YChjw21Ns2ll8=; b=sFdOK7fZumeJ+TG6ZdG4eKpgC uLsMCa0lWNN33uxCVjC6ELE+YLfBNA/nZnH5JJXNGJ0B98KwAAbSiWPuWK0emFOooNXVrmrk4kXjw Az1DV2kM2T+FsxQhVYDEPbOLml/UrfM3SIW4DJnkS5+2PIXBIzyFOaXgzNpS22/ymD0RtlSQHSQby iRl6zXM3ln61ubEAj00JpvgGTRj4YQfLiXQfDLxAisgHA5xSp6QvWJj86eGD5uK5wRCjn7mbxU0I6 ByMBPGMpS8QjUMZ4lUWlhgbtzAa7HXssgsVCMVF1RatpSE2RSmwMHpi9hjZpFDh3DY5ov+PkEIN5m KNT5JmSDw==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQ3x2-0006iE-7d; Tue, 05 Jun 2018 04:52:08 +0000 Date: Mon, 4 Jun 2018 21:52:08 -0700 From: Christoph Hellwig To: Benjamin Herrenschmidt Cc: "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, hch@infradead.org, luto@amacapital.net Subject: Re: [RFC V2] virtio: Add platform specific DMA API translation for virito devices Message-ID: <20180605045207.GA28447@infradead.org> References: <20180522063317.20956-1-khandual@linux.vnet.ibm.com> <20180523213703-mutt-send-email-mst@kernel.org> <20180604153558-mutt-send-email-mst@kernel.org> <20180604184035-mutt-send-email-mst@kernel.org> <6164442a718645a754879eac5c4c5fad9283c211.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6164442a718645a754879eac5c4c5fad9283c211.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 Tue, Jun 05, 2018 at 09:26:56AM +1000, Benjamin Herrenschmidt wrote: > Sorry Michael, that doesn't click. Yes of course virtio is implemented > in qemu, but the problem we are trying to solve is *not* a qemu problem > (the fact that the Linux drivers bypass the DMA API is wrong, needs > fixing, and isnt a qemu problem). The fact that the secure guests need > bounce buffering is not a qemu problem either. > > Whether qemu chose to use an iommu or not is, and should remain an > orthogonal problem. Agreed. We have a problem with qemu (old qemu only?) punching a hole into the VM abstraction by deciding that even if firmware tables claim use of an IOMMU for a PCI bus it expects virtio to use physiscal addresses. So far so bad. The answer to that should have been to quirk the affected qemu versions and move on. Instead we now have virtio not use the DMA API by default and are creating a worse problem. Let's fix this issue ASAP and quirk the buggy implementations instead of letting everyone else suffer. > The DMA API itself isn't the one that needs to learn "per-device > quirks", it's just plumbing into arch backends. The "quirk" is at the > point of establishing the backend for a given device. > > We can go a good way down that path simply by having virtio in Linux > start with putting *itself* its own direct ops in there when > VIRTIO_F_IOMMU_PLATFORM is not set, and removing all the special casing > in the rest of the driver. Yes. And we have all the infrastructure for that now. A few RDMA drivers quirk to virt_dma_ops, and virtio could quirk to dma_direct_ops anytime now. In fact given how much time we are spending arguing here I'm going to give it a spin today. > Once that's done, we have a single point of establishing the dma ops, > we can quirk in there if needed, that's rather nicely contained, or put > an arch hook, or whatever is necessary. Yes.