mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
iommu/irq_remapping: Consolidate irq domain lookup
Now that the iommu implementations handle the X86_*_GET_PARENT_DOMAIN types, consolidate the two getter functions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Joerg Roedel <jroedel@suse.de> Link: https://lore.kernel.org/r/20200826112331.741909337@linutronix.de
This commit is contained in:
parent
192a99f4bd
commit
6b6256e616
@ -44,8 +44,6 @@ extern int irq_remapping_reenable(int);
|
|||||||
extern int irq_remap_enable_fault_handling(void);
|
extern int irq_remap_enable_fault_handling(void);
|
||||||
extern void panic_if_irq_remap(const char *msg);
|
extern void panic_if_irq_remap(const char *msg);
|
||||||
|
|
||||||
extern struct irq_domain *
|
|
||||||
irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info);
|
|
||||||
extern struct irq_domain *
|
extern struct irq_domain *
|
||||||
irq_remapping_get_irq_domain(struct irq_alloc_info *info);
|
irq_remapping_get_irq_domain(struct irq_alloc_info *info);
|
||||||
|
|
||||||
@ -73,12 +71,6 @@ static inline void panic_if_irq_remap(const char *msg)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct irq_domain *
|
|
||||||
irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct irq_domain *
|
static inline struct irq_domain *
|
||||||
irq_remapping_get_irq_domain(struct irq_alloc_info *info)
|
irq_remapping_get_irq_domain(struct irq_alloc_info *info)
|
||||||
{
|
{
|
||||||
|
@ -2298,7 +2298,7 @@ static int mp_irqdomain_create(int ioapic)
|
|||||||
init_irq_alloc_info(&info, NULL);
|
init_irq_alloc_info(&info, NULL);
|
||||||
info.type = X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT;
|
info.type = X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT;
|
||||||
info.ioapic_id = mpc_ioapic_id(ioapic);
|
info.ioapic_id = mpc_ioapic_id(ioapic);
|
||||||
parent = irq_remapping_get_ir_irq_domain(&info);
|
parent = irq_remapping_get_irq_domain(&info);
|
||||||
if (!parent)
|
if (!parent)
|
||||||
parent = x86_vector_domain;
|
parent = x86_vector_domain;
|
||||||
else
|
else
|
||||||
|
@ -474,7 +474,7 @@ struct irq_domain *hpet_create_irq_domain(int hpet_id)
|
|||||||
init_irq_alloc_info(&info, NULL);
|
init_irq_alloc_info(&info, NULL);
|
||||||
info.type = X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT;
|
info.type = X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT;
|
||||||
info.hpet_id = hpet_id;
|
info.hpet_id = hpet_id;
|
||||||
parent = irq_remapping_get_ir_irq_domain(&info);
|
parent = irq_remapping_get_irq_domain(&info);
|
||||||
if (parent == NULL)
|
if (parent == NULL)
|
||||||
parent = x86_vector_domain;
|
parent = x86_vector_domain;
|
||||||
else
|
else
|
||||||
|
@ -3575,7 +3575,6 @@ struct irq_remap_ops amd_iommu_irq_ops = {
|
|||||||
.disable = amd_iommu_disable,
|
.disable = amd_iommu_disable,
|
||||||
.reenable = amd_iommu_reenable,
|
.reenable = amd_iommu_reenable,
|
||||||
.enable_faulting = amd_iommu_enable_faulting,
|
.enable_faulting = amd_iommu_enable_faulting,
|
||||||
.get_ir_irq_domain = get_irq_domain,
|
|
||||||
.get_irq_domain = get_irq_domain,
|
.get_irq_domain = get_irq_domain,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ static int __init hyperv_enable_irq_remapping(void)
|
|||||||
return IRQ_REMAP_X2APIC_MODE;
|
return IRQ_REMAP_X2APIC_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct irq_domain *hyperv_get_ir_irq_domain(struct irq_alloc_info *info)
|
static struct irq_domain *hyperv_get_irq_domain(struct irq_alloc_info *info)
|
||||||
{
|
{
|
||||||
if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT)
|
if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT)
|
||||||
return ioapic_ir_domain;
|
return ioapic_ir_domain;
|
||||||
@ -193,7 +193,7 @@ static struct irq_domain *hyperv_get_ir_irq_domain(struct irq_alloc_info *info)
|
|||||||
struct irq_remap_ops hyperv_irq_remap_ops = {
|
struct irq_remap_ops hyperv_irq_remap_ops = {
|
||||||
.prepare = hyperv_prepare_irq_remapping,
|
.prepare = hyperv_prepare_irq_remapping,
|
||||||
.enable = hyperv_enable_irq_remapping,
|
.enable = hyperv_enable_irq_remapping,
|
||||||
.get_ir_irq_domain = hyperv_get_ir_irq_domain,
|
.get_irq_domain = hyperv_get_irq_domain,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1137,7 +1137,6 @@ struct irq_remap_ops intel_irq_remap_ops = {
|
|||||||
.disable = disable_irq_remapping,
|
.disable = disable_irq_remapping,
|
||||||
.reenable = reenable_irq_remapping,
|
.reenable = reenable_irq_remapping,
|
||||||
.enable_faulting = enable_drhd_fault_handling,
|
.enable_faulting = enable_drhd_fault_handling,
|
||||||
.get_ir_irq_domain = intel_get_irq_domain,
|
|
||||||
.get_irq_domain = intel_get_irq_domain,
|
.get_irq_domain = intel_get_irq_domain,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,34 +159,13 @@ void panic_if_irq_remap(const char *msg)
|
|||||||
panic(msg);
|
panic(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* irq_remapping_get_ir_irq_domain - Get the irqdomain associated with the IOMMU
|
|
||||||
* device serving request @info
|
|
||||||
* @info: interrupt allocation information, used to identify the IOMMU device
|
|
||||||
*
|
|
||||||
* It's used to get parent irqdomain for HPET and IOAPIC irqdomains.
|
|
||||||
* Returns pointer to IRQ domain, or NULL on failure.
|
|
||||||
*/
|
|
||||||
struct irq_domain *
|
|
||||||
irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info)
|
|
||||||
{
|
|
||||||
if (!remap_ops || !remap_ops->get_ir_irq_domain)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return remap_ops->get_ir_irq_domain(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* irq_remapping_get_irq_domain - Get the irqdomain serving the request @info
|
* irq_remapping_get_irq_domain - Get the irqdomain serving the request @info
|
||||||
* @info: interrupt allocation information, used to identify the IOMMU device
|
* @info: interrupt allocation information, used to identify the IOMMU device
|
||||||
*
|
*
|
||||||
* There will be one PCI MSI/MSIX irqdomain associated with each interrupt
|
|
||||||
* remapping device, so this interface is used to retrieve the PCI MSI/MSIX
|
|
||||||
* irqdomain serving request @info.
|
|
||||||
* Returns pointer to IRQ domain, or NULL on failure.
|
* Returns pointer to IRQ domain, or NULL on failure.
|
||||||
*/
|
*/
|
||||||
struct irq_domain *
|
struct irq_domain *irq_remapping_get_irq_domain(struct irq_alloc_info *info)
|
||||||
irq_remapping_get_irq_domain(struct irq_alloc_info *info)
|
|
||||||
{
|
{
|
||||||
if (!remap_ops || !remap_ops->get_irq_domain)
|
if (!remap_ops || !remap_ops->get_irq_domain)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -43,10 +43,7 @@ struct irq_remap_ops {
|
|||||||
/* Enable fault handling */
|
/* Enable fault handling */
|
||||||
int (*enable_faulting)(void);
|
int (*enable_faulting)(void);
|
||||||
|
|
||||||
/* Get the irqdomain associated the IOMMU device */
|
/* Get the irqdomain associated to IOMMU device */
|
||||||
struct irq_domain *(*get_ir_irq_domain)(struct irq_alloc_info *);
|
|
||||||
|
|
||||||
/* Get the MSI irqdomain associated with the IOMMU device */
|
|
||||||
struct irq_domain *(*get_irq_domain)(struct irq_alloc_info *);
|
struct irq_domain *(*get_irq_domain)(struct irq_alloc_info *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user