Commit 2fb1e946 authored by Sam Bobroff's avatar Sam Bobroff Committed by Radim Krčmář

KVM: PPC: Book3S: Fix server always zero from kvmppc_xive_get_xive()

In KVM's XICS-on-XIVE emulation, kvmppc_xive_get_xive() returns the
value of state->guest_server as "server". However, this value is not
set by it's counterpart kvmppc_xive_set_xive(). When the guest uses
this interface to migrate interrupts away from a CPU that is going
offline, it sees all interrupts as belonging to CPU 0, so they are
left assigned to (now) offline CPUs.

This patch removes the guest_server field from the state, and returns
act_server in it's place (that is, the CPU actually handling the
interrupt, which may differ from the one requested).

Fixes: 5af50993 ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 9e66317d
...@@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, ...@@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server,
return -EINVAL; return -EINVAL;
state = &sb->irq_state[idx]; state = &sb->irq_state[idx];
arch_spin_lock(&sb->lock); arch_spin_lock(&sb->lock);
*server = state->guest_server; *server = state->act_server;
*priority = state->guest_priority; *priority = state->guest_priority;
arch_spin_unlock(&sb->lock); arch_spin_unlock(&sb->lock);
...@@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr) ...@@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr)
xive->saved_src_count++; xive->saved_src_count++;
/* Convert saved state into something compatible with xics */ /* Convert saved state into something compatible with xics */
val = state->guest_server; val = state->act_server;
prio = state->saved_scan_prio; prio = state->saved_scan_prio;
if (prio == MASKED) { if (prio == MASKED) {
...@@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) ...@@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
/* First convert prio and mark interrupt as untargetted */ /* First convert prio and mark interrupt as untargetted */
act_prio = xive_prio_from_guest(guest_prio); act_prio = xive_prio_from_guest(guest_prio);
state->act_priority = MASKED; state->act_priority = MASKED;
state->guest_server = server;
/* /*
* We need to drop the lock due to the mutex below. Hopefully * We need to drop the lock due to the mutex below. Hopefully
......
...@@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state { ...@@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state {
struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */
/* Targetting as set by guest */ /* Targetting as set by guest */
u32 guest_server; /* Current guest selected target */
u8 guest_priority; /* Guest set priority */ u8 guest_priority; /* Guest set priority */
u8 saved_priority; /* Saved priority when masking */ u8 saved_priority; /* Saved priority when masking */
......
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