From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6D32C06511 for ; Mon, 1 Jul 2019 17:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D68F21841 for ; Mon, 1 Jul 2019 17:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730310AbfGARyu (ORCPT ); Mon, 1 Jul 2019 13:54:50 -0400 Received: from foss.arm.com ([217.140.110.172]:37980 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727700AbfGARyu (ORCPT ); Mon, 1 Jul 2019 13:54:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7331228; Mon, 1 Jul 2019 10:54:49 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 890D63F703; Mon, 1 Jul 2019 10:54:48 -0700 (PDT) Subject: Re: DMA-API attr - DMA_ATTR_NO_KERNEL_MAPPING To: Pankaj Suryawanshi Cc: Christoph Hellwig , linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Michal Hocko References: <20190626175131.GA17250@infradead.org> From: Robin Murphy Message-ID: <0725b9aa-0523-daef-b4ff-7e2dd910cf3c@arm.com> Date: Mon, 1 Jul 2019 18:54:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/07/2019 18:47, Pankaj Suryawanshi wrote: >> If you want a kernel mapping, *don't* explicitly request not to have a >> kernel mapping in the first place. It's that simple. >> > > Do you mean do not use dma-api ? because if i used dma-api it will give you > mapped virtual address. > or i have to use directly cma_alloc() in my driver. // if i used this > approach i need to reserved more vmalloc area. No, I mean just call dma_alloc_attrs() normally *without* adding the DMA_ATTR_NO_KERNEL_MAPPING flag. That flag means "I never ever want to make CPU accesses to this buffer from the kernel" - that is clearly not the case for your code, so it is utterly nonsensical to still pass the flag but try to hack around it later. Robin.