kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/1] KVM: s390: Fix for 5.6
@ 2020-03-12 14:27 Christian Borntraeger
  2020-03-12 14:27 ` [GIT PULL 1/1] KVM: s390: Also reset registers in sync regs for initial cpu reset Christian Borntraeger
  2020-03-14 10:59 ` [GIT PULL 0/1] KVM: s390: Fix for 5.6 Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Borntraeger @ 2020-03-12 14:27 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Janosch Frank, David Hildenbrand, Cornelia Huck, linux-s390,
	Christian Borntraeger

Paolo,

one fix for the reset that was detected by some improved selftests:

The following changes since commit d718fdc3e752ba51ddb2b5554d3db98a09355cc2:

  KVM: x86: remove stale comment from struct x86_emulate_ctxt (2020-03-03 17:38:22 +0100)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-5.6-1

for you to fetch changes up to e93fc7b4544a5475cfdbc22f87e89f9829bf801c:

  KVM: s390: Also reset registers in sync regs for initial cpu reset (2020-03-11 08:25:26 +0100)

----------------------------------------------------------------
KVM: s390: Fully do the CPU resets as intended

With 7de3f1423ff9 ("KVM: s390: Add new reset vcpu API") we clarified
the meaning of the reset ioctl to fully reset the CPU and not only the
parts that can not be handled by userspace. Turns out that we missed
some parts.

----------------------------------------------------------------
Christian Borntraeger (1):
      KVM: s390: Also reset registers in sync regs for initial cpu reset

 arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [GIT PULL 1/1] KVM: s390: Also reset registers in sync regs for initial cpu reset
  2020-03-12 14:27 [GIT PULL 0/1] KVM: s390: Fix for 5.6 Christian Borntraeger
@ 2020-03-12 14:27 ` Christian Borntraeger
  2020-03-14 10:59 ` [GIT PULL 0/1] KVM: s390: Fix for 5.6 Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2020-03-12 14:27 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Janosch Frank, David Hildenbrand, Cornelia Huck, linux-s390,
	Christian Borntraeger

When we do the initial CPU reset we must not only clear the registers
in the internal data structures but also in kvm_run sync_regs. For
modern userspace sync_regs is the only place that it looks at.

Fixes: 7de3f1423ff9 ("KVM: s390: Add new reset vcpu API")
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d7ff30e45589..c2e6d4ba4e23 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
 	/* Initial reset is a superset of the normal reset */
 	kvm_arch_vcpu_ioctl_normal_reset(vcpu);
 
-	/* this equals initial cpu reset in pop, but we don't switch to ESA */
+	/*
+	 * This equals initial cpu reset in pop, but we don't switch to ESA.
+	 * We do not only reset the internal data, but also ...
+	 */
 	vcpu->arch.sie_block->gpsw.mask = 0;
 	vcpu->arch.sie_block->gpsw.addr = 0;
 	kvm_s390_set_prefix(vcpu, 0);
@@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
 	memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
 	vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
 	vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
+
+	/* ... the data in sync regs */
+	memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
+	vcpu->run->s.regs.ckc = 0;
+	vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
+	vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
+	vcpu->run->psw_addr = 0;
+	vcpu->run->psw_mask = 0;
+	vcpu->run->s.regs.todpr = 0;
+	vcpu->run->s.regs.cputm = 0;
+	vcpu->run->s.regs.ckc = 0;
+	vcpu->run->s.regs.pp = 0;
+	vcpu->run->s.regs.gbea = 1;
 	vcpu->run->s.regs.fpc = 0;
 	vcpu->arch.sie_block->gbea = 1;
 	vcpu->arch.sie_block->pp = 0;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [GIT PULL 0/1] KVM: s390: Fix for 5.6
  2020-03-12 14:27 [GIT PULL 0/1] KVM: s390: Fix for 5.6 Christian Borntraeger
  2020-03-12 14:27 ` [GIT PULL 1/1] KVM: s390: Also reset registers in sync regs for initial cpu reset Christian Borntraeger
@ 2020-03-14 10:59 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-03-14 10:59 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: KVM, Janosch Frank, David Hildenbrand, Cornelia Huck, linux-s390

On 12/03/20 15:27, Christian Borntraeger wrote:
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-5.6-1

Pulled, thanks.

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-15  3:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 14:27 [GIT PULL 0/1] KVM: s390: Fix for 5.6 Christian Borntraeger
2020-03-12 14:27 ` [GIT PULL 1/1] KVM: s390: Also reset registers in sync regs for initial cpu reset Christian Borntraeger
2020-03-14 10:59 ` [GIT PULL 0/1] KVM: s390: Fix for 5.6 Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).