From: Ian Campbell Subject: Re: [PATCH v3 13/13] drivers/passthrough: arm: Add support for SMMU drivers Date: Tue, 18 Mar 2014 16:54:49 +0000 Message-ID: <1395161689.11824.27.camel@kazak.uk.xensource.com> References: <1394552999-14171-1-git-send-email-julien.grall@linaro.org> <1394552999-14171-14-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WPxHz-0008Fo-0h for xen-devel@lists.xenproject.org; Tue, 18 Mar 2014 16:54:55 +0000 In-Reply-To: <1394552999-14171-14-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, Jan Beulich , tim@xen.org, Xiantao Zhang , stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, 2014-03-11 at 15:49 +0000, Julien Grall wrote: > This patch add support for ARM architected SMMU driver. It's based on the > linux drivers (drivers/iommu/arm-smmu) commit 89ac23cd. > > The major differences with the Linux driver are: > - Fault by default if the SMMU is enabled to translate an > address (Linux is bypassing the SMMU) > - Using P2M page table instead of creating new one > - Dropped stage-1 support > - Dropped chained SMMUs support for now > - Reworking device assignment and the different structures > > Xen is programming each IOMMU by: > - Using stage-2 mode translation > - Sharing the page table with the processor > - Injecting a fault if the device has made a wrong translation > > Signed-off-by: Julien Grall > Cc: Xiantao Zhang > Cc: Jan Beulich I don't think it is sensible to try and review this code in great detail given you no doubt did so as you imported it. I looked through the bits which seemed like they were new Xen code rather than imported Linux code. It mostly looks good, one question and when grammar nit. > +static __init void arm_smmu_device_reset(struct arm_smmu_device *smmu) > +{ > +[...] > + /* Don't upgrade barriers */ > + reg &= ~(SMMU_sCR0_BSU_MASK << SMMU_sCR0_BSU_SHIFT); No? Is that safe when a vcpu migrates around pCPUs? > + > +static int __init smmu_init(struct dt_device_node *dev, > + const void *data) > +{ > + struct arm_smmu_device *smmu; > + int res; > + u64 addr, size; > + unsigned int num_irqs, i; > + struct dt_phandle_args masterspec; > + struct rb_node *node; > + > + /* Even if the device can't be initialized, we don't want to give to > + * dom0 the smmu device "we don't want to give the smmu device to dom0" Ian.