KVM: PPC: Book3S HV: XIVE: Change interface of passthrough interrupt routines
authorCédric Le Goater <clg@kaod.org>
Thu, 1 Jul 2021 13:27:32 +0000 (15:27 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 10 Aug 2021 13:14:59 +0000 (23:14 +1000)
The routine kvmppc_set_passthru_irq() calls kvmppc_xive_set_mapped()
and kvmppc_xive_clr_mapped() with an IRQ descriptor. Use directly the
host IRQ number to remove a useless conversion.

Add some debug.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210701132750.1475580-15-clg@kaod.org
arch/powerpc/include/asm/kvm_ppc.h
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_xive.c

index 2d88944..671fbd1 100644 (file)
@@ -664,9 +664,9 @@ extern int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
                                    struct kvm_vcpu *vcpu, u32 cpu);
 extern void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu);
 extern int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
-                                 struct irq_desc *host_desc);
+                                 unsigned long host_irq);
 extern int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
-                                 struct irq_desc *host_desc);
+                                 unsigned long host_irq);
 extern u64 kvmppc_xive_get_icp(struct kvm_vcpu *vcpu);
 extern int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
 
index 1a757c3..05b3a35 100644 (file)
@@ -5398,7 +5398,7 @@ static int kvmppc_set_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)
                pimap->n_mapped++;
 
        if (xics_on_xive())
-               rc = kvmppc_xive_set_mapped(kvm, guest_gsi, desc);
+               rc = kvmppc_xive_set_mapped(kvm, guest_gsi, host_irq);
        else
                kvmppc_xics_set_mapped(kvm, guest_gsi, desc->irq_data.hwirq);
        if (rc)
@@ -5439,7 +5439,7 @@ static int kvmppc_clr_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)
        }
 
        if (xics_on_xive())
-               rc = kvmppc_xive_clr_mapped(kvm, guest_gsi, pimap->mapped[i].desc);
+               rc = kvmppc_xive_clr_mapped(kvm, guest_gsi, host_irq);
        else
                kvmppc_xics_clr_mapped(kvm, guest_gsi, pimap->mapped[i].r_hwirq);
 
index 8cfab35..45a0434 100644 (file)
@@ -922,13 +922,12 @@ int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval)
 }
 
 int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
-                          struct irq_desc *host_desc)
+                          unsigned long host_irq)
 {
        struct kvmppc_xive *xive = kvm->arch.xive;
        struct kvmppc_xive_src_block *sb;
        struct kvmppc_xive_irq_state *state;
-       struct irq_data *host_data = irq_desc_get_irq_data(host_desc);
-       unsigned int host_irq = irq_desc_get_irq(host_desc);
+       struct irq_data *host_data = irq_get_irq_data(host_irq);
        unsigned int hw_irq = (unsigned int)irqd_to_hwirq(host_data);
        u16 idx;
        u8 prio;
@@ -937,7 +936,8 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
        if (!xive)
                return -ENODEV;
 
-       pr_devel("set_mapped girq 0x%lx host HW irq 0x%x...\n",guest_irq, hw_irq);
+       pr_debug("%s: GIRQ 0x%lx host IRQ %ld XIVE HW IRQ 0x%x\n",
+                __func__, guest_irq, host_irq, hw_irq);
 
        sb = kvmppc_xive_find_source(xive, guest_irq, &idx);
        if (!sb)
@@ -959,7 +959,7 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
         */
        rc = irq_set_vcpu_affinity(host_irq, state);
        if (rc) {
-               pr_err("Failed to set VCPU affinity for irq %d\n", host_irq);
+               pr_err("Failed to set VCPU affinity for host IRQ %ld\n", host_irq);
                return rc;
        }
 
@@ -1019,12 +1019,11 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
 EXPORT_SYMBOL_GPL(kvmppc_xive_set_mapped);
 
 int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
-                          struct irq_desc *host_desc)
+                          unsigned long host_irq)
 {
        struct kvmppc_xive *xive = kvm->arch.xive;
        struct kvmppc_xive_src_block *sb;
        struct kvmppc_xive_irq_state *state;
-       unsigned int host_irq = irq_desc_get_irq(host_desc);
        u16 idx;
        u8 prio;
        int rc;
@@ -1032,7 +1031,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
        if (!xive)
                return -ENODEV;
 
-       pr_devel("clr_mapped girq 0x%lx...\n", guest_irq);
+       pr_debug("%s: GIRQ 0x%lx host IRQ %ld\n", __func__, guest_irq, host_irq);
 
        sb = kvmppc_xive_find_source(xive, guest_irq, &idx);
        if (!sb)
@@ -1059,7 +1058,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
        /* Release the passed-through interrupt to the host */
        rc = irq_set_vcpu_affinity(host_irq, NULL);
        if (rc) {
-               pr_err("Failed to clr VCPU affinity for irq %d\n", host_irq);
+               pr_err("Failed to clr VCPU affinity for host IRQ %ld\n", host_irq);
                return rc;
        }