diff options
author | Sam Bobroff <sam.bobroff@au1.ibm.com> | 2017-09-26 02:47:04 -0400 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2017-10-03 11:58:16 -0400 |
commit | 2fb1e946450a4fef74bb72f360555f7760d816f0 (patch) | |
tree | a2cd3794460739e885ca9456c2e3c81f3213a357 | |
parent | 9e66317d3c92ddaab330c125dfe9d06eee268aff (diff) |
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: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
Cc: stable@vger.kernel.org
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
-rw-r--r-- | arch/powerpc/kvm/book3s_xive.c | 5 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_xive.h | 1 |
2 files changed, 2 insertions, 4 deletions
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c index 13304622ab1c..bf457843e032 100644 --- a/arch/powerpc/kvm/book3s_xive.c +++ b/arch/powerpc/kvm/book3s_xive.c | |||
@@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, | |||
622 | return -EINVAL; | 622 | return -EINVAL; |
623 | state = &sb->irq_state[idx]; | 623 | state = &sb->irq_state[idx]; |
624 | arch_spin_lock(&sb->lock); | 624 | arch_spin_lock(&sb->lock); |
625 | *server = state->guest_server; | 625 | *server = state->act_server; |
626 | *priority = state->guest_priority; | 626 | *priority = state->guest_priority; |
627 | arch_spin_unlock(&sb->lock); | 627 | arch_spin_unlock(&sb->lock); |
628 | 628 | ||
@@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr) | |||
1331 | xive->saved_src_count++; | 1331 | xive->saved_src_count++; |
1332 | 1332 | ||
1333 | /* Convert saved state into something compatible with xics */ | 1333 | /* Convert saved state into something compatible with xics */ |
1334 | val = state->guest_server; | 1334 | val = state->act_server; |
1335 | prio = state->saved_scan_prio; | 1335 | prio = state->saved_scan_prio; |
1336 | 1336 | ||
1337 | if (prio == MASKED) { | 1337 | if (prio == MASKED) { |
@@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) | |||
1507 | /* First convert prio and mark interrupt as untargetted */ | 1507 | /* First convert prio and mark interrupt as untargetted */ |
1508 | act_prio = xive_prio_from_guest(guest_prio); | 1508 | act_prio = xive_prio_from_guest(guest_prio); |
1509 | state->act_priority = MASKED; | 1509 | state->act_priority = MASKED; |
1510 | state->guest_server = server; | ||
1511 | 1510 | ||
1512 | /* | 1511 | /* |
1513 | * We need to drop the lock due to the mutex below. Hopefully | 1512 | * We need to drop the lock due to the mutex below. Hopefully |
diff --git a/arch/powerpc/kvm/book3s_xive.h b/arch/powerpc/kvm/book3s_xive.h index 5938f7644dc1..6ba63f8e8a61 100644 --- a/arch/powerpc/kvm/book3s_xive.h +++ b/arch/powerpc/kvm/book3s_xive.h | |||
@@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state { | |||
35 | struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ | 35 | struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ |
36 | 36 | ||
37 | /* Targetting as set by guest */ | 37 | /* Targetting as set by guest */ |
38 | u32 guest_server; /* Current guest selected target */ | ||
39 | u8 guest_priority; /* Guest set priority */ | 38 | u8 guest_priority; /* Guest set priority */ |
40 | u8 saved_priority; /* Saved priority when masking */ | 39 | u8 saved_priority; /* Saved priority when masking */ |
41 | 40 | ||