From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH v5 1/3] iommu/rockchip: rk3288 iommu driver Date: Wed, 22 Oct 2014 17:12:54 +0200 Message-ID: <20141022151254.GJ10074@8bytes.org> References: <1413273762-32489-1-git-send-email-djkurtz@chromium.org> <1413273762-32489-2-git-send-email-djkurtz@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1413273762-32489-2-git-send-email-djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Daniel Kurtz Cc: "open list:OPEN FIRMWARE AND..." , Simon Xue , Grant Grundler , open list , "open list:ARM/Rockchip SoC..." , "open list:IOMMU DRIVERS" , Rob Herring , Grant Likely , =?iso-8859-1?Q?St=E9phane?= Marchesin , "moderated list:ARM/Rockchip SoC..." , Heiko Stuebner List-Id: devicetree@vger.kernel.org On Tue, Oct 14, 2014 at 04:02:40PM +0800, Daniel Kurtz wrote: > +static void rk_iommu_detach_device(struct iommu_domain *domain, > + struct device *dev) > +{ > + struct rk_iommu *iommu = dev_get_drvdata(dev->archdata.iommu); > + struct rk_iommu_domain *rk_domain = domain->priv; > + unsigned long flags; > + > + /* Allow 'virtual devices' (eg drm) to detach from domain */ > + if (!iommu) > + return; > + > + iommu->domain = NULL; I guess this line is a left-over? Setting iommu->domain to NULL here before you disabled the IOMMU interrupt is racy. To be fully secure, you should make sure that no interrupt handler is still running after you disabled the IOMMU irq and before setting iommu->domain = NULL. Other than that the code looks good. Joerg