Lines Matching full:domain

41  * @domid:	ID of the domain on which management operations should be done
56 /* The maximum domain size */
62 static int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev,
145 * @domid: The id of the interrupt domain to which the desriptor is added
186 (dev->msi.domain && in msi_ctrl_valid()
187 !dev->msi.data->__domains[ctrl->domid].domain))) in msi_ctrl_valid()
223 * @domid: Id of the domain to operate on
332 * If @dev::msi::domain is set and is a global MSI domain, copy the in msi_setup_device_data()
333 * pointer into the domain array so all code can operate on domain in msi_setup_device_data()
337 if (dev->msi.domain && !irq_domain_is_msi_parent(dev->msi.domain)) in msi_setup_device_data()
338 md->__domains[MSI_DEFAULT_DOMAIN].domain = dev->msi.domain; in msi_setup_device_data()
389 * @domid: The id of the interrupt domain which should be walked.
416 * @domid: The id of the interrupt domain which should be walked.
446 * msi_domain_get_virq - Lookup the Linux interrupt number for a MSI index on a interrupt domain
448 * @domid: Domain ID of the interrupt domain associated to the device
465 /* This check is only valid for the PCI default MSI domain */ in msi_domain_get_virq()
603 struct irq_domain *domain; in msi_get_device_domain() local
610 domain = dev->msi.data->__domains[domid].domain; in msi_get_device_domain()
611 if (!domain) in msi_get_device_domain()
614 if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) in msi_get_device_domain()
617 return domain; in msi_get_device_domain()
623 struct irq_domain *domain; in msi_domain_get_hwsize() local
625 domain = msi_get_device_domain(dev, domid); in msi_domain_get_hwsize()
626 if (domain) { in msi_domain_get_hwsize()
627 info = domain->host_data; in msi_domain_get_hwsize()
630 /* No domain, default to MSI_XA_DOMAIN_SIZE */ in msi_domain_get_hwsize()
640 static void msi_check_level(struct irq_domain *domain, struct msi_msg *msg) in msi_check_level() argument
642 struct msi_domain_info *info = domain->host_data; in msi_check_level()
674 msi_check_level(irq_data->domain, msg); in msi_domain_set_affinity()
681 static int msi_domain_activate(struct irq_domain *domain, in msi_domain_activate() argument
687 msi_check_level(irq_data->domain, msg); in msi_domain_activate()
692 static void msi_domain_deactivate(struct irq_domain *domain, in msi_domain_deactivate() argument
701 static int msi_domain_alloc(struct irq_domain *domain, unsigned int virq, in msi_domain_alloc() argument
704 struct msi_domain_info *info = domain->host_data; in msi_domain_alloc()
709 if (irq_resolve_mapping(domain, hwirq)) in msi_domain_alloc()
712 if (domain->parent) { in msi_domain_alloc()
713 ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg); in msi_domain_alloc()
719 ret = ops->msi_init(domain, info, virq + i, hwirq + i, arg); in msi_domain_alloc()
723 ops->msi_free(domain, info, virq + i); in msi_domain_alloc()
725 irq_domain_free_irqs_top(domain, virq, nr_irqs); in msi_domain_alloc()
733 static void msi_domain_free(struct irq_domain *domain, unsigned int virq, in msi_domain_free() argument
736 struct msi_domain_info *info = domain->host_data; in msi_domain_free()
741 info->ops->msi_free(domain, info, virq + i); in msi_domain_free()
743 irq_domain_free_irqs_top(domain, virq, nr_irqs); in msi_domain_free()
746 static int msi_domain_translate(struct irq_domain *domain, struct irq_fwspec *fwspec, in msi_domain_translate() argument
749 struct msi_domain_info *info = domain->host_data; in msi_domain_translate()
757 return info->ops->msi_translate(domain, fwspec, hwirq, type); in msi_domain_translate()
792 static int msi_domain_ops_prepare(struct irq_domain *domain, struct device *dev, in msi_domain_ops_prepare() argument
799 static void msi_domain_ops_teardown(struct irq_domain *domain, msi_alloc_info_t *arg) in msi_domain_ops_teardown() argument
809 static int msi_domain_ops_init(struct irq_domain *domain, in msi_domain_ops_init() argument
814 irq_domain_set_hwirq_and_chip(domain, virq, hwirq, info->chip, in msi_domain_ops_init()
870 struct irq_domain *domain; in __msi_create_irq_domain() local
887 domain = irq_domain_create_hierarchy(parent, flags | IRQ_DOMAIN_FLAG_MSI, 0, in __msi_create_irq_domain()
890 if (domain) { in __msi_create_irq_domain()
891 irq_domain_update_bus_token(domain, info->bus_token); in __msi_create_irq_domain()
892 domain->dev = info->dev; in __msi_create_irq_domain()
894 domain->pm_dev = parent->pm_dev; in __msi_create_irq_domain()
897 return domain; in __msi_create_irq_domain()
901 * msi_create_irq_domain - Create an MSI interrupt domain
903 * @info: MSI domain info
904 * @parent: Parent irq domain
916 * msi_create_parent_irq_domain - Create an MSI-parent interrupt domain
943 * in the domain hierarchy
944 * @dev: The device for which the domain should be created
945 * @domain: The domain in the hierarchy this op is being called on
946 * @msi_parent_domain: The IRQ_DOMAIN_FLAG_MSI_PARENT domain for the child to
948 * @msi_child_info: The MSI domain info of the IRQ_DOMAIN_FLAG_MSI_DEVICE
949 * domain to be created
954 * underlying interrupt domain hierarchy:
956 * The device domain to be initialized requests the broadest feature set
957 * possible and the underlying domain hierarchy puts restrictions on it.
960 * interesting with an intermediate domain: root->parent->child. The
962 * domain is providing. So that creates a classic hen and egg problem:
965 * One solution is to let the root domain handle the initialization that's
966 * why there is the @domain and the @msi_parent_domain pointer.
968 bool msi_parent_init_dev_msi_info(struct device *dev, struct irq_domain *domain, in msi_parent_init_dev_msi_info() argument
972 struct irq_domain *parent = domain->parent; in msi_parent_init_dev_msi_info()
983 * msi_create_device_irq_domain - Create a device MSI interrupt domain
985 * @domid: Domain id
986 * @template: MSI domain info bundle used as template
988 * @domain_data: Optional pointer to domain specific data which is set in
999 * The domain name and the irq chip name for a MSI device domain are
1002 * $PREFIX: Optional prefix provided by the underlying MSI parent domain
1011 * PCI-MSI-0000:00:1c.0 0-edge Parent domain has no prefix
1022 * The domain pointer is stored in @dev::msi::data::__irqdomains[]. All
1023 * subsequent operations on the domain depend on the domain id.
1025 * The domain is automatically freed when the device is removed via devres
1034 struct irq_domain *domain, *parent = dev->msi.domain; in msi_create_device_irq_domain() local
1064 * device domains so that the existing firmware results in a domain in msi_create_device_irq_domain()
1090 domain = __msi_create_irq_domain(fwnode, &bundle->info, IRQ_DOMAIN_FLAG_MSI_DEVICE, parent); in msi_create_device_irq_domain()
1091 if (!domain) in msi_create_device_irq_domain()
1094 dev->msi.data->__domains[domid].domain = domain; in msi_create_device_irq_domain()
1096 if (msi_domain_prepare_irqs(domain, dev, hwsize, &bundle->alloc_info)) { in msi_create_device_irq_domain()
1097 dev->msi.data->__domains[domid].domain = NULL; in msi_create_device_irq_domain()
1098 irq_domain_remove(domain); in msi_create_device_irq_domain()
1109 * msi_remove_device_irq_domain - Free a device MSI interrupt domain
1111 * @domid: Domain id
1117 struct irq_domain *domain; in msi_remove_device_irq_domain() local
1120 domain = msi_get_device_domain(dev, domid); in msi_remove_device_irq_domain()
1121 if (!domain || !irq_domain_is_msi_device(domain)) in msi_remove_device_irq_domain()
1124 dev->msi.data->__domains[domid].domain = NULL; in msi_remove_device_irq_domain()
1125 info = domain->host_data; in msi_remove_device_irq_domain()
1127 info->ops->msi_teardown(domain, info->alloc_data); in msi_remove_device_irq_domain()
1129 if (irq_domain_is_msi_device(domain)) in msi_remove_device_irq_domain()
1130 fwnode = domain->fwnode; in msi_remove_device_irq_domain()
1131 irq_domain_remove(domain); in msi_remove_device_irq_domain()
1137 * msi_match_device_irq_domain - Match a device irq domain against a bus token
1139 * @domid: Domain id
1140 * @bus_token: Bus token to match against the domain bus token
1142 * Return: True if device domain exists and bus tokens match.
1148 struct irq_domain *domain; in msi_match_device_irq_domain() local
1151 domain = msi_get_device_domain(dev, domid); in msi_match_device_irq_domain()
1152 if (domain && irq_domain_is_msi_device(domain)) { in msi_match_device_irq_domain()
1153 info = domain->host_data; in msi_match_device_irq_domain()
1159 static int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev, in msi_domain_prepare_irqs() argument
1162 struct msi_domain_info *info = domain->host_data; in msi_domain_prepare_irqs()
1165 return ops->msi_prepare(domain, dev, nvec, arg); in msi_domain_prepare_irqs()
1179 static bool msi_check_reservation_mode(struct irq_domain *domain, in msi_check_reservation_mode() argument
1185 switch(domain->bus_token) { in msi_check_reservation_mode()
1209 static int msi_handle_pci_fail(struct irq_domain *domain, struct msi_desc *desc, in msi_handle_pci_fail() argument
1212 switch(domain->bus_token) { in msi_handle_pci_fail()
1235 static int msi_init_virq(struct irq_domain *domain, int virq, unsigned int vflags) in msi_init_virq() argument
1237 struct irq_data *irqd = irq_domain_get_irq_data(domain, virq); in msi_init_virq()
1274 static int populate_alloc_info(struct irq_domain *domain, struct device *dev, in populate_alloc_info() argument
1277 struct msi_domain_info *info = domain->host_data; in populate_alloc_info()
1286 return msi_domain_prepare_irqs(domain, dev, nirqs, arg); in populate_alloc_info()
1292 static int __msi_domain_alloc_irqs(struct device *dev, struct irq_domain *domain, in __msi_domain_alloc_irqs() argument
1296 struct msi_domain_info *info = domain->host_data; in __msi_domain_alloc_irqs()
1304 ret = populate_alloc_info(domain, dev, ctrl->nirqs, &arg); in __msi_domain_alloc_irqs()
1320 if (msi_check_reservation_mode(domain, info, dev)) in __msi_domain_alloc_irqs()
1332 ops->prepare_desc(domain, &arg, desc); in __msi_domain_alloc_irqs()
1336 virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used, in __msi_domain_alloc_irqs()
1340 return msi_handle_pci_fail(domain, desc, allocated); in __msi_domain_alloc_irqs()
1345 ret = msi_init_virq(domain, virq + i, vflags); in __msi_domain_alloc_irqs()
1373 struct irq_domain *domain; in __msi_domain_alloc_locked() local
1379 domain = msi_get_device_domain(dev, ctrl->domid); in __msi_domain_alloc_locked()
1380 if (!domain) in __msi_domain_alloc_locked()
1383 info = domain->host_data; in __msi_domain_alloc_locked()
1391 return ops->domain_alloc_irqs(domain, dev, ctrl->nirqs); in __msi_domain_alloc_locked()
1393 return __msi_domain_alloc_irqs(dev, domain, ctrl); in __msi_domain_alloc_locked()
1406 * msi_domain_alloc_irqs_range_locked - Allocate interrupts from a MSI interrupt domain
1409 * @domid: Id of the interrupt domain to operate on
1433 * msi_domain_alloc_irqs_range - Allocate interrupts from a MSI interrupt domain
1436 * @domid: Id of the interrupt domain to operate on
1452 * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
1456 * @domid: Id of the interrupt domain to operate on
1459 * This function scans all MSI descriptors of the MSI domain and allocates interrupts
1460 * for all unassigned ones. That function is to be used for MSI domain usage where
1483 struct irq_domain *domain; in __msi_domain_alloc_irq_at() local
1488 domain = msi_get_device_domain(dev, domid); in __msi_domain_alloc_irq_at()
1489 if (!domain) { in __msi_domain_alloc_irq_at()
1511 ret = __msi_domain_alloc_irqs(dev, domain, &ctrl); in __msi_domain_alloc_irq_at()
1523 * msi_domain_alloc_irq_at - Allocate an interrupt from a MSI interrupt domain at
1528 * @domid: Id of the interrupt domain to operate on
1532 * @icookie: Optional pointer to a domain specific per instance cookie. If
1536 * This requires a MSI interrupt domain which lets the core code manage the
1556 * msi_device_domain_alloc_wired - Allocate a "wired" interrupt on @domain
1557 * @domain: The domain to allocate on
1564 * irq_create_fwspec_mapping(). As the wire to MSI domain is sparse, but
1571 * msi_desc::cookie so the underlying interrupt chip and domain code can
1576 int msi_device_domain_alloc_wired(struct irq_domain *domain, unsigned int hwirq, in msi_device_domain_alloc_wired() argument
1581 struct device *dev = domain->dev; in msi_device_domain_alloc_wired()
1584 if (WARN_ON_ONCE(!dev || domain->bus_token != DOMAIN_BUS_WIRED_TO_MSI)) in msi_device_domain_alloc_wired()
1590 if (WARN_ON_ONCE(msi_get_device_domain(dev, domid) != domain)) in msi_device_domain_alloc_wired()
1597 static void __msi_domain_free_irqs(struct device *dev, struct irq_domain *domain, in __msi_domain_free_irqs() argument
1601 struct msi_domain_info *info = domain->host_data; in __msi_domain_free_irqs()
1614 irqd = irq_domain_get_irq_data(domain, desc->irq + i); in __msi_domain_free_irqs()
1630 struct irq_domain *domain; in msi_domain_free_locked() local
1635 domain = msi_get_device_domain(dev, ctrl->domid); in msi_domain_free_locked()
1636 if (!domain) in msi_domain_free_locked()
1639 info = domain->host_data; in msi_domain_free_locked()
1643 ops->domain_free_irqs(domain, dev); in msi_domain_free_locked()
1645 __msi_domain_free_irqs(dev, domain, ctrl); in msi_domain_free_locked()
1652 * msi_domain_free_irqs_range_locked - Free a range of interrupts from a MSI interrupt domain
1656 * @domid: Id of the interrupt domain to operate on
1672 * msi_domain_free_irqs_range - Free a range of interrupts from a MSI interrupt domain
1676 * @domid: Id of the interrupt domain to operate on
1689 * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain
1693 * @domid: The id of the domain to operate on
1706 * msi_domain_free_irqs_all - Free all interrupts from a MSI interrupt domain
1710 * @domid: The id of the domain to operate on
1719 * msi_device_domain_free_wired - Free a wired interrupt in @domain
1720 * @domain: The domain to free the interrupt on
1726 void msi_device_domain_free_wired(struct irq_domain *domain, unsigned int virq) in msi_device_domain_free_wired() argument
1729 struct device *dev = domain->dev; in msi_device_domain_free_wired()
1731 if (WARN_ON_ONCE(!dev || !desc || domain->bus_token != DOMAIN_BUS_WIRED_TO_MSI)) in msi_device_domain_free_wired()
1735 if (WARN_ON_ONCE(msi_get_device_domain(dev, MSI_DEFAULT_DOMAIN) != domain)) in msi_device_domain_free_wired()
1742 * msi_get_domain_info - Get the MSI interrupt domain info for @domain
1743 * @domain: The interrupt domain to retrieve data from
1745 * Return: the pointer to the msi_domain_info stored in @domain->host_data.
1747 struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain) in msi_get_domain_info() argument
1749 return (struct msi_domain_info *)domain->host_data; in msi_get_domain_info()
1764 * impact outside its security domain, eg userspace triggering interrupts on
1770 struct irq_domain *domain = dev_get_msi_domain(dev); in msi_device_has_isolated_msi() local
1772 for (; domain; domain = domain->parent) in msi_device_has_isolated_msi()
1773 if (domain->flags & IRQ_DOMAIN_FLAG_ISOLATED_MSI) in msi_device_has_isolated_msi()