From patchwork Mon Dec 4 16:35:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10090947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F61660327 for ; Mon, 4 Dec 2017 16:36:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0354427FA9 for ; Mon, 4 Dec 2017 16:36:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC0F2287B1; Mon, 4 Dec 2017 16:36:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 87C3F27FA9 for ; Mon, 4 Dec 2017 16:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TOKQztRjlMWJ8PjFK6PHfjq6h7Kyn67bnQ7i7296KzE=; b=NCyTi326ZXm17I+iLKZet2UOsx MUOmTD1R84AkaaiCV6xiRZqTzW2MyrT15uJInqgKAaaRPPf92dqCFp/E0h6uQnOgCYueGb4QjddX8 NHnOI33tyDvSiqCnuMSd110zad/TZSjtUdVgINwVK7Ff8vY1ERRPiKVRJA5c6ALmGPxi76RclaEIB ETpfAF4SOlxZymx7r58gdV4DmomBRg6U6EkRL2dC2jEhc+LgNPw1zgz9vLO0tLEtgFFi5G9nrCs0p ztoWqS3xasJewlpsNeb6FdqJdypTiintejmdphmVnjxE2LoYbXwRVjF/sSg0p/fI6Dzp/xxEJQYtA DKrvBzcA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLtjX-0005HU-Hx; Mon, 04 Dec 2017 16:36:43 +0000 Received: from rap-us.hgst.com ([199.255.44.250] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1eLtis-0004eW-EB; Mon, 04 Dec 2017 16:36:02 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-block@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] dma-mapping: take dma_pfn_offset into account in dma_max_pfn Date: Mon, 4 Dec 2017 08:35:59 -0800 Message-Id: <20171204163601.3055-2-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204163601.3055-1-hch@lst.de> References: <20171204163601.3055-1-hch@lst.de> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This makes sure the generic version can be used with architectures / devices that have a DMA offset in the direct mapping. Signed-off-by: Christoph Hellwig --- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index e8f8e8fb244d..86beb9861618 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -692,7 +692,7 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) #ifndef dma_max_pfn static inline unsigned long dma_max_pfn(struct device *dev) { - return *dev->dma_mask >> PAGE_SHIFT; + return (*dev->dma_mask >> PAGE_SHIFT) + dev->dma_pfn_offset; } #endif