Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5967390imu; Mon, 21 Jan 2019 00:30:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN4A1Ey4EG89cKpRoW55xPJ7V/lsADrQZPFVEnWItcruEPdrKfZVsx74qY5ThBJO0HGnwNsZ X-Received: by 2002:a63:314d:: with SMTP id x74mr27137294pgx.10.1548059440599; Mon, 21 Jan 2019 00:30:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548059440; cv=none; d=google.com; s=arc-20160816; b=ktfuPXhvfd3DZNi7FzUzHEjERN4IC7MBoMc4mF1JiSutUD1MQ4El4x52k497AHfSFf iCS7G1CCIpKutqCK8DXgtTnVrxVv6kW8BjFW4anESbZZxvrLk5gv124zuJxlox2pAKA0 IBQXteb99x9jJhRhq7yL5mVDz9u0ubEFIZcRo2uJGVCN652E+jcfYIjaJgfuGV5fWAYJ /V068BC/2txq7qubfe6qkNRhGxEG7y6twp7P17+SxHUEINvz/zpkkVOUKh95zYqK/hK3 N2WSPaxxYkPx198aFNiVzkcuIA+JgZKNqmyNls6JfiskehKNkN9X/x7LcpK0NvR9FpZ+ Xn4Q== 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=fCoGQM1JMNeKC9RxqPi2EysR5pQSJP0jB0mOgBL7qSE=; b=A1cL29D8dOJCLxmsSArhYGct5AUnZCSQ0oIPEd8qPcCxMYUjb89TCf8/88S1/FubOP Fd1eeQsofRoqbYG7RyaJB2wp6dbhV3bC3q1ZnVOrw6omvNFTXYzWAK4f38kgSn4sGeL1 EL0FrvjMg39fo0V1v9wuH69xRNiTYXrw+8vyi62EAe+TUYi/BxF9S+5NmSG/CrEJPZ5r 5UZ6cNkzA4ByxmveWLy/hIG4hU8WZ0jxeDHHnfegJcnPE9lpDCEByiobSYHCGrWD6kYA 1P57ov6EysjvKqQh9saXJabG6M+i4ie5vhvjZlhUiIatltNgQvL9rz5QJ7DB7dMHBLXu hNtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=i97PveTH; 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 v7si11872958plo.12.2019.01.21.00.30.25; Mon, 21 Jan 2019 00:30:40 -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=i97PveTH; 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 S1728862AbfAUI2f (ORCPT + 99 others); Mon, 21 Jan 2019 03:28:35 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:45568 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727979AbfAUI2f (ORCPT ); Mon, 21 Jan 2019 03:28: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=fCoGQM1JMNeKC9RxqPi2EysR5pQSJP0jB0mOgBL7qSE=; b=i97PveTH70c7385c1ATzPG7EL FkGVX1vaixpcDXhFLfAP13hdHJ5BB5UmaiOYJSk2nx8OIAf8dWiJ/SsxwTlgW9IFvV/v9WwLg2lJ4 lc81GKb/BzV/j7JAr02Y4fytwW5dmEOo5kbior1QQvlQoNq5wysuSXCaHC0nuCvx0aVUt3EnWiReJ cnl3s3AKw+lfA3ecvonJ55aSyy+pDAKca1HPpvcRvp5BMZWd60qEXIQiDc/njqDstHv+XVNjrTsDz KQKbqZ8bXAt6b+84aq3p/s4cB+3nic+oEEfsivLCif4e9SRw0Kx9psmwHXG1TcdznTHjt+1d45tk5 nFUFYhiQA==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1glUwZ-0003c6-8c; Mon, 21 Jan 2019 08:28:31 +0000 Date: Mon, 21 Jan 2019 00:28:30 -0800 From: "hch@infradead.org" To: Peng Fan Cc: "mst@redhat.com" , "jasowang@redhat.com" , "sstabellini@kernel.org" , "hch@infradead.org" , "virtualization@lists.linux-foundation.org" , "xen-devel@lists.xenproject.org" , "linux-kernel@vger.kernel.org" , "linux-remoteproc@vger.kernel.org" Subject: Re: [RFC] virtio_ring: check dma_mem for xen_domain Message-ID: <20190121082830.GC12420@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: <20190121050056.14325-1-peng.fan@nxp.com> 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, Jan 21, 2019 at 04:51:57AM +0000, Peng Fan wrote: > on i.MX8QM, M4_1 is communicating with DomU using rpmsg with a fixed > address as the dma mem buffer which is predefined. > > Without this patch, the flow is: > vring_map_one_sg -> vring_use_dma_api > -> dma_map_page > -> __swiotlb_map_page > ->swiotlb_map_page > ->__dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir); > However we are using per device dma area for rpmsg, phys_to_virt > could not return a correct virtual address for virtual address in > vmalloc area. Then kernel panic. And that is the right thing to do. You must not call dma_map_* on memory that was allocated from dma_alloc_*. We actually have another thread which appears to be for this same issue.