From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754175AbcGTOBh (ORCPT ); Wed, 20 Jul 2016 10:01:37 -0400 Received: from 8bytes.org ([81.169.241.247]:54561 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753577AbcGTOBa (ORCPT ); Wed, 20 Jul 2016 10:01:30 -0400 Date: Wed, 20 Jul 2016 16:01:27 +0200 From: Joerg Roedel To: honghui.zhang@mediatek.com Cc: treding@nvidia.com, mark.rutland@arm.com, matthias.bgg@gmail.com, robh@kernel.org, robin.murphy@arm.com, p.zabel@pengutronix.de, devicetree@vger.kernel.org, pebolle@tiscali.nl, kendrick.hsu@mediatek.com, arnd@arndb.de, srv_heupstream@mediatek.com, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, tfiga@google.com, iommu@lists.linux-foundation.org, robh+dt@kernel.org, djkurtz@google.com, kernel@pengutronix.de, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de, yingjoe.chen@mediatek.com, eddie.huang@mediatek.com, youlin.pei@mediatek.com, erin.lo@mediatek.com Subject: Re: [RFC PATCH] iommu: create direct_mapping after device attached Message-ID: <20160720140127.GA3030@8bytes.org> References: <1469018961-16367-1-git-send-email-honghui.zhang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1469018961-16367-1-git-send-email-honghui.zhang@mediatek.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 20, 2016 at 08:49:21PM +0800, honghui.zhang@mediatek.com wrote: > From: Honghui Zhang > > For mtk iommu, the domain_finalize was called in device attatch, the mtk > iommu iopgt ops was allocated and initialized in domain_finalize, the > iommu_group_create_direct_mappings would call the map interface to > implement the map. If it's earlier than device attach, there would be NULL > dereference. Move the iommu_group_create_direct_mappings call after device > attached. No, this would open a race window where the device is attached, but doesn't have its unity-mappings in place. You should re-organize the mtk driver instead, so that it works in this order too. Joerg