Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8305477imu; Tue, 4 Dec 2018 06:23:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJ3dqlb23Kgo2JUkTSPh1jaA5X0OEkRxBTfy+wyWBgrtxR/G3SZCPaeyZUXAxVWdaijCJY X-Received: by 2002:a63:1e17:: with SMTP id e23mr16789890pge.130.1543933416112; Tue, 04 Dec 2018 06:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543933416; cv=none; d=google.com; s=arc-20160816; b=XnTR9pKamC9ykrHs/S0eKAYe57lB5z90us65iHI906J2H7UuJdJPQ8tSEqjq2L1kYQ r/y+YX2m23jcsiE34YaibepMZwV7DC8eeqY6iWZKW/pKjU+PirI/j0FgNIb1WrtoOhLn dr2UdI4oOCCVEHQSrteZI0ucALGarZ84TA1A82VjhTIzlOxFA7VdCEMK/HfY1fkuA8S6 JwqTKeJKAN1QIfiM0zuV6PUf24ZuTR2LhqNORJwksJjHA9D5CxrAJcr6oCwc9SosFkph XkXpamU9t8TM3WKSXt/f4T1vKgJ1a39Y8PDFjvV17VzLH/Q+/WVjVx2BgsJNoJ0L1mLj yB6Q== 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; bh=FMndusd1PCrje+fioA2zuRt2RT+Hb++y1XECeTEN/nA=; b=Od4IdQ4ZI9W5ZRB45rMO+MY6YH68wbSGPFBXN/qIhZTasDYU2h96usgXswlbmqe0ne gAKu93SwVFkj58tYH3Wz/vabUNTyxAqjD5lgFl0asFwmjtAzBg4MO0qLzaongnXJQkq3 nyHUtg2Aj67Hn+1VoHZaPnuvgvJWZblVpbxvczC0UTM0ue765HEuCFNcgFfXi3VfnEI8 9jugEyHpaf23reqsHdPQlVHOThwsdaqPf9c+RHKhtHD750GBUWfxDBN/QumagZn+8iAT 9KQulTG50Zdr6+fIBANHTrU1gtumHY0/vJR/SNit8SbWieugSJXk4gERYlcrmKJ9/GIJ ebkA== ARC-Authentication-Results: i=1; mx.google.com; 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 n13si121665pgp.307.2018.12.04.06.23.21; Tue, 04 Dec 2018 06:23:36 -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; 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 S1726385AbeLDOWS (ORCPT + 99 others); Tue, 4 Dec 2018 09:22:18 -0500 Received: from verein.lst.de ([213.95.11.211]:44016 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbeLDOWS (ORCPT ); Tue, 4 Dec 2018 09:22:18 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id C09C968BDF; Tue, 4 Dec 2018 15:22:16 +0100 (CET) Date: Tue, 4 Dec 2018 15:22:16 +0100 From: Christoph Hellwig To: Russell King - ARM Linux Cc: Christoph Hellwig , iommu@lists.linux-foundation.org, Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Guo Ren , Laura Abbott , Robin Murphy , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 4/9] dma-mapping: move the arm64 ncoherent alloc/free support to common code Message-ID: <20181204142216.GB2618@lst.de> References: <20181105121931.13481-1-hch@lst.de> <20181105121931.13481-5-hch@lst.de> <20181204100954.GN30658@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181204100954.GN30658@n2100.armlinux.org.uk> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +int __init dma_atomic_pool_init(gfp_t gfp, pgprot_t prot) > > +{ > > + unsigned int pool_size_order = get_order(atomic_pool_size); > > + unsigned long nr_pages = atomic_pool_size >> PAGE_SHIFT; > > + struct page *page; > > + void *addr; > > + int ret; > > + > > + if (dev_get_cma_area(NULL)) > > + page = dma_alloc_from_contiguous(NULL, nr_pages, > > + pool_size_order, false); > > + else > > + page = alloc_pages(gfp, pool_size_order); > > + if (!page) > > + goto out; > > + > > + memset(page_address(page), 0, atomic_pool_size); > > Note that this won't work if 'page' is a highmem page - should there > be a check for that, or a check for the gfp flags? > > Also, is this memset() actually useful, or a waste of cycles - when we > allocate from this pool (see dma_alloc_from_pool()), we always memset() > the buffer. Currently there is no user that supports highmem, but yes, the memset should probably simply be removed.