x86/irq: Add allocation type for parent domain retrieval
irq_remapping_ir_irq_domain() is used to retrieve the remapping parent domain for an allocation type. irq_remapping_irq_domain() is for retrieving the actual device domain for allocating interrupts for a device. The two functions are similar and can be unified by using explicit modes for parent irq domain retrieval. Add X86_IRQ_ALLOC_TYPE_IOAPIC/HPET_GET_PARENT and use it in the iommu implementations. Drop the parent domain retrieval for PCI_MSI/X as that is unused. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Joerg Roedel <jroedel@suse.de> Link: https://lore.kernel.org/r/20200826112331.436350257@linutronix.de
This commit is contained in:
@@ -40,6 +40,8 @@ enum irq_alloc_type {
|
|||||||
X86_IRQ_ALLOC_TYPE_PCI_MSIX,
|
X86_IRQ_ALLOC_TYPE_PCI_MSIX,
|
||||||
X86_IRQ_ALLOC_TYPE_DMAR,
|
X86_IRQ_ALLOC_TYPE_DMAR,
|
||||||
X86_IRQ_ALLOC_TYPE_UV,
|
X86_IRQ_ALLOC_TYPE_UV,
|
||||||
|
X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT,
|
||||||
|
X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct irq_alloc_info {
|
struct irq_alloc_info {
|
||||||
|
|||||||
@@ -2296,7 +2296,7 @@ static int mp_irqdomain_create(int ioapic)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
init_irq_alloc_info(&info, NULL);
|
init_irq_alloc_info(&info, NULL);
|
||||||
info.type = X86_IRQ_ALLOC_TYPE_IOAPIC;
|
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_ir_irq_domain(&info);
|
||||||
if (!parent)
|
if (!parent)
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ struct irq_domain *hpet_create_irq_domain(int hpet_id)
|
|||||||
domain_info->data = (void *)(long)hpet_id;
|
domain_info->data = (void *)(long)hpet_id;
|
||||||
|
|
||||||
init_irq_alloc_info(&info, NULL);
|
init_irq_alloc_info(&info, NULL);
|
||||||
info.type = X86_IRQ_ALLOC_TYPE_HPET;
|
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_ir_irq_domain(&info);
|
||||||
if (parent == NULL)
|
if (parent == NULL)
|
||||||
|
|||||||
@@ -3548,6 +3548,14 @@ static struct irq_domain *get_ir_irq_domain(struct irq_alloc_info *info)
|
|||||||
if (!info)
|
if (!info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
switch (info->type) {
|
||||||
|
case X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT:
|
||||||
|
case X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
devid = get_devid(info);
|
devid = get_devid(info);
|
||||||
if (devid >= 0) {
|
if (devid >= 0) {
|
||||||
iommu = amd_iommu_rlookup_table[devid];
|
iommu = amd_iommu_rlookup_table[devid];
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ static int __init hyperv_enable_irq_remapping(void)
|
|||||||
|
|
||||||
static struct irq_domain *hyperv_get_ir_irq_domain(struct irq_alloc_info *info)
|
static struct irq_domain *hyperv_get_ir_irq_domain(struct irq_alloc_info *info)
|
||||||
{
|
{
|
||||||
if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC)
|
if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT)
|
||||||
return ioapic_ir_domain;
|
return ioapic_ir_domain;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -1115,16 +1115,12 @@ static struct irq_domain *intel_get_ir_irq_domain(struct irq_alloc_info *info)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (info->type) {
|
switch (info->type) {
|
||||||
case X86_IRQ_ALLOC_TYPE_IOAPIC:
|
case X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT:
|
||||||
iommu = map_ioapic_to_ir(info->ioapic_id);
|
iommu = map_ioapic_to_ir(info->ioapic_id);
|
||||||
break;
|
break;
|
||||||
case X86_IRQ_ALLOC_TYPE_HPET:
|
case X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT:
|
||||||
iommu = map_hpet_to_ir(info->hpet_id);
|
iommu = map_hpet_to_ir(info->hpet_id);
|
||||||
break;
|
break;
|
||||||
case X86_IRQ_ALLOC_TYPE_PCI_MSI:
|
|
||||||
case X86_IRQ_ALLOC_TYPE_PCI_MSIX:
|
|
||||||
iommu = map_dev_to_ir(info->msi_dev);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
BUG_ON(1);
|
BUG_ON(1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user