• Home
  • Raw
  • Download

Lines Matching refs:desc

38 	struct msi_desc *desc = kzalloc(sizeof(*desc), GFP_KERNEL);  in msi_alloc_desc()  local
40 if (!desc) in msi_alloc_desc()
43 desc->dev = dev; in msi_alloc_desc()
44 desc->nvec_used = nvec; in msi_alloc_desc()
46 desc->affinity = kmemdup(affinity, nvec * sizeof(*desc->affinity), GFP_KERNEL); in msi_alloc_desc()
47 if (!desc->affinity) { in msi_alloc_desc()
48 kfree(desc); in msi_alloc_desc()
52 return desc; in msi_alloc_desc()
55 static void msi_free_desc(struct msi_desc *desc) in msi_free_desc() argument
57 kfree(desc->affinity); in msi_free_desc()
58 kfree(desc); in msi_free_desc()
61 static int msi_insert_desc(struct msi_device_data *md, struct msi_desc *desc, unsigned int index) in msi_insert_desc() argument
65 desc->msi_index = index; in msi_insert_desc()
66 ret = xa_insert(&md->__store, index, desc, GFP_KERNEL); in msi_insert_desc()
68 msi_free_desc(desc); in msi_insert_desc()
81 struct msi_desc *desc; in msi_add_msi_desc() local
85 desc = msi_alloc_desc(dev, init_desc->nvec_used, init_desc->affinity); in msi_add_msi_desc()
86 if (!desc) in msi_add_msi_desc()
90 desc->pci = init_desc->pci; in msi_add_msi_desc()
91 return msi_insert_desc(dev->msi.data, desc, init_desc->msi_index); in msi_add_msi_desc()
105 struct msi_desc *desc; in msi_add_simple_msi_descs() local
111 desc = msi_alloc_desc(dev, 1, NULL); in msi_add_simple_msi_descs()
112 if (!desc) in msi_add_simple_msi_descs()
114 ret = msi_insert_desc(dev->msi.data, desc, idx); in msi_add_simple_msi_descs()
127 static bool msi_desc_match(struct msi_desc *desc, enum msi_desc_filter filter) in msi_desc_match() argument
133 return !desc->irq; in msi_desc_match()
135 return !!desc->irq; in msi_desc_match()
152 struct msi_desc *desc; in msi_free_msi_descs_range() local
157 xa_for_each_range(xa, idx, desc, first_index, last_index) { in msi_free_msi_descs_range()
158 if (msi_desc_match(desc, filter)) { in msi_free_msi_descs_range()
160 msi_free_desc(desc); in msi_free_msi_descs_range()
246 struct msi_desc *desc; in msi_find_desc() local
248 xa_for_each_start(&md->__store, md->__iter_idx, desc, md->__iter_idx) { in msi_find_desc()
249 if (msi_desc_match(desc, filter)) in msi_find_desc()
250 return desc; in msi_find_desc()
319 struct msi_desc *desc; in msi_get_virq() local
329 desc = xa_load(&dev->msi.data->__store, pcimsi ? 0 : index); in msi_get_virq()
330 if (desc && desc->irq) { in msi_get_virq()
337 if (index < desc->nvec_used) in msi_get_virq()
338 ret = desc->irq + index; in msi_get_virq()
340 ret = desc->irq; in msi_get_virq()
372 static void msi_sysfs_remove_desc(struct device *dev, struct msi_desc *desc) in msi_sysfs_remove_desc() argument
374 struct device_attribute *attrs = desc->sysfs_attrs; in msi_sysfs_remove_desc()
380 desc->sysfs_attrs = NULL; in msi_sysfs_remove_desc()
381 for (i = 0; i < desc->nvec_used; i++) { in msi_sysfs_remove_desc()
389 static int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) in msi_sysfs_populate_desc() argument
394 attrs = kcalloc(desc->nvec_used, sizeof(*attrs), GFP_KERNEL); in msi_sysfs_populate_desc()
398 desc->sysfs_attrs = attrs; in msi_sysfs_populate_desc()
399 for (i = 0; i < desc->nvec_used; i++) { in msi_sysfs_populate_desc()
401 attrs[i].attr.name = kasprintf(GFP_KERNEL, "%d", desc->irq + i); in msi_sysfs_populate_desc()
419 msi_sysfs_remove_desc(dev, desc); in msi_sysfs_populate_desc()
430 struct msi_desc *desc; in msi_device_populate_sysfs() local
433 msi_for_each_desc(desc, dev, MSI_DESC_ASSOCIATED) { in msi_device_populate_sysfs()
434 if (desc->sysfs_attrs) in msi_device_populate_sysfs()
436 ret = msi_sysfs_populate_desc(dev, desc); in msi_device_populate_sysfs()
450 struct msi_desc *desc; in msi_device_destroy_sysfs() local
452 msi_for_each_desc(desc, dev, MSI_DESC_ALL) in msi_device_destroy_sysfs()
453 msi_sysfs_remove_desc(dev, desc); in msi_device_destroy_sysfs()
458 static inline int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) { return 0; } in msi_sysfs_populate_desc() argument
459 static inline void msi_sysfs_remove_desc(struct device *dev, struct msi_desc *desc) { } in msi_sysfs_remove_desc() argument
596 struct msi_desc *desc) in msi_domain_ops_set_desc() argument
598 arg->desc = desc; in msi_domain_ops_set_desc()
717 struct msi_desc *desc; in msi_domain_populate_irqs() local
726 desc = xa_load(&dev->msi.data->__store, virq); in msi_domain_populate_irqs()
727 desc->irq = virq; in msi_domain_populate_irqs()
729 ops->set_desc(arg, desc); in msi_domain_populate_irqs()
734 irq_set_msi_desc(virq, desc); in msi_domain_populate_irqs()
763 struct msi_desc *desc; in msi_check_reservation_mode() local
783 desc = msi_first_desc(dev, MSI_DESC_ALL); in msi_check_reservation_mode()
784 return desc->pci.msi_attrib.is_msix || desc->pci.msi_attrib.can_mask; in msi_check_reservation_mode()
787 static int msi_handle_pci_fail(struct irq_domain *domain, struct msi_desc *desc, in msi_handle_pci_fail() argument
801 if (desc->nvec_used > 1) in msi_handle_pci_fail()
857 struct msi_desc *desc; in __msi_domain_alloc_irqs() local
880 msi_for_each_desc(desc, dev, MSI_DESC_NOTASSOCIATED) { in __msi_domain_alloc_irqs()
881 ops->set_desc(&arg, desc); in __msi_domain_alloc_irqs()
883 virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used, in __msi_domain_alloc_irqs()
885 desc->affinity); in __msi_domain_alloc_irqs()
887 return msi_handle_pci_fail(domain, desc, allocated); in __msi_domain_alloc_irqs()
889 for (i = 0; i < desc->nvec_used; i++) { in __msi_domain_alloc_irqs()
890 irq_set_msi_desc_off(virq, i, desc); in __msi_domain_alloc_irqs()
897 ret = msi_sysfs_populate_desc(dev, desc); in __msi_domain_alloc_irqs()
971 struct msi_desc *desc; in __msi_domain_free_irqs() local
975 msi_for_each_desc(desc, dev, MSI_DESC_ASSOCIATED) { in __msi_domain_free_irqs()
977 for (i = 0; i < desc->nvec_used; i++) { in __msi_domain_free_irqs()
978 irqd = irq_domain_get_irq_data(domain, desc->irq + i); in __msi_domain_free_irqs()
983 irq_domain_free_irqs(desc->irq, desc->nvec_used); in __msi_domain_free_irqs()
985 msi_sysfs_remove_desc(dev, desc); in __msi_domain_free_irqs()
986 desc->irq = 0; in __msi_domain_free_irqs()