Commit e5e78b15 authored by Cédric Le Goater's avatar Cédric Le Goater Committed by Michael Ellerman

KVM: PPC: Book3S HV: XIVE: Change interface of passthrough interrupt routines

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: default avatarCédric Le Goater <clg@kaod.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210701132750.1475580-15-clg@kaod.org
parent ba418a02
...@@ -664,9 +664,9 @@ extern int kvmppc_xive_connect_vcpu(struct kvm_device *dev, ...@@ -664,9 +664,9 @@ extern int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
struct kvm_vcpu *vcpu, u32 cpu); struct kvm_vcpu *vcpu, u32 cpu);
extern void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu); extern void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu);
extern int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq, 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, 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 u64 kvmppc_xive_get_icp(struct kvm_vcpu *vcpu);
extern int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval); extern int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
......
...@@ -5398,7 +5398,7 @@ static int kvmppc_set_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi) ...@@ -5398,7 +5398,7 @@ static int kvmppc_set_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)
pimap->n_mapped++; pimap->n_mapped++;
if (xics_on_xive()) if (xics_on_xive())
rc = kvmppc_xive_set_mapped(kvm, guest_gsi, desc); rc = kvmppc_xive_set_mapped(kvm, guest_gsi, host_irq);
else else
kvmppc_xics_set_mapped(kvm, guest_gsi, desc->irq_data.hwirq); kvmppc_xics_set_mapped(kvm, guest_gsi, desc->irq_data.hwirq);
if (rc) if (rc)
...@@ -5439,7 +5439,7 @@ static int kvmppc_clr_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi) ...@@ -5439,7 +5439,7 @@ static int kvmppc_clr_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)
} }
if (xics_on_xive()) 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 else
kvmppc_xics_clr_mapped(kvm, guest_gsi, pimap->mapped[i].r_hwirq); kvmppc_xics_clr_mapped(kvm, guest_gsi, pimap->mapped[i].r_hwirq);
......
...@@ -922,13 +922,12 @@ int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval) ...@@ -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, 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 *xive = kvm->arch.xive;
struct kvmppc_xive_src_block *sb; struct kvmppc_xive_src_block *sb;
struct kvmppc_xive_irq_state *state; struct kvmppc_xive_irq_state *state;
struct irq_data *host_data = irq_desc_get_irq_data(host_desc); struct irq_data *host_data = irq_get_irq_data(host_irq);
unsigned int host_irq = irq_desc_get_irq(host_desc);
unsigned int hw_irq = (unsigned int)irqd_to_hwirq(host_data); unsigned int hw_irq = (unsigned int)irqd_to_hwirq(host_data);
u16 idx; u16 idx;
u8 prio; u8 prio;
...@@ -937,7 +936,8 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq, ...@@ -937,7 +936,8 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
if (!xive) if (!xive)
return -ENODEV; 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); sb = kvmppc_xive_find_source(xive, guest_irq, &idx);
if (!sb) if (!sb)
...@@ -959,7 +959,7 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq, ...@@ -959,7 +959,7 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
*/ */
rc = irq_set_vcpu_affinity(host_irq, state); rc = irq_set_vcpu_affinity(host_irq, state);
if (rc) { 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; return rc;
} }
...@@ -1019,12 +1019,11 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq, ...@@ -1019,12 +1019,11 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
EXPORT_SYMBOL_GPL(kvmppc_xive_set_mapped); EXPORT_SYMBOL_GPL(kvmppc_xive_set_mapped);
int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq, 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 *xive = kvm->arch.xive;
struct kvmppc_xive_src_block *sb; struct kvmppc_xive_src_block *sb;
struct kvmppc_xive_irq_state *state; struct kvmppc_xive_irq_state *state;
unsigned int host_irq = irq_desc_get_irq(host_desc);
u16 idx; u16 idx;
u8 prio; u8 prio;
int rc; int rc;
...@@ -1032,7 +1031,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq, ...@@ -1032,7 +1031,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
if (!xive) if (!xive)
return -ENODEV; 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); sb = kvmppc_xive_find_source(xive, guest_irq, &idx);
if (!sb) if (!sb)
...@@ -1059,7 +1058,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq, ...@@ -1059,7 +1058,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
/* Release the passed-through interrupt to the host */ /* Release the passed-through interrupt to the host */
rc = irq_set_vcpu_affinity(host_irq, NULL); rc = irq_set_vcpu_affinity(host_irq, NULL);
if (rc) { 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; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment