From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3 09/13] xen/passthrough: Introduce IOMMU ARM architecture Date: Tue, 18 Mar 2014 19:58:06 +0000 Message-ID: <5328A54E.9010502@linaro.org> References: <1394552999-14171-1-git-send-email-julien.grall@linaro.org> <1394552999-14171-10-git-send-email-julien.grall@linaro.org> <1395160826.11824.15.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQ09J-0006bm-QS for xen-devel@lists.xenproject.org; Tue, 18 Mar 2014 19:58:10 +0000 Received: by mail-ee0-f47.google.com with SMTP id b15so5820155eek.34 for ; Tue, 18 Mar 2014 12:58:08 -0700 (PDT) In-Reply-To: <1395160826.11824.15.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, Jan Beulich , tim@xen.org, Xiantao Zhang , stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org Hi Ian, On 03/18/2014 04:40 PM, Ian Campbell wrote: > On Tue, 2014-03-11 at 15:49 +0000, Julien Grall wrote: >> @@ -754,7 +766,7 @@ static int map_device(struct domain *d, const struct dt_device_node *dev) >> } >> >> static int handle_node(struct domain *d, struct kernel_info *kinfo, >> - const struct dt_device_node *node) >> + struct dt_device_node *node) >> { >> static const struct dt_device_match skip_matches[] __initconst = >> { >> @@ -775,7 +787,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, >> DT_MATCH_TIMER, >> { /* sentinel */ }, >> }; >> - const struct dt_device_node *child; >> + struct dt_device_node *child; > > Why do these consts become unwanted? Because map_device now calls iommu_assign_dt_device which will update next_assigned in the structure dt_device_node. >> diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/arm/iommu.c >> new file mode 100644 >> index 0000000..b0bd71d >> --- /dev/null >> +++ b/xen/drivers/passthrough/arm/iommu.c > [...] >> +int __init iommu_hardware_setup(void) >> +{ >> + struct dt_device_node *np; >> + int rc; >> + unsigned int num_iommus = 0; >> + >> + dt_for_each_device_node(dt_host, np) > > I can't find dt_host in this or any of the previous patches. dt_host was defined a while ago by the device tree code (see xen/include/xen/device_tree.h). >> + { >> + rc = device_init(np, DEVICE_IOMMU, NULL); >> + if ( !rc ) >> + num_iommus++; >> + } >> + >> + return ( num_iommus > 0 ) ? 0 : -ENODEV; >> +} >> + >> +int arch_iommu_domain_init(struct domain *d) >> +{ >> + int ret; >> + >> + ret = iommu_dt_domain_init(d); >> + >> + return ret; > > return iommu_dt-domain_init(d); > ? I will do the change in the next version. >> diff --git a/xen/include/asm-arm/iommu.h b/xen/include/asm-arm/iommu.h >> new file mode 100644 >> index 0000000..81eec83 >> --- /dev/null >> +++ b/xen/include/asm-arm/iommu.h >> [...] >> +#define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu) > > Does this macro give us the freedom to avoid the term "hvm" a bit and > use d->arch.iommu? It's possible, I just blindly copied from x86. Regards, -- Julien Grall