* [PATCH] KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()
@ 2017-12-12 17:23 ` Laurent Vivier
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2017-12-12 17:23 UTC (permalink / raw)
To: kvm-ppc
Cc: linuxppc-dev, linux-kernel, Paul Mackerras,
Benjamin Herrenschmidt, Michael Ellerman, Cédric Le Goater
When we migrate a VM from a POWER8 host (XICS) to a POWER9 host
(XICS-on-XIVE), we have an error:
qemu-kvm: Unable to restore KVM interrupt controller state \
(0xff000000) for CPU 0: Invalid argument
This is because kvmppc_xics_set_icp() checks the new state
is internaly consistent, and especially:
...
1129 if (xisr == 0) {
1130 if (pending_pri != 0xff)
1131 return -EINVAL;
...
On the other side, kvmppc_xive_get_icp() doesn't set
neither the pending_pri value, nor the xisr value (set to 0)
(and kvmppc_xive_set_icp() ignores the pending_pri value)
As xisr is 0, pending_pri must be set to 0xff.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
arch/powerpc/kvm/book3s_xive.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index bf457843e032..e79062573f8c 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -725,7 +725,8 @@ u64 kvmppc_xive_get_icp(struct kvm_vcpu *vcpu)
/* Return the per-cpu state for state saving/migration */
return (u64)xc->cppr << KVM_REG_PPC_ICP_CPPR_SHIFT |
- (u64)xc->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT;
+ (u64)xc->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT |
+ (u64)0xff << KVM_REG_PPC_ICP_PPRI_SHIFT;
}
int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval)
--
2.14.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()
@ 2017-12-12 17:23 ` Laurent Vivier
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2017-12-12 17:23 UTC (permalink / raw)
To: kvm-ppc
Cc: linuxppc-dev, linux-kernel, Paul Mackerras,
Benjamin Herrenschmidt, Michael Ellerman, Cédric Le Goater
When we migrate a VM from a POWER8 host (XICS) to a POWER9 host
(XICS-on-XIVE), we have an error:
qemu-kvm: Unable to restore KVM interrupt controller state \
(0xff000000) for CPU 0: Invalid argument
This is because kvmppc_xics_set_icp() checks the new state
is internaly consistent, and especially:
...
1129 if (xisr = 0) {
1130 if (pending_pri != 0xff)
1131 return -EINVAL;
...
On the other side, kvmppc_xive_get_icp() doesn't set
neither the pending_pri value, nor the xisr value (set to 0)
(and kvmppc_xive_set_icp() ignores the pending_pri value)
As xisr is 0, pending_pri must be set to 0xff.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
arch/powerpc/kvm/book3s_xive.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index bf457843e032..e79062573f8c 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -725,7 +725,8 @@ u64 kvmppc_xive_get_icp(struct kvm_vcpu *vcpu)
/* Return the per-cpu state for state saving/migration */
return (u64)xc->cppr << KVM_REG_PPC_ICP_CPPR_SHIFT |
- (u64)xc->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT;
+ (u64)xc->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT |
+ (u64)0xff << KVM_REG_PPC_ICP_PPRI_SHIFT;
}
int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval)
--
2.14.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()
2017-12-12 17:23 ` Laurent Vivier
@ 2017-12-12 20:18 ` Benjamin Herrenschmidt
-1 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2017-12-12 20:18 UTC (permalink / raw)
To: Laurent Vivier, kvm-ppc
Cc: linuxppc-dev, linux-kernel, Paul Mackerras, Michael Ellerman,
Cédric Le Goater
On Tue, 2017-12-12 at 18:23 +0100, Laurent Vivier wrote:
> When we migrate a VM from a POWER8 host (XICS) to a POWER9 host
> (XICS-on-XIVE), we have an error:
>
> qemu-kvm: Unable to restore KVM interrupt controller state \
> (0xff000000) for CPU 0: Invalid argument
>
> This is because kvmppc_xics_set_icp() checks the new state
> is internaly consistent, and especially:
>
> ...
> 1129 if (xisr == 0) {
> 1130 if (pending_pri != 0xff)
> 1131 return -EINVAL;
> ...
>
> On the other side, kvmppc_xive_get_icp() doesn't set
> neither the pending_pri value, nor the xisr value (set to 0)
> (and kvmppc_xive_set_icp() ignores the pending_pri value)
>
> As xisr is 0, pending_pri must be set to 0xff.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()
@ 2017-12-12 20:18 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2017-12-12 20:18 UTC (permalink / raw)
To: Laurent Vivier, kvm-ppc
Cc: linuxppc-dev, linux-kernel, Paul Mackerras, Michael Ellerman,
Cédric Le Goater
On Tue, 2017-12-12 at 18:23 +0100, Laurent Vivier wrote:
> When we migrate a VM from a POWER8 host (XICS) to a POWER9 host
> (XICS-on-XIVE), we have an error:
>
> qemu-kvm: Unable to restore KVM interrupt controller state \
> (0xff000000) for CPU 0: Invalid argument
>
> This is because kvmppc_xics_set_icp() checks the new state
> is internaly consistent, and especially:
>
> ...
> 1129 if (xisr = 0) {
> 1130 if (pending_pri != 0xff)
> 1131 return -EINVAL;
> ...
>
> On the other side, kvmppc_xive_get_icp() doesn't set
> neither the pending_pri value, nor the xisr value (set to 0)
> (and kvmppc_xive_set_icp() ignores the pending_pri value)
>
> As xisr is 0, pending_pri must be set to 0xff.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()
2017-12-12 17:23 ` Laurent Vivier
@ 2017-12-22 11:24 ` Michael Ellerman
-1 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:24 UTC (permalink / raw)
To: Laurent Vivier, kvm-ppc; +Cc: linux-kernel, Cédric Le Goater, linuxppc-dev
On Tue, 2017-12-12 at 17:23:56 UTC, Laurent Vivier wrote:
> When we migrate a VM from a POWER8 host (XICS) to a POWER9 host
> (XICS-on-XIVE), we have an error:
>
> qemu-kvm: Unable to restore KVM interrupt controller state \
> (0xff000000) for CPU 0: Invalid argument
>
> This is because kvmppc_xics_set_icp() checks the new state
> is internaly consistent, and especially:
>
> ...
> 1129 if (xisr == 0) {
> 1130 if (pending_pri != 0xff)
> 1131 return -EINVAL;
> ...
>
> On the other side, kvmppc_xive_get_icp() doesn't set
> neither the pending_pri value, nor the xisr value (set to 0)
> (and kvmppc_xive_set_icp() ignores the pending_pri value)
>
> As xisr is 0, pending_pri must be set to 0xff.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/7333b5aca412d6ad02667b5a513485
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()
@ 2017-12-22 11:24 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:24 UTC (permalink / raw)
To: Laurent Vivier, kvm-ppc; +Cc: linux-kernel, Cédric Le Goater, linuxppc-dev
On Tue, 2017-12-12 at 17:23:56 UTC, Laurent Vivier wrote:
> When we migrate a VM from a POWER8 host (XICS) to a POWER9 host
> (XICS-on-XIVE), we have an error:
>
> qemu-kvm: Unable to restore KVM interrupt controller state \
> (0xff000000) for CPU 0: Invalid argument
>
> This is because kvmppc_xics_set_icp() checks the new state
> is internaly consistent, and especially:
>
> ...
> 1129 if (xisr = 0) {
> 1130 if (pending_pri != 0xff)
> 1131 return -EINVAL;
> ...
>
> On the other side, kvmppc_xive_get_icp() doesn't set
> neither the pending_pri value, nor the xisr value (set to 0)
> (and kvmppc_xive_set_icp() ignores the pending_pri value)
>
> As xisr is 0, pending_pri must be set to 0xff.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/7333b5aca412d6ad02667b5a513485
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-22 11:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 17:23 [PATCH] KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp() Laurent Vivier
2017-12-12 17:23 ` Laurent Vivier
2017-12-12 20:18 ` Benjamin Herrenschmidt
2017-12-12 20:18 ` Benjamin Herrenschmidt
2017-12-22 11:24 ` Michael Ellerman
2017-12-22 11:24 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.