]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
x86/irq: Add allocation type for parent domain retrieval
authorThomas Gleixner <tglx@linutronix.de>
Wed, 26 Aug 2020 11:16:36 +0000 (13:16 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 16 Sep 2020 14:52:29 +0000 (16:52 +0200)
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
arch/x86/include/asm/hw_irq.h
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/apic/msi.c
drivers/iommu/amd/iommu.c
drivers/iommu/hyperv-iommu.c
drivers/iommu/intel/irq_remapping.c

index 3982a1ea662aaf9b106d26e85f4b5b72f858fd18..91b064da6ce5f6d816ae3919f52abeba53b63d59 100644 (file)
@@ -40,6 +40,8 @@ enum irq_alloc_type {
        X86_IRQ_ALLOC_TYPE_PCI_MSIX,
        X86_IRQ_ALLOC_TYPE_DMAR,
        X86_IRQ_ALLOC_TYPE_UV,
+       X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT,
+       X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT,
 };
 
 struct irq_alloc_info {
index 779a89e31c4cb937b5efe089633bd5d0d7a270d8..be01bb608d49c6b74813398e9ececf21d8155903 100644 (file)
@@ -2296,7 +2296,7 @@ static int mp_irqdomain_create(int ioapic)
                return 0;
 
        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);
        parent = irq_remapping_get_ir_irq_domain(&info);
        if (!parent)
index 7410d34a5b8d64ca5d14d3543db39cf0993226ba..421c0169a124cfe882f91a6eec1bbea89abecca1 100644 (file)
@@ -472,7 +472,7 @@ struct irq_domain *hpet_create_irq_domain(int hpet_id)
        domain_info->data = (void *)(long)hpet_id;
 
        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;
        parent = irq_remapping_get_ir_irq_domain(&info);
        if (parent == NULL)
index cf26b735922b969fe95b1e5319fdb75aac248693..b98b0abac103a020ca6aae5df1ce4654a7379035 100644 (file)
@@ -3548,6 +3548,14 @@ static struct irq_domain *get_ir_irq_domain(struct irq_alloc_info *info)
        if (!info)
                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);
        if (devid >= 0) {
                iommu = amd_iommu_rlookup_table[devid];
index 8919c1c70b68ac8b6007604c689fb3ba746b073f..e7bee11ecedc41d05059d4f111020dfb574c0e3b 100644 (file)
@@ -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)
 {
-       if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC)
+       if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT)
                return ioapic_ir_domain;
        else
                return NULL;
index 33c43898939147b0d86af1d591f874ea05099755..9b15cd015f8df10e5e0180de661c0bb89ea76f74 100644 (file)
@@ -1115,16 +1115,12 @@ static struct irq_domain *intel_get_ir_irq_domain(struct irq_alloc_info *info)
                return NULL;
 
        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);
                break;
-       case X86_IRQ_ALLOC_TYPE_HPET:
+       case X86_IRQ_ALLOC_TYPE_HPET_GET_PARENT:
                iommu = map_hpet_to_ir(info->hpet_id);
                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:
                BUG_ON(1);
                break;