Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753979AbbG0PcZ (ORCPT ); Mon, 27 Jul 2015 11:32:25 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:44278 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbbG0PcX (ORCPT ); Mon, 27 Jul 2015 11:32:23 -0400 Date: Mon, 27 Jul 2015 16:31:48 +0100 From: Russell King - ARM Linux To: Robin Murphy Cc: Yong Wu , Joerg Roedel , Thierry Reding , Mark Rutland , Matthias Brugger , "devicetree@vger.kernel.org" , "pebolle@tiscali.nl" , "arnd@arndb.de" , "srv_heupstream@mediatek.com" , Catalin Marinas , Will Deacon , "linux-kernel@vger.kernel.org" , Tomasz Figa , "iommu@lists.linux-foundation.org" , Rob Herring , Daniel Kurtz , Sasha Hauer , "cloud.chou@mediatek.com" , "linux-mediatek@lists.infradead.org" , "frederic.chen@mediatek.com" , "mitchelh@codeaurora.org" , "linux-arm-kernel@lists.infradead.org" , Lucas Stach Subject: Re: [PATCH v3 5/6] iommu/mediatek: Add mt8173 IOMMU driver Message-ID: <20150727153148.GJ7557@n2100.arm.linux.org.uk> References: <1437037475-9065-1-git-send-email-yong.wu@mediatek.com> <1437037475-9065-6-git-send-email-yong.wu@mediatek.com> <55B630CE.4050803@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B630CE.4050803@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1457 Lines: 36 On Mon, Jul 27, 2015 at 02:23:26PM +0100, Robin Murphy wrote: > On 16/07/15 10:04, Yong Wu wrote: > >This patch adds support for mediatek m4u (MultiMedia Memory Management > >Unit). > > > >Signed-off-by: Yong Wu > [...] > >+static void mtk_iommu_flush_pgtable(void *ptr, size_t size, void *cookie) > >+{ > >+ struct mtk_iommu_domain *domain = cookie; > >+ unsigned long offset = (unsigned long)ptr & ~PAGE_MASK; > >+ > >+ dma_map_page(domain->data->dev, virt_to_page(ptr), offset, > >+ size, DMA_TO_DEVICE); > > Nit: this looks like it may as well be dma_map_single. > > It would probably be worth following it with a matching unmap too, just to > avoid any possible leakage bugs (especially if this M4U ever appears in a > SoC supporting RAM above the 32-bit boundary). Why not do the job properly? Take a look at how I implemented the streaming DMA API on Tegra SMMU (patch set recently sent out earlier today). There's no need for hacks like dma_map_page() (and discarding it's return value) or dma_map_page() followed by dma_unmap_page(). -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/