Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1232320imu; Wed, 23 Jan 2019 13:05:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Q6SNEh391IjJ7lNv35RHDVEzz+jIgIYgVhABWaUtnlKAgOE/fV8I/PtZCqSdleGIQzn1o X-Received: by 2002:a63:1204:: with SMTP id h4mr3459155pgl.51.1548277508320; Wed, 23 Jan 2019 13:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548277508; cv=none; d=google.com; s=arc-20160816; b=P25LrAqBA/hGgY6ugXsBQoTlfL9TiCPmJ8kZIRDok2WY9rs3Etp6zBU/KX+qCTlxBv iJnDa9zTmjMeuiukQWhh3cBI+LJabS9MvKY1g//hKkkv4SZk75BPfLaRWa9d7RmdiLu/ VO1vdaTnKmutA1WgQ3YkYRuNR7qc/56cHtNHaidHMeC7xMBm8W6CPoHOQdPIVVl2Dusj OhIkmmNC9teLVlphzXVMdHZZ8bU4jAuD0tHaNWYxC8aQ/8Cjc89tqAnDpqetmIAs7A6b HMELfUYWAcHKliLs8HkrB5G2x2e254HmndIU5d8o43l1VV5uZh1PRrPYwjyGtReiWXY9 78TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=1XfMkHR01ZzA9q5xh1puXnMVRHP4i3E2twbtcBzXh4c=; b=ylEEz/GKYPLmTqBSifB7yk32IZs/XPkR4GpEf90eG2Sr4uCCOoiyOLjiykk0hVecQb FMTdkCnOEn0v1sQYG2Ow/wJ2pbKNrhucNPYOLUjLiV3wXXjN61y+2tWST6buijrQqvQ2 3LK31wXqlSpp4OxAm911hX+/axSY2adynvkhx28YCS/N4fY1CeoqR0O4ILw/S2c9/2pi T2zck719mDf26P0qsKqfhjfzrnXmkvQjhkcLS+AdLDeSKxVEfjbvXXyAnBbpqmSa9GQo TuHX6g+odxzGg6JgdxJkLeNUEysuH+6Ib0z/aDJCdP6kjTjHYeH5G8XrGaWrRS2snpZE 9lmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yenVbHLa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si10509621pfc.248.2019.01.23.13.04.52; Wed, 23 Jan 2019 13:05:08 -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=pass header.i=@kernel.org header.s=default header.b=yenVbHLa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbfAWVEf (ORCPT + 99 others); Wed, 23 Jan 2019 16:04:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:44574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfAWVEf (ORCPT ); Wed, 23 Jan 2019 16:04:35 -0500 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1968921855; Wed, 23 Jan 2019 21:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548277474; bh=4XZm6kkJrkFGkeMIw0vN9Jlw6P6+8wJJHw9UXxIfz+o=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=yenVbHLaOJrzgchso7V+75DEY/6ECu3m2AZzJ1r+wwp1Wx2mtdGonLXdZyGvUbbVS AUySSKM+cBM6BQn4eEPZ3yhxgTzy+CUOWi1eFMYSc6HavkclPh5ypCdOgHmo9Q0swN iSJk8PcvSel2k787UV96vLnXZVzvmgckXmU59TS8= Date: Wed, 23 Jan 2019 13:04:33 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: "hch@infradead.org" cc: Stefano Stabellini , Peng Fan , "mst@redhat.com" , "jasowang@redhat.com" , "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 In-Reply-To: <20190123071232.GA20526@infradead.org> Message-ID: References: <20190121050056.14325-1-peng.fan@nxp.com> <20190123071232.GA20526@infradead.org> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Jan 2019, hch@infradead.org wrote: > 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. If vring_use_dma_api is actually supposed to return true when dma_dev->dma_mem is set, then both Peng's patch and the patch I wrote are not fixing the real issue here. I don't know enough about remoteproc to know where the problem actually lies though.