]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
xen/asm-generic: fold struct devarch into struct dev
authorOleksii Kurochko <oleksii.kurochko@gmail.com>
Tue, 20 Feb 2024 11:23:50 +0000 (12:23 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Feb 2024 11:23:50 +0000 (12:23 +0100)
The 'struct dev_archdata' is exclusively used within 'struct device',
so it could be merged into 'struct device.'

After the merger, it is necessary to update the 'dev_archdata()'
macros and the comments above 'struct arm_smmu_xen_device' in
drivers/passthrough/arm/smmu.c.
Additionally, it is required to update instances of
"dev->archdata->iommu" to "dev->iommu".

Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/drivers/passthrough/arm/smmu.c
xen/include/asm-generic/device.h

index 32e2ff279b00cccfd2d9320ef056794fc8d7606e..4a272c87798f3f4dc10c315de81bf4ebf442005f 100644 (file)
@@ -227,9 +227,9 @@ struct arm_smmu_xen_domain {
 };
 
 /*
- * Xen: Information about each device stored in dev->archdata.iommu
+ * Xen: Information about each device stored in dev->iommu
  *
- * Initially dev->archdata.iommu only stores the iommu_domain (runtime
+ * Initially dev->iommu only stores the iommu_domain (runtime
  * configuration of the SMMU) but, on Xen, we also have to store the
  * iommu_group (list of streamIDs associated to the device).
  *
@@ -242,7 +242,7 @@ struct arm_smmu_xen_device {
        struct iommu_group *group;
 };
 
-#define dev_archdata(dev) ((struct arm_smmu_xen_device *)dev->archdata.iommu)
+#define dev_archdata(dev) ((struct arm_smmu_xen_device *)dev->iommu)
 #define dev_iommu_domain(dev) (dev_archdata(dev)->domain)
 #define dev_iommu_group(dev) (dev_archdata(dev)->group)
 
@@ -2777,9 +2777,9 @@ static int arm_smmu_assign_dev(struct domain *d, u8 devfn,
 
        xen_domain = dom_iommu(d)->arch.priv;
 
-       if (!dev->archdata.iommu) {
-               dev->archdata.iommu = xzalloc(struct arm_smmu_xen_device);
-               if (!dev->archdata.iommu)
+       if (!dev->iommu) {
+               dev->iommu = xzalloc(struct arm_smmu_xen_device);
+               if (!dev->iommu)
                        return -ENOMEM;
        }
 
index f91bb7f7716ab2f2d5a03af51746aaedad37f2db..1acd1ba1d8b45cc5b365c00066860c264891a0ee 100644 (file)
@@ -22,12 +22,6 @@ enum device_class
     DEVICE_UNKNOWN,
 };
 
-struct dev_archdata {
-#ifdef CONFIG_HAS_PASSTHROUGH
-    void *iommu;    /* IOMMU private data */
-#endif
-};
-
 /* struct device - The basic device structure */
 struct device
 {
@@ -35,8 +29,8 @@ struct device
 #ifdef CONFIG_HAS_DEVICE_TREE
     struct dt_device_node *of_node; /* Used by drivers imported from Linux */
 #endif
-    struct dev_archdata archdata;
 #ifdef CONFIG_HAS_PASSTHROUGH
+    void *iommu; /* IOMMU private data */;
     struct iommu_fwspec *iommu_fwspec; /* per-device IOMMU instance data */
 #endif
 };