Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2510060ybh; Mon, 5 Aug 2019 02:13:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcBVZxjMmHFtSo05vEldJzrHXdUJYq9WMyDcgo4gJb4FIHE9mTOCixVMryCUSyeCJ1UFi+ X-Received: by 2002:a65:64ce:: with SMTP id t14mr69234286pgv.137.1564996381677; Mon, 05 Aug 2019 02:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564996381; cv=none; d=google.com; s=arc-20160816; b=vy+Q9iP/e1K8qxWcp24BYALmEvRmDyUrXsxMyo4pPizfk240H2L+qzgiWW5J45uq3y t/etsMPc74lx72z5bldPmppH7CXQZxdvPS7hXdyWhW5K1TIFurgyMjjZ1UwrBhLnCal+ K8xBvoW/7cdDN0ZsBF+L1rkMY1hWZxyfnQoIdN3u+H55Z3SdMd+7H7xy+6TNalF3xsyX Obo9evNUL0i/XZZp/LodMSIroTiT1YpX+usCIxdMNsGAoh9Rnia4oSKNZ1bkGnYpXYK7 DmwVls0iP1/dQsXTnuAkcPO7GK56QaKrio2ivBKP+sEbQQVIsAmGMgyj7xDVcuJ+Wu+x aseg== 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=AKuwi3+E773k69DkmJMzTtQaZpU3Xng+dVigkwucuUo=; b=KstIVqEh1reRtkrdAVobJ1KkdYPGPdYSsBtO1Vg7HsaMNxfW2/qX47x4J7GXXU+Rxu v9Aj7r3SXYF8tdz8HwZTFZrzVFBz9INAIC71VDlhaEXcVgqF0aMRpF2pe/KDWFo2qc12 lyMBNx0iEIf/YiqwlDLhWx2dJF95/aOpcKb03ki026cz6xhCYluHuhsHzNvnt8c9Td3s DYtjYWq5TIaZJvGDtgI2UbeNS5OuxTMtvmBAu2U0xpYkfGns2IQoJ3nlD5oQVSO6M+jt xEYgpkvwyXoFWfkExQLS+M/qM/8tPp6XQ/cq6Zl0RNt9uRKvT5ZYXsM8WHhW2TYhLDmE 2eUQ== 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 c7si46152324pfi.253.2019.08.05.02.12.45; Mon, 05 Aug 2019 02:13:01 -0700 (PDT) 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 S1727809AbfHEJK5 (ORCPT + 99 others); Mon, 5 Aug 2019 05:10:57 -0400 Received: from foss.arm.com ([217.140.110.172]:44062 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726423AbfHEJK4 (ORCPT ); Mon, 5 Aug 2019 05:10:56 -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 2AC9428; Mon, 5 Aug 2019 02:10:56 -0700 (PDT) Received: from iMac.local (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4CDE03F694; Mon, 5 Aug 2019 02:10:54 -0700 (PDT) Date: Mon, 5 Aug 2019 10:10:52 +0100 From: Catalin Marinas To: Christoph Hellwig Cc: iommu@lists.linux-foundation.org, Shawn Anastasio , Michael Ellerman , Russell King , Will Deacon , Robin Murphy , Paul Burton , James Hogan , linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Gavin Li Subject: Re: [PATCH 1/2] dma-mapping: fix page attributes for dma_mmap_* Message-ID: <20190805091051.GB59981@iMac.local> References: <20190805080145.5694-1-hch@lst.de> <20190805080145.5694-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190805080145.5694-2-hch@lst.de> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 05, 2019 at 11:01:44AM +0300, Christoph Hellwig wrote: > All the way back to introducing dma_common_mmap we've defaulyed to mark s/defaultyed/defaulted/ > the pages as uncached. But this is wrong for DMA coherent devices. > Later on DMA_ATTR_WRITE_COMBINE also got incorrect treatment as that > flag is only treated special on the alloc side for non-coherent devices. > > Introduce a new dma_pgprot helper that deals with the check for coherent > devices so that only the remapping cases even reach arch_dma_mmap_pgprot s/even/ever/ > diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c > index 1d3f0b5a9940..bd2b039f43a6 100644 > --- a/arch/arm64/mm/dma-mapping.c > +++ b/arch/arm64/mm/dma-mapping.c > @@ -14,9 +14,7 @@ > pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot, > unsigned long attrs) > { > - if (!dev_is_dma_coherent(dev) || (attrs & DMA_ATTR_WRITE_COMBINE)) > - return pgprot_writecombine(prot); > - return prot; > + return pgprot_writecombine(prot); > } For arm64: Acked-by: Catalin Marinas