aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2015-10-29 05:30:36 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-21 03:43:46 -0400
commit91473b487dd58af6384c5c3db13de50defa2c106 (patch)
treeda99d623f00f1786619141a2e82b48b182187c18
parentb917ae573f5b3f7fee8cfb0d42d74bd8641f6401 (diff)
KVM: s390: vsie: correctly set and handle guest TOD
Guest 2 sets up the epoch of guest 3 from his point of view. Therefore, we have to add the guest 2 epoch to the guest 3 epoch. We also have to take care of guest 2 epoch changes on STP syncs. This will work just fine by also updating the guest 3 epoch when a vsie_block has been set for a VCPU. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--arch/s390/kvm/kvm-s390.c2
-rw-r--r--arch/s390/kvm/vsie.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 8ba7a98a50cf..6fdf1f7647d7 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -176,6 +176,8 @@ static int kvm_clock_sync(struct notifier_block *notifier, unsigned long val,
176 vcpu->arch.sie_block->epoch -= *delta; 176 vcpu->arch.sie_block->epoch -= *delta;
177 if (vcpu->arch.cputm_enabled) 177 if (vcpu->arch.cputm_enabled)
178 vcpu->arch.cputm_start += *delta; 178 vcpu->arch.cputm_start += *delta;
179 if (vcpu->arch.vsie_block)
180 vcpu->arch.vsie_block->epoch -= *delta;
179 } 181 }
180 } 182 }
181 return NOTIFY_OK; 183 return NOTIFY_OK;
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 90781ba52803..6895e7b3be12 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -843,12 +843,21 @@ static int acquire_gmap_shadow(struct kvm_vcpu *vcpu,
843static void register_shadow_scb(struct kvm_vcpu *vcpu, 843static void register_shadow_scb(struct kvm_vcpu *vcpu,
844 struct vsie_page *vsie_page) 844 struct vsie_page *vsie_page)
845{ 845{
846 struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
847
846 WRITE_ONCE(vcpu->arch.vsie_block, &vsie_page->scb_s); 848 WRITE_ONCE(vcpu->arch.vsie_block, &vsie_page->scb_s);
847 /* 849 /*
848 * External calls have to lead to a kick of the vcpu and 850 * External calls have to lead to a kick of the vcpu and
849 * therefore the vsie -> Simulate Wait state. 851 * therefore the vsie -> Simulate Wait state.
850 */ 852 */
851 atomic_or(CPUSTAT_WAIT, &vcpu->arch.sie_block->cpuflags); 853 atomic_or(CPUSTAT_WAIT, &vcpu->arch.sie_block->cpuflags);
854 /*
855 * We have to adjust the g3 epoch by the g2 epoch. The epoch will
856 * automatically be adjusted on tod clock changes via kvm_sync_clock.
857 */
858 preempt_disable();
859 scb_s->epoch += vcpu->kvm->arch.epoch;
860 preempt_enable();
852} 861}
853 862
854/* 863/*