of/irq: Use the msi-map property to provide device-specific MSI domain
While msi-parent is used to point to the MSI controller that works for all the devices behind a root complex, it doesn't allow configurations where each individual device can be routed to a separate MSI controller. The msi-map property provides this flexibility (and much more), so let's add a utility function that parses it, and return the corresponding MSI domain. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
This commit is contained in:
@@ -688,6 +688,24 @@ static struct irq_domain *__of_get_msi_domain(struct device_node *np,
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
|
||||||
|
* @dev: device for which the mapping is to be done.
|
||||||
|
* @rid: Requester ID for the device.
|
||||||
|
*
|
||||||
|
* Walk up the device hierarchy looking for devices with a "msi-map"
|
||||||
|
* property.
|
||||||
|
*
|
||||||
|
* Returns: the MSI domain for this device (or NULL on failure)
|
||||||
|
*/
|
||||||
|
struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 rid)
|
||||||
|
{
|
||||||
|
struct device_node *np = NULL;
|
||||||
|
|
||||||
|
__of_msi_map_rid(dev, &np, rid);
|
||||||
|
return __of_get_msi_domain(np, DOMAIN_BUS_PCI_MSI);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_msi_get_domain - Use msi-parent to find the relevant MSI domain
|
* of_msi_get_domain - Use msi-parent to find the relevant MSI domain
|
||||||
* @dev: device for which the domain is requested
|
* @dev: device for which the domain is requested
|
||||||
|
@@ -49,6 +49,8 @@ extern int of_irq_to_resource_table(struct device_node *dev,
|
|||||||
extern struct irq_domain *of_msi_get_domain(struct device *dev,
|
extern struct irq_domain *of_msi_get_domain(struct device *dev,
|
||||||
struct device_node *np,
|
struct device_node *np,
|
||||||
enum irq_domain_bus_token token);
|
enum irq_domain_bus_token token);
|
||||||
|
extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
|
||||||
|
u32 rid);
|
||||||
#else
|
#else
|
||||||
static inline int of_irq_count(struct device_node *dev)
|
static inline int of_irq_count(struct device_node *dev)
|
||||||
{
|
{
|
||||||
@@ -73,6 +75,11 @@ static inline struct irq_domain *of_msi_get_domain(struct device *dev,
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
|
||||||
|
u32 rid)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_OF)
|
#if defined(CONFIG_OF)
|
||||||
|
Reference in New Issue
Block a user