Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3193899imu; Mon, 28 Jan 2019 00:01:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN7FM4vnnm20bTiVu2Rg/jGji2RzTGmL1L+8R1BhPFxc1hroZILsq5WlFEb1Y+mkaF64S5sp X-Received: by 2002:a17:902:2a0a:: with SMTP id i10mr20589401plb.323.1548662464223; Mon, 28 Jan 2019 00:01:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548662464; cv=none; d=google.com; s=arc-20160816; b=wQeUeiWe7zPd+yUyXQMDNG+UsStvm7uaV1i1O3p3oMBDMsyoDhcW+eXDX9t8GTOWir nWAR51PWmWnf3GL5Wxl+oCfXD9q70yZwz0YRbXe8K+mHM+fcXkektsvBjV8kg2CdNuA9 bzvY8N2exT4RXxIlnCogIq3YnsXxFcGTEjyIKB38iFGROYlG78l713YkBdCso1keozX5 yUF3FBCQM+S8gA3yvN8XVHF+S4tEfDekdQjdwr9JPxa7ViAR3H3mNHoihacjWlv30FTv wdSQQOaUnUQfVJleVKAlZq4/OASk+7oH1HDmqnJp/JccIM5WZnuGh6K1RnvgCJlkjUht QtBQ== 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=NZGdrPgxkJ3GKEpUKB51umaHqCnKmWqhveXsvbsgygE=; b=l6rL7tuaO6kZwrGjNqXa6whfX+4qQ+TYvacsckLuxXMvXtydYCkoD76ZTx5s7L1lUR DKvfX7/eviWwg2iNLD97ogqLiDoSoB9AcUyXdIkjBCJmFhwkhDadQZBvo0eJr7Llge0L K8qlaRUXl6nogixYUmSIwFhBqrOSb7O85gPYCu38aFbO44XIqNjwkvq7nERhg6Hbs2IV giqEgXKIZcHiqKP7XxcUnDWlyOb0RmeNBpo//i0qofmuV1g+7J+BdfiSy5aLH2gmFAYG nXpFoqwg4cI5zfmSwLEAb+9tt+FVeVSPGROcfLIwZCPIs4TYDhkybu97BEL2U5JFwKfB O/3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lb4ct89m; 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 cf17si7094696plb.52.2019.01.28.00.00.48; Mon, 28 Jan 2019 00:01:04 -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=lb4ct89m; 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 S1726828AbfA1IAf (ORCPT + 99 others); Mon, 28 Jan 2019 03:00:35 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:56798 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726686AbfA1IAf (ORCPT ); Mon, 28 Jan 2019 03:00: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=NZGdrPgxkJ3GKEpUKB51umaHqCnKmWqhveXsvbsgygE=; b=lb4ct89mtlycA0t57CSkOi98e /sgvI17cMHXbXpKrtNNaK1bDe16f5eRmPss/pUIPstxyUrfN2hYE219fXt0h1MbhKYw4g+OFelpMs CU7Ac5KvxyKipxsqdwVNH7f+I79ezGtQa6fegSiy5tmtEAx+3AGZ6h+zY97rYlfI4IkwIQ0MbL3rJ OCPGs1nSNeP/NI0tIlWGgrVLsi0UF+KAWidO2n17dhGmZSlDzFwuk48bqZsblF1DucIt4PxL/rZin 1GIvHY3EM1FKuM0pU+k/hQfxcW7wFqv2DZn+GwD7lTTQlT3+QuUg0o2c0xw+PypRpO/iowaoaSNcp CzMgGbltA==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1go1qH-00088W-7X; Mon, 28 Jan 2019 08:00:29 +0000 Date: Mon, 28 Jan 2019 00:00:29 -0800 From: "hch@infradead.org" To: Peng Fan Cc: "hch@infradead.org" , Stefano Stabellini , "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" , Andy Duan Subject: Re: [Xen-devel] [RFC] virtio_ring: check dma_mem for xen_domain Message-ID: <20190128080028.GA18476@infradead.org> References: <20190121050056.14325-1-peng.fan@nxp.com> <20190123071232.GA20526@infradead.org> <20190123211405.GA4971@infradead.org> 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 Fri, Jan 25, 2019 at 09:45:26AM +0000, Peng Fan wrote: > Just have a question, > > Since vmalloc_to_page is ok for cma area, no need to take cma and per device > cma into consideration right? The CMA area itself it a physical memory region. If it is a non-highmem region you can call virt_to_page on the virtual addresses for it. If it is in highmem it doesn't even have a kernel virtual address by default. > we only need to implement a piece code to handle per device specific region > using RESERVEDMEM_OF_DECLARE, just like: > RESERVEDMEM_OF_DECLARE(rpmsg-dma, "rpmsg-dma-pool", > rmem_rpmsg_dma_setup); > And implement the device_init call back and build a map between page and phys. > Then in rpmsg driver, scatter list could use page structure, no need vmalloc_to_page > for per device dma. > > Is this the right way? I think this should work fine. If you have the cycles for it I'd actually love to be able to have generic CMA DT glue for non DMA API driver allocations, as there obviously is a need for it. So basically the same as above, just added to kernel/cma.c as a generic API.