Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp464040imu; Tue, 22 Jan 2019 23:14:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rRgJJd+4ROT1W6Bj4vm7NANjJoxZhbxhDhtnVsn9q4/D0Qf+GmoxGAsblxYhhZv/R4B63 X-Received: by 2002:a17:902:66e6:: with SMTP id e93mr1130113plk.92.1548227693445; Tue, 22 Jan 2019 23:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548227693; cv=none; d=google.com; s=arc-20160816; b=0HiFLcbRGERGltZ51igdkypj7zpwoBwM5/zUT0AHvpVrxFDH5OsCunJbGXpsvGdCaC okZGAxzGiZWcqiilYTlatvfrH5YrbI2FWsdmy63+zRq8MIXTMnkLmlh9OV03GOqPBixg CY4JZLyvDZxUg5TYmlnMCt9WcATHiR/NuDr0A2Dn29SDC6pa5w8sZZWMRcdpozjwJV6V l2h3EllZZwSJClrPw+tswwLJZXLVCJEw8kQGyjmlgL0Ch7BGFGzndQRYhV4GND2+KTsZ Ym57CI8PFs9udm0D94cOw0ewLg5lsZIb+4LTiNr1WaAcdgFMRgHf0hUKf0rdTIMBFdrh lnig== 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; bh=jRirieLgRGM56VeJxAWJgEI7+mG7GYr1VreLIKUztis=; b=JK3z11hfkaplbdLSU9lb3YW3B+nMg1Sf+QDQyoGQH0a5U9jMNmwaO9DGO+HSYhegVW nDSeAZh9bHNZNgKcZNQVu4p+Nak/gwrlTNTwyXAhct+Wg4GyO1HFAZ1ZMX3c0f98hMtK Bqtd9REec0zYpVxQFVuajlNPEbtNTVJ1BCRQwk4eOM3hN5A68QBdAEgJzH1qi+pvNGkx Qv7V5pt01KA9UMVQXQfY22IX2w0wJjiQI+Dtol6yTFAeI3JUJQgn170lvOHY33wlUx0K 5OFpnBs3YHq1iGia38f50q5I1Z7RgdAsExzo2uN8sMFcQiaYziB3TmfSUomUnv1pTUHL 4CsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jxbEv7H6; 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 l66si19909676pga.151.2019.01.22.23.14.37; Tue, 22 Jan 2019 23:14:53 -0800 (PST) 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=jxbEv7H6; 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 S1726207AbfAWHMg (ORCPT + 99 others); Wed, 23 Jan 2019 02:12:36 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:59808 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfAWHMf (ORCPT ); Wed, 23 Jan 2019 02:12:35 -0500 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=jRirieLgRGM56VeJxAWJgEI7+mG7GYr1VreLIKUztis=; b=jxbEv7H6cSLfj3r8Gyo3ZPu6N qYvn+ZOuW0zdGGj7p+jdZBVD+Oe1101ue/m12CTnDUtnYZbSCjf3bj18B7xR1bNL1II9bNGg1Q0ui K+jTEbFDu/TbG8nPex3RP2INa/WGmBS34GWhk0FWsaFeFgX6CIfovdzgwEp6gsJNMCh4OMyHI5TK+ QQDoZTXj8ySB91nXJnRhzOYAn5HoZ8FdY0/Cy95+3roClavCwpd/R2vAepIGPJYq7ltUK++MXRp1E Dpu/U2JpFXrLmlY/e93JUEUpPQyfXHo8BlvjYTEIYmsp5rAscGG6R8pNe80JZoBWev/modYWMeXL/ 0NrYXL8fg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmCi8-0005NW-Eq; Wed, 23 Jan 2019 07:12:32 +0000 Date: Tue, 22 Jan 2019 23:12:32 -0800 From: "hch@infradead.org" To: Stefano Stabellini Cc: Peng Fan , "mst@redhat.com" , "jasowang@redhat.com" , "hch@infradead.org" , "xen-devel@lists.xenproject.org" , "linux-remoteproc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , luto@kernel.org, jgross@suse.com, boris.ostrovsky@oracle.com Subject: Re: [Xen-devel] [RFC] virtio_ring: check dma_mem for xen_domain Message-ID: <20190123071232.GA20526@infradead.org> References: <20190121050056.14325-1-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Jan 22, 2019 at 11:59:31AM -0800, Stefano Stabellini wrote: > > if (!virtio_has_iommu_quirk(vdev)) > > return true; > > > > @@ -260,7 +262,7 @@ static bool vring_use_dma_api(struct virtio_device *vdev) > > * the DMA API if we're a Xen guest, which at least allows > > * all of the sensible Xen configurations to work correctly. > > */ > > - if (xen_domain()) > > + if (xen_domain() && !dma_dev->dma_mem) > > return true; > > > > return false; > > I can see you spotted a real issue, but this is not the right fix. We > just need something a bit more flexible than xen_domain(): there are > many kinds of Xen domains on different architectures, we basically want > to enable this (return true from vring_use_dma_api) only when the xen > swiotlb is meant to be used. Does the appended patch fix the issue you > have? The problem generally is the other way around - if dma_dev->dma_mem is set the device decription in the device tree explicitly requires using this memory, so we must _always_ use the DMA API. The problem is just that that rproc driver absuses the DMA API in horrible ways.