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=-5.3 required=3.0 tests=BAYES_00, 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 3E341C4363D for ; Fri, 25 Sep 2020 16:18:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E0A3F21D7A for ; Fri, 25 Sep 2020 16:18:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0A3F21D7A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7A0C06B007D; Fri, 25 Sep 2020 12:18:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 774D76B007E; Fri, 25 Sep 2020 12:18:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B37C6B0081; Fri, 25 Sep 2020 12:18:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 5530F6B007D for ; Fri, 25 Sep 2020 12:18:00 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1AD184DBE for ; Fri, 25 Sep 2020 16:18:00 +0000 (UTC) X-FDA: 77302090320.03.list38_0103b5f27169 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id A091D28A4EB for ; Fri, 25 Sep 2020 16:17:59 +0000 (UTC) X-HE-Tag: list38_0103b5f27169 X-Filterd-Recvd-Size: 3083 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 16:17:58 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 39A7E68AFE; Fri, 25 Sep 2020 18:17:55 +0200 (CEST) Date: Fri, 25 Sep 2020 18:17:54 +0200 From: Christoph Hellwig To: Robin Murphy Cc: Christoph Hellwig , Mauro Carvalho Chehab , Thomas Bogendoerfer , "James E.J. Bottomley" , Joonyoung Shim , Seung-Woo Kim , Ben Skeggs , Marek Szyprowski , Tomasz Figa , Matt Porter , iommu@lists.linux-foundation.org, alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-parisc@vger.kernel.org, linux-doc@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, Stefan Richter , netdev@vger.kernel.org, linux1394-devel@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: Re: [PATCH 08/18] dma-mapping: add a new dma_alloc_noncoherent API Message-ID: <20200925161754.GA18721@lst.de> References: <20200915155122.1768241-1-hch@lst.de> <20200915155122.1768241-9-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 25, 2020 at 12:15:37PM +0100, Robin Murphy wrote: > On 2020-09-15 16:51, Christoph Hellwig wrote: > [...] >> +These APIs allow to allocate pages in the kernel direct mapping that are >> +guaranteed to be DMA addressable. This means that unlike dma_alloc_coherent, >> +virt_to_page can be called on the resulting address, and the resulting > > Nit: if we explicitly describe this as if it's a guarantee that can be > relied upon... > >> +struct page can be used for everything a struct page is suitable for. > > [...] >> +This routine allocates a region of bytes of consistent memory. It >> +returns a pointer to the allocated region (in the processor's virtual address >> +space) or NULL if the allocation failed. The returned memory may or may not >> +be in the kernels direct mapping. Drivers must not call virt_to_page on >> +the returned memory region. > > ...then forbid this document's target audience from relying on it, > something seems off. At the very least it's unhelpfully unclear :/ > > Given patch #17, I suspect that the first paragraph is the one that's no > longer true. Yes. dma_alloc_pages is the replacement for allocations that need the direct mapping. I'll send a patch to document dma_alloc_pages and fixes this up