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: iommu@lists.linux-foundation.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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: joro@8bytes.org (Joerg Roedel) Date: Wed, 22 Oct 2014 17:12:54 +0200 Subject: [PATCH v5 1/3] iommu/rockchip: rk3288 iommu driver In-Reply-To: <1413273762-32489-2-git-send-email-djkurtz@chromium.org> References: <1413273762-32489-1-git-send-email-djkurtz@chromium.org> <1413273762-32489-2-git-send-email-djkurtz@chromium.org> Message-ID: <20141022151254.GJ10074@8bytes.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753145AbaJVPM6 (ORCPT ); Wed, 22 Oct 2014 11:12:58 -0400 Received: from 8bytes.org ([81.169.241.247]:36968 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751980AbaJVPM4 (ORCPT ); Wed, 22 Oct 2014 11:12:56 -0400 Date: Wed, 22 Oct 2014 17:12:54 +0200 From: Joerg Roedel To: Daniel Kurtz Cc: Grant Grundler , =?iso-8859-1?Q?St=E9phane?= Marchesin , Simon Xue , Heiko Stuebner , Grant Likely , Rob Herring , open list , "open list:IOMMU DRIVERS" , "moderated list:ARM/Rockchip SoC..." , "open list:ARM/Rockchip SoC..." , "open list:OPEN FIRMWARE AND..." Subject: Re: [PATCH v5 1/3] iommu/rockchip: rk3288 iommu driver 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-Disposition: inline In-Reply-To: <1413273762-32489-2-git-send-email-djkurtz@chromium.org> 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 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