[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v1 2/3] xen/arm: smmu: Renaming arm_smmu_xen_domain with, domain_iommu_info



The name arm_smmu_xen_domain was mapped to domain_hvm_iommu(d)->arch.priv.
Also there are a lot of datastructre in smmu.c with name ending in domain
it is not intuitive and code is hard to understand.

domain_iommu_info is easy to understand that it refers to
domain_hvm_iommu(d)->arch.priv.

The instances of arm_smmu_xen_domain were name smmu_domain or xen_domain
in different functions which is also cleaned up in this patch.

Signed-off-by: Manish Jaggi <manish.jaggi@xxxxxxxxxxxxxxxxxx>
---
 xen/drivers/passthrough/arm/smmu.c | 46 +++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c 
b/xen/drivers/passthrough/arm/smmu.c
index ab4f7a4..fe0549e 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -230,7 +230,7 @@ struct iommu_domain
 };
/* Xen: Describes informations required for a Xen domain */
-struct arm_smmu_xen_domain {
+struct domain_iommu_info {
        spinlock_t                      lock;
        /* List of context (i.e iommu_domain) associated to this domain */
        struct list_head                contexts;
@@ -2540,11 +2540,11 @@ static u32 platform_features = 
ARM_SMMU_FEAT_COHERENT_WALK;
static void arm_smmu_iotlb_flush_all(struct domain *d)
 {
-       struct arm_smmu_xen_domain *smmu_domain = 
domain_hvm_iommu(d)->arch.priv;
+       struct domain_iommu_info *domain_iommu_info = 
domain_hvm_iommu(d)->arch.priv;
        struct iommu_domain *cfg;
- spin_lock(&smmu_domain->lock);
-       list_for_each_entry(cfg, &smmu_domain->contexts, list) {
+       spin_lock(&domain_iommu_info->lock);
+       list_for_each_entry(cfg, &domain_iommu_info->contexts, list) {
                /*
                 * Only invalidate the context when SMMU is present.
                 * This is because the context initialization is delayed
@@ -2554,7 +2554,7 @@ static void arm_smmu_iotlb_flush_all(struct domain *d)
                        continue;
                arm_smmu_tlb_inv_context(cfg->priv);
        }
-       spin_unlock(&smmu_domain->lock);
+       spin_unlock(&domain_iommu_info->lock);
 }
static void arm_smmu_iotlb_flush(struct domain *d, unsigned long gfn,
@@ -2568,10 +2568,10 @@ static int arm_smmu_assign_dev(struct domain *d, u8 
devfn,
                               struct device *dev)
 {
        struct iommu_domain *domain;
-       struct arm_smmu_xen_domain *xen_domain;
+       struct domain_iommu_info *domain_iommu_info;
        int ret;
- xen_domain = domain_hvm_iommu(d)->arch.priv;
+       domain_iommu_info = domain_hvm_iommu(d)->arch.priv;
if (!dev->archdata.iommu) {
                dev->archdata.iommu = xzalloc(struct device_iommu_info);
@@ -2604,10 +2604,10 @@ static int arm_smmu_assign_dev(struct domain *d, u8 
devfn,
        if (ret)
                goto err_attach_dev;
- spin_lock(&xen_domain->lock);
+       spin_lock(&domain_iommu_info->lock);
        /* Chain the new context to the domain */
-       list_add(&domain->list, &xen_domain->contexts);
-       spin_unlock(&xen_domain->lock);
+       list_add(&domain->list, &domain_iommu_info->contexts);
+       spin_unlock(&domain_iommu_info->lock);
return 0; @@ -2622,9 +2622,9 @@ err_dom_init:
 static int arm_smmu_deassign_dev(struct domain *d, struct device *dev)
 {
        struct iommu_domain *domain = dev_iommu_domain(dev);
-       struct arm_smmu_xen_domain *xen_domain;
+       struct domain_iommu_info *domain_iommu_info;
- xen_domain = domain_hvm_iommu(d)->arch.priv;
+       domain_iommu_info = domain_hvm_iommu(d)->arch.priv;
if (!domain || domain->priv->cfg.domain != d) {
                dev_err(dev, " not attached to domain %d\n", d->domain_id);
@@ -2633,9 +2633,9 @@ static int arm_smmu_deassign_dev(struct domain *d, struct 
device *dev)
arm_smmu_detach_dev(domain, dev); - spin_lock(&xen_domain->lock);
+       spin_lock(&domain_iommu_info->lock);
        list_del(&domain->list);
-       spin_unlock(&xen_domain->lock);
+       spin_unlock(&domain_iommu_info->lock);
arm_smmu_domain_destroy(domain);
        xfree(domain);
@@ -2664,16 +2664,16 @@ static int arm_smmu_reassign_dev(struct domain *s, 
struct domain *t,
static int arm_smmu_iommu_domain_init(struct domain *d)
 {
-       struct arm_smmu_xen_domain *xen_domain;
+       struct domain_iommu_info *domain_iommu_info;
- xen_domain = xzalloc(struct arm_smmu_xen_domain);
-       if ( !xen_domain )
+       domain_iommu_info = xzalloc(struct domain_iommu_info);
+       if ( !domain_iommu_info )
                return -ENOMEM;
- spin_lock_init(&xen_domain->lock);
-       INIT_LIST_HEAD(&xen_domain->contexts);
+       spin_lock_init(&domain_iommu_info->lock);
+       INIT_LIST_HEAD(&domain_iommu_info->contexts);
- domain_hvm_iommu(d)->arch.priv = xen_domain;
+       domain_hvm_iommu(d)->arch.priv = domain_iommu_info;
/* Coherent walk can be enabled only when all SMMUs support it. */
        if (platform_features & ARM_SMMU_FEAT_COHERENT_WALK)
@@ -2688,10 +2688,10 @@ static void __hwdom_init 
arm_smmu_iommu_hwdom_init(struct domain *d)
static void arm_smmu_iommu_domain_teardown(struct domain *d)
 {
-       struct arm_smmu_xen_domain *xen_domain = domain_hvm_iommu(d)->arch.priv;
+       struct domain_iommu_info *domain_iommu_info = 
domain_hvm_iommu(d)->arch.priv;
- ASSERT(list_empty(&xen_domain->contexts));
-       xfree(xen_domain);
+       ASSERT(list_empty(&domain_iommu_info->contexts));
+       xfree(domain_iommu_info);
 }
static int arm_smmu_map_page(struct domain *d, unsigned long gfn,
--
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.