History

device: Move MSI related data into a struct

The only unconditional part of MSI data in struct device is the irqdomain pointer. Everything else can be allocated on demand. Create a data structure and move the irqdomain pointer into it. The other MSI specific parts are going to be removed from struct device in later steps.

Thomas Gleixner committed 4 years ago

Commit 34fff621 parent ed1533b7 files · +29 −21Browse files

Unified · Split

7 files
  1. drivers/base/platform-msi.c +6 −6
  2. drivers/dma/ti/k3-udma.c +2 −2
  3. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 −1
  4. drivers/irqchip/irq-mvebu-icu.c +3 −3
  5. drivers/soc/ti/k3-ringacc.c +2 −2
  6. drivers/soc/ti/ti_sci_inta_msi.c +1 −1
  7. include/linux/device.h +14 −6
drivers/base/platform-msi.c+6−6
@@ -210,10 +210,10 @@ platform_msi_alloc_priv_data(struct device *dev, unsigned int nvec, · 209 unmodified lines
210 * accordingly (which would impact the max number of MSI210 * accordingly (which would impact the max number of MSI
211 * capable devices).211 * capable devices).
212 */212 */
213 if (!dev->msi_domain || !write_msi_msg || !nvec || nvec > MAX_DEV_MSIS)213 if (!dev->msi.domain || !write_msi_msg || !nvec || nvec > MAX_DEV_MSIS)
214 return ERR_PTR(-EINVAL);214 return ERR_PTR(-EINVAL);
215 215
216 if (dev->msi_domain->bus_token != DOMAIN_BUS_PLATFORM_MSI) {216 if (dev->msi.domain->bus_token != DOMAIN_BUS_PLATFORM_MSI) {
217 dev_err(dev, "Incompatible msi_domain, giving up\n");217 dev_err(dev, "Incompatible msi_domain, giving up\n");
218 return ERR_PTR(-EINVAL);218 return ERR_PTR(-EINVAL);
219 }219 }
@@ -269,7 +269,7 @@ int platform_msi_domain_alloc_irqs(struct device *dev, unsigned int nvec, · 49 unmodified lines
269 if (err)269 if (err)
270 goto out_free_priv_data;270 goto out_free_priv_data;
271 271
272 err = msi_domain_alloc_irqs(dev->msi_domain, dev, nvec);272 err = msi_domain_alloc_irqs(dev->msi.domain, dev, nvec);
273 if (err)273 if (err)
274 goto out_free_desc;274 goto out_free_desc;
275 275
@@ -282,7 +282,7 @@ int platform_msi_domain_alloc_irqs(struct device *dev, unsigned int nvec, · 6 unmodified lines
282 return 0;282 return 0;
283 283
284out_free_irqs:284out_free_irqs:
285 msi_domain_free_irqs(dev->msi_domain, dev);285 msi_domain_free_irqs(dev->msi.domain, dev);
286out_free_desc:286out_free_desc:
287 platform_msi_free_descs(dev, 0, nvec);287 platform_msi_free_descs(dev, 0, nvec);
288out_free_priv_data:288out_free_priv_data:
@@ -306,7 +306,7 @@ void platform_msi_domain_free_irqs(struct device *dev) · 17 unmodified lines
306 platform_msi_free_priv_data(desc->platform.msi_priv_data);306 platform_msi_free_priv_data(desc->platform.msi_priv_data);
307 }307 }
308 308
309 msi_domain_free_irqs(dev->msi_domain, dev);309 msi_domain_free_irqs(dev->msi.domain, dev);
310 platform_msi_free_descs(dev, 0, MAX_DEV_MSIS);310 platform_msi_free_descs(dev, 0, MAX_DEV_MSIS);
311}311}
312EXPORT_SYMBOL_GPL(platform_msi_domain_free_irqs);312EXPORT_SYMBOL_GPL(platform_msi_domain_free_irqs);
@@ -354,7 +354,7 @@ __platform_msi_create_device_domain(struct device *dev, · 41 unmodified lines
354 return NULL;354 return NULL;
355 355
356 data->host_data = host_data;356 data->host_data = host_data;
357 domain = irq_domain_create_hierarchy(dev->msi_domain, 0,357 domain = irq_domain_create_hierarchy(dev->msi.domain, 0,
358 is_tree ? 0 : nvec,358 is_tree ? 0 : nvec,
359 dev->fwnode, ops, data);359 dev->fwnode, ops, data);
360 if (!domain)360 if (!domain)
drivers/dma/ti/k3-udma.c+2−2
@@ -5279,9 +5279,9 @@ static int udma_probe(struct platform_device *pdev) · 5278 unmodified lines
5279 if (IS_ERR(ud->ringacc))5279 if (IS_ERR(ud->ringacc))
5280 return PTR_ERR(ud->ringacc);5280 return PTR_ERR(ud->ringacc);
5281 5281
5282 dev->msi_domain = of_msi_get_domain(dev, dev->of_node,5282 dev->msi.domain = of_msi_get_domain(dev, dev->of_node,
5283 DOMAIN_BUS_TI_SCI_INTA_MSI);5283 DOMAIN_BUS_TI_SCI_INTA_MSI);
5284 if (!dev->msi_domain) {5284 if (!dev->msi.domain) {
5285 dev_err(dev, "Failed to get MSI domain\n");5285 dev_err(dev, "Failed to get MSI domain\n");
5286 return -EPROBE_DEFER;5286 return -EPROBE_DEFER;
5287 }5287 }
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c+1−1
@@ -3170,7 +3170,7 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu) · 3169 unmodified lines
3170 if (!(smmu->features & ARM_SMMU_FEAT_MSI))3170 if (!(smmu->features & ARM_SMMU_FEAT_MSI))
3171 return;3171 return;
3172 3172
3173 if (!dev->msi_domain) {3173 if (!dev->msi.domain) {
3174 dev_info(smmu->dev, "msi_domain absent - falling back to wired irqs\n");3174 dev_info(smmu->dev, "msi_domain absent - falling back to wired irqs\n");
3175 return;3175 return;
3176 }3176 }
drivers/irqchip/irq-mvebu-icu.c+3−3
@@ -314,12 +314,12 @@ static int mvebu_icu_subset_probe(struct platform_device *pdev) · 313 unmodified lines
314 msi_data->subset_data = of_device_get_match_data(dev);314 msi_data->subset_data = of_device_get_match_data(dev);
315 }315 }
316 316
317 dev->msi_domain = of_msi_get_domain(dev, dev->of_node,317 dev->msi.domain = of_msi_get_domain(dev, dev->of_node,
318 DOMAIN_BUS_PLATFORM_MSI);318 DOMAIN_BUS_PLATFORM_MSI);
319 if (!dev->msi_domain)319 if (!dev->msi.domain)
320 return -EPROBE_DEFER;320 return -EPROBE_DEFER;
321 321
322 msi_parent_dn = irq_domain_get_of_node(dev->msi_domain);322 msi_parent_dn = irq_domain_get_of_node(dev->msi.domain);
323 if (!msi_parent_dn)323 if (!msi_parent_dn)
324 return -ENODEV;324 return -ENODEV;
325 325
drivers/soc/ti/k3-ringacc.c+2−2
@@ -1356,9 +1356,9 @@ static int k3_ringacc_init(struct platform_device *pdev, · 1355 unmodified lines
1356 struct resource *res;1356 struct resource *res;
1357 int ret, i;1357 int ret, i;
1358 1358
1359 dev->msi_domain = of_msi_get_domain(dev, dev->of_node,1359 dev->msi.domain = of_msi_get_domain(dev, dev->of_node,
1360 DOMAIN_BUS_TI_SCI_INTA_MSI);1360 DOMAIN_BUS_TI_SCI_INTA_MSI);
1361 if (!dev->msi_domain) {1361 if (!dev->msi.domain) {
1362 dev_err(dev, "Failed to get MSI domain\n");1362 dev_err(dev, "Failed to get MSI domain\n");
1363 return -EPROBE_DEFER;1363 return -EPROBE_DEFER;
1364 }1364 }
drivers/soc/ti/ti_sci_inta_msi.c+1−1
@@ -140,7 +140,7 @@ EXPORT_SYMBOL_GPL(ti_sci_inta_msi_domain_alloc_irqs); · 139 unmodified lines
140 140
141void ti_sci_inta_msi_domain_free_irqs(struct device *dev)141void ti_sci_inta_msi_domain_free_irqs(struct device *dev)
142{142{
143 msi_domain_free_irqs(dev->msi_domain, dev);143 msi_domain_free_irqs(dev->msi.domain, dev);
144 ti_sci_inta_msi_free_descs(dev);144 ti_sci_inta_msi_free_descs(dev);
145}145}
146EXPORT_SYMBOL_GPL(ti_sci_inta_msi_domain_free_irqs);146EXPORT_SYMBOL_GPL(ti_sci_inta_msi_domain_free_irqs);
include/linux/device.h+14−6
@@ -371,6 +371,16 @@ struct dev_links_info { · 370 unmodified lines
371 enum dl_dev_state status;371 enum dl_dev_state status;
372};372};
373 373
374/**
375 * struct dev_msi_info - Device data related to MSI
376 * @domain: The MSI interrupt domain associated to the device
377 */
378struct dev_msi_info {
379#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
380 struct irq_domain *domain;
381#endif
382};
383
374/**384/**
375 * struct device - The basic device structure385 * struct device - The basic device structure
376 * @parent: The device's "parent" device, the device to which it is attached.386 * @parent: The device's "parent" device, the device to which it is attached.
@@ -407,8 +417,8 @@ struct dev_links_info { · 30 unmodified lines
407 * @em_pd: device's energy model performance domain417 * @em_pd: device's energy model performance domain
408 * @pins: For device pin management.418 * @pins: For device pin management.
409 * See Documentation/driver-api/pin-control.rst for details.419 * See Documentation/driver-api/pin-control.rst for details.
420 * @msi: MSI related data
410 * @msi_list: Hosts MSI descriptors421 * @msi_list: Hosts MSI descriptors
411 * @msi_domain: The generic MSI domain this device is using.
412 * @numa_node: NUMA node this device is close to.422 * @numa_node: NUMA node this device is close to.
413 * @dma_ops: DMA mapping operations for this device.423 * @dma_ops: DMA mapping operations for this device.
414 * @dma_mask: Dma mask (if dma'ble device).424 * @dma_mask: Dma mask (if dma'ble device).
@@ -500,12 +510,10 @@ struct device { · 85 unmodified lines
500 struct em_perf_domain *em_pd;510 struct em_perf_domain *em_pd;
501#endif511#endif
502 512
503#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
504 struct irq_domain *msi_domain;
505#endif
506#ifdef CONFIG_PINCTRL513#ifdef CONFIG_PINCTRL
507 struct dev_pin_info *pins;514 struct dev_pin_info *pins;
508#endif515#endif
516 struct dev_msi_info msi;
509#ifdef CONFIG_GENERIC_MSI_IRQ517#ifdef CONFIG_GENERIC_MSI_IRQ
510 struct list_head msi_list;518 struct list_head msi_list;
511#endif519#endif
@@ -666,7 +674,7 @@ static inline void set_dev_node(struct device *dev, int node) · 154 unmodified lines
666static inline struct irq_domain *dev_get_msi_domain(const struct device *dev)674static inline struct irq_domain *dev_get_msi_domain(const struct device *dev)
667{675{
668#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN676#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
669 return dev->msi_domain;677 return dev->msi.domain;
670#else678#else
671 return NULL;679 return NULL;
672#endif680#endif
@@ -675,7 +683,7 @@ static inline struct irq_domain *dev_get_msi_domain(const struct device *dev) · 2 unmodified lines
675static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d)683static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d)
676{684{
677#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN685#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
678 dev->msi_domain = d;686 dev->msi.domain = d;
679#endif687#endif
680}688}
681 689