Lines Matching full:domain
40 * @domid: ID of the domain on which management operations should be done
55 /* The maximum domain size */
143 * @domid: The id of the interrupt domain to which the desriptor is added
184 (dev->msi.domain && in msi_ctrl_valid()
185 !dev->msi.data->__domains[ctrl->domid].domain))) in msi_ctrl_valid()
221 * @domid: Id of the domain to operate on
330 * If @dev::msi::domain is set and is a global MSI domain, copy the in msi_setup_device_data()
331 * pointer into the domain array so all code can operate on domain in msi_setup_device_data()
335 if (dev->msi.domain && !irq_domain_is_msi_parent(dev->msi.domain)) in msi_setup_device_data()
336 md->__domains[MSI_DEFAULT_DOMAIN].domain = dev->msi.domain; in msi_setup_device_data()
383 * @domid: The id of the interrupt domain which should be walked.
410 * @domid: The id of the interrupt domain which should be walked.
440 * msi_domain_get_virq - Lookup the Linux interrupt number for a MSI index on a interrupt domain
442 * @domid: Domain ID of the interrupt domain associated to the device
460 /* This check is only valid for the PCI default MSI domain */ in msi_domain_get_virq()
602 struct irq_domain *domain; in msi_get_device_domain() local
609 domain = dev->msi.data->__domains[domid].domain; in msi_get_device_domain()
610 if (!domain) in msi_get_device_domain()
613 if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) in msi_get_device_domain()
616 return domain; in msi_get_device_domain()
622 struct irq_domain *domain; in msi_domain_get_hwsize() local
624 domain = msi_get_device_domain(dev, domid); in msi_domain_get_hwsize()
625 if (domain) { in msi_domain_get_hwsize()
626 info = domain->host_data; in msi_domain_get_hwsize()
629 /* No domain, default to MSI_XA_DOMAIN_SIZE */ in msi_domain_get_hwsize()
639 static void msi_check_level(struct irq_domain *domain, struct msi_msg *msg) in msi_check_level() argument
641 struct msi_domain_info *info = domain->host_data; in msi_check_level()
673 msi_check_level(irq_data->domain, msg); in msi_domain_set_affinity()
680 static int msi_domain_activate(struct irq_domain *domain, in msi_domain_activate() argument
686 msi_check_level(irq_data->domain, msg); in msi_domain_activate()
691 static void msi_domain_deactivate(struct irq_domain *domain, in msi_domain_deactivate() argument
700 static int msi_domain_alloc(struct irq_domain *domain, unsigned int virq, in msi_domain_alloc() argument
703 struct msi_domain_info *info = domain->host_data; in msi_domain_alloc()
708 if (irq_find_mapping(domain, hwirq) > 0) in msi_domain_alloc()
711 if (domain->parent) { in msi_domain_alloc()
712 ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg); in msi_domain_alloc()
718 ret = ops->msi_init(domain, info, virq + i, hwirq + i, arg); in msi_domain_alloc()
722 ops->msi_free(domain, info, virq + i); in msi_domain_alloc()
724 irq_domain_free_irqs_top(domain, virq, nr_irqs); in msi_domain_alloc()
732 static void msi_domain_free(struct irq_domain *domain, unsigned int virq, in msi_domain_free() argument
735 struct msi_domain_info *info = domain->host_data; in msi_domain_free()
740 info->ops->msi_free(domain, info, virq + i); in msi_domain_free()
742 irq_domain_free_irqs_top(domain, virq, nr_irqs); in msi_domain_free()
745 static int msi_domain_translate(struct irq_domain *domain, struct irq_fwspec *fwspec, in msi_domain_translate() argument
748 struct msi_domain_info *info = domain->host_data; in msi_domain_translate()
756 return info->ops->msi_translate(domain, fwspec, hwirq, type); in msi_domain_translate()
773 static int msi_domain_ops_prepare(struct irq_domain *domain, struct device *dev, in msi_domain_ops_prepare() argument
786 static int msi_domain_ops_init(struct irq_domain *domain, in msi_domain_ops_init() argument
791 irq_domain_set_hwirq_and_chip(domain, virq, hwirq, info->chip, in msi_domain_ops_init()
844 struct irq_domain *domain; in __msi_create_irq_domain() local
861 domain = irq_domain_create_hierarchy(parent, flags | IRQ_DOMAIN_FLAG_MSI, 0, in __msi_create_irq_domain()
864 if (domain) { in __msi_create_irq_domain()
865 irq_domain_update_bus_token(domain, info->bus_token); in __msi_create_irq_domain()
867 domain->pm_dev = parent->pm_dev; in __msi_create_irq_domain()
870 return domain; in __msi_create_irq_domain()
874 * msi_create_irq_domain - Create an MSI interrupt domain
876 * @info: MSI domain info
877 * @parent: Parent irq domain
890 * in the domain hierarchy
891 * @dev: The device for which the domain should be created
892 * @domain: The domain in the hierarchy this op is being called on
893 * @msi_parent_domain: The IRQ_DOMAIN_FLAG_MSI_PARENT domain for the child to
895 * @msi_child_info: The MSI domain info of the IRQ_DOMAIN_FLAG_MSI_DEVICE
896 * domain to be created
901 * underlying interrupt domain hierarchy:
903 * The device domain to be initialized requests the broadest feature set
904 * possible and the underlying domain hierarchy puts restrictions on it.
907 * interesting with an intermediate domain: root->parent->child. The
909 * domain is providing. So that creates a classic hen and egg problem:
912 * One solution is to let the root domain handle the initialization that's
913 * why there is the @domain and the @msi_parent_domain pointer.
915 bool msi_parent_init_dev_msi_info(struct device *dev, struct irq_domain *domain, in msi_parent_init_dev_msi_info() argument
919 struct irq_domain *parent = domain->parent; in msi_parent_init_dev_msi_info()
930 * msi_create_device_irq_domain - Create a device MSI interrupt domain
932 * @domid: Domain id
933 * @template: MSI domain info bundle used as template
935 * @domain_data: Optional pointer to domain specific data which is set in
946 * The domain name and the irq chip name for a MSI device domain are
949 * $PREFIX: Optional prefix provided by the underlying MSI parent domain
958 * PCI-MSI-0000:00:1c.0 0-edge Parent domain has no prefix
969 * The domain pointer is stored in @dev::msi::data::__irqdomains[]. All
970 * subsequent operations on the domain depend on the domain id.
972 * The domain is automatically freed when the device is removed via devres
981 struct irq_domain *domain, *parent = dev->msi.domain; in msi_create_device_irq_domain() local
1009 * device domains so that the existing firmware results in a domain in msi_create_device_irq_domain()
1034 domain = __msi_create_irq_domain(fwnode, &bundle->info, IRQ_DOMAIN_FLAG_MSI_DEVICE, parent); in msi_create_device_irq_domain()
1035 if (!domain) in msi_create_device_irq_domain()
1038 domain->dev = dev; in msi_create_device_irq_domain()
1039 dev->msi.data->__domains[domid].domain = domain; in msi_create_device_irq_domain()
1053 * msi_remove_device_irq_domain - Free a device MSI interrupt domain
1055 * @domid: Domain id
1061 struct irq_domain *domain; in msi_remove_device_irq_domain() local
1065 domain = msi_get_device_domain(dev, domid); in msi_remove_device_irq_domain()
1067 if (!domain || !irq_domain_is_msi_device(domain)) in msi_remove_device_irq_domain()
1070 dev->msi.data->__domains[domid].domain = NULL; in msi_remove_device_irq_domain()
1071 info = domain->host_data; in msi_remove_device_irq_domain()
1072 if (irq_domain_is_msi_device(domain)) in msi_remove_device_irq_domain()
1073 fwnode = domain->fwnode; in msi_remove_device_irq_domain()
1074 irq_domain_remove(domain); in msi_remove_device_irq_domain()
1083 * msi_match_device_irq_domain - Match a device irq domain against a bus token
1085 * @domid: Domain id
1086 * @bus_token: Bus token to match against the domain bus token
1088 * Return: True if device domain exists and bus tokens match.
1094 struct irq_domain *domain; in msi_match_device_irq_domain() local
1098 domain = msi_get_device_domain(dev, domid); in msi_match_device_irq_domain()
1099 if (domain && irq_domain_is_msi_device(domain)) { in msi_match_device_irq_domain()
1100 info = domain->host_data; in msi_match_device_irq_domain()
1107 static int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev, in msi_domain_prepare_irqs() argument
1110 struct msi_domain_info *info = domain->host_data; in msi_domain_prepare_irqs()
1113 return ops->msi_prepare(domain, dev, nvec, arg); in msi_domain_prepare_irqs()
1127 static bool msi_check_reservation_mode(struct irq_domain *domain, in msi_check_reservation_mode() argument
1133 switch(domain->bus_token) { in msi_check_reservation_mode()
1157 static int msi_handle_pci_fail(struct irq_domain *domain, struct msi_desc *desc, in msi_handle_pci_fail() argument
1160 switch(domain->bus_token) { in msi_handle_pci_fail()
1183 static int msi_init_virq(struct irq_domain *domain, int virq, unsigned int vflags) in msi_init_virq() argument
1185 struct irq_data *irqd = irq_domain_get_irq_data(domain, virq); in msi_init_virq()
1222 static int __msi_domain_alloc_irqs(struct device *dev, struct irq_domain *domain, in __msi_domain_alloc_irqs() argument
1226 struct msi_domain_info *info = domain->host_data; in __msi_domain_alloc_irqs()
1234 ret = msi_domain_prepare_irqs(domain, dev, ctrl->nirqs, &arg); in __msi_domain_alloc_irqs()
1250 if (msi_check_reservation_mode(domain, info, dev)) in __msi_domain_alloc_irqs()
1262 ops->prepare_desc(domain, &arg, desc); in __msi_domain_alloc_irqs()
1266 virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used, in __msi_domain_alloc_irqs()
1270 return msi_handle_pci_fail(domain, desc, allocated); in __msi_domain_alloc_irqs()
1275 ret = msi_init_virq(domain, virq + i, vflags); in __msi_domain_alloc_irqs()
1303 struct irq_domain *domain; in __msi_domain_alloc_locked() local
1309 domain = msi_get_device_domain(dev, ctrl->domid); in __msi_domain_alloc_locked()
1310 if (!domain) in __msi_domain_alloc_locked()
1313 info = domain->host_data; in __msi_domain_alloc_locked()
1321 return ops->domain_alloc_irqs(domain, dev, ctrl->nirqs); in __msi_domain_alloc_locked()
1323 return __msi_domain_alloc_irqs(dev, domain, ctrl); in __msi_domain_alloc_locked()
1336 * msi_domain_alloc_irqs_range_locked - Allocate interrupts from a MSI interrupt domain
1339 * @domid: Id of the interrupt domain to operate on
1363 * msi_domain_alloc_irqs_range - Allocate interrupts from a MSI interrupt domain
1366 * @domid: Id of the interrupt domain to operate on
1385 * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
1389 * @domid: Id of the interrupt domain to operate on
1392 * This function scans all MSI descriptors of the MSI domain and allocates interrupts
1393 * for all unassigned ones. That function is to be used for MSI domain usage where
1416 struct irq_domain *domain; in __msi_domain_alloc_irq_at() local
1421 domain = msi_get_device_domain(dev, domid); in __msi_domain_alloc_irq_at()
1422 if (!domain) { in __msi_domain_alloc_irq_at()
1444 ret = __msi_domain_alloc_irqs(dev, domain, &ctrl); in __msi_domain_alloc_irq_at()
1456 * msi_domain_alloc_irq_at - Allocate an interrupt from a MSI interrupt domain at
1461 * @domid: Id of the interrupt domain to operate on
1465 * @icookie: Optional pointer to a domain specific per instance cookie. If
1469 * This requires a MSI interrupt domain which lets the core code manage the
1493 * msi_device_domain_alloc_wired - Allocate a "wired" interrupt on @domain
1494 * @domain: The domain to allocate on
1501 * irq_create_fwspec_mapping(). As the wire to MSI domain is sparse, but
1508 * msi_desc::cookie so the underlying interrupt chip and domain code can
1513 int msi_device_domain_alloc_wired(struct irq_domain *domain, unsigned int hwirq, in msi_device_domain_alloc_wired() argument
1518 struct device *dev = domain->dev; in msi_device_domain_alloc_wired()
1521 if (WARN_ON_ONCE(!dev || domain->bus_token != DOMAIN_BUS_WIRED_TO_MSI)) in msi_device_domain_alloc_wired()
1527 if (WARN_ON_ONCE(msi_get_device_domain(dev, domid) != domain)) in msi_device_domain_alloc_wired()
1536 static void __msi_domain_free_irqs(struct device *dev, struct irq_domain *domain, in __msi_domain_free_irqs() argument
1540 struct msi_domain_info *info = domain->host_data; in __msi_domain_free_irqs()
1553 irqd = irq_domain_get_irq_data(domain, desc->irq + i); in __msi_domain_free_irqs()
1569 struct irq_domain *domain; in msi_domain_free_locked() local
1574 domain = msi_get_device_domain(dev, ctrl->domid); in msi_domain_free_locked()
1575 if (!domain) in msi_domain_free_locked()
1578 info = domain->host_data; in msi_domain_free_locked()
1582 ops->domain_free_irqs(domain, dev); in msi_domain_free_locked()
1584 __msi_domain_free_irqs(dev, domain, ctrl); in msi_domain_free_locked()
1587 ops->msi_post_free(domain, dev); in msi_domain_free_locked()
1594 * msi_domain_free_irqs_range_locked - Free a range of interrupts from a MSI interrupt domain
1598 * @domid: Id of the interrupt domain to operate on
1614 * msi_domain_free_irqs_range - Free a range of interrupts from a MSI interrupt domain
1618 * @domid: Id of the interrupt domain to operate on
1632 * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain
1636 * @domid: The id of the domain to operate on
1649 * msi_domain_free_irqs_all - Free all interrupts from a MSI interrupt domain
1653 * @domid: The id of the domain to operate on
1663 * msi_device_domain_free_wired - Free a wired interrupt in @domain
1664 * @domain: The domain to free the interrupt on
1670 void msi_device_domain_free_wired(struct irq_domain *domain, unsigned int virq) in msi_device_domain_free_wired() argument
1673 struct device *dev = domain->dev; in msi_device_domain_free_wired()
1675 if (WARN_ON_ONCE(!dev || !desc || domain->bus_token != DOMAIN_BUS_WIRED_TO_MSI)) in msi_device_domain_free_wired()
1679 if (!WARN_ON_ONCE(msi_get_device_domain(dev, MSI_DEFAULT_DOMAIN) != domain)) { in msi_device_domain_free_wired()
1687 * msi_get_domain_info - Get the MSI interrupt domain info for @domain
1688 * @domain: The interrupt domain to retrieve data from
1690 * Return: the pointer to the msi_domain_info stored in @domain->host_data.
1692 struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain) in msi_get_domain_info() argument
1694 return (struct msi_domain_info *)domain->host_data; in msi_get_domain_info()
1709 * impact outside its security domain, eg userspace triggering interrupts on
1715 struct irq_domain *domain = dev_get_msi_domain(dev); in msi_device_has_isolated_msi() local
1717 for (; domain; domain = domain->parent) in msi_device_has_isolated_msi()
1718 if (domain->flags & IRQ_DOMAIN_FLAG_ISOLATED_MSI) in msi_device_has_isolated_msi()