linux/arch/s390/kvm
David Hildenbrand 81a158d214 KVM: s390: consider epoch index on TOD clock syncs
commit 1575767ef3 upstream.

For now, we don't take care of over/underflows. Especially underflows
are critical:

Assume the epoch is currently 0 and we get a sync request for delta=1,
meaning the TOD is moved forward by 1 and we have to fix it up by
subtracting 1 from the epoch. Right now, this will leave the epoch
index untouched, resulting in epoch=-1, epoch_idx=0, which is wrong.

We have to take care of over and underflows, also for the VSIE case. So
let's factor out calculation into a separate function.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180207114647.6220-5-david@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Fixes: 8fa1696ea7 ("KVM: s390: Multiple Epoch Facility support")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[use u8 for idx]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2018-03-08 22:41:21 -08:00
..
diag.c First batch of KVM changes for 4.14 2017-09-08 15:18:36 -07:00
gaccess.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gaccess.h s390: rename psw_bits enums 2017-06-12 16:26:02 +02:00
guestdbg.c KVM: s390: guestdbg: fix range check 2017-08-31 13:49:39 +02:00
intercept.c KVM: s390: Support keyless subset guest mode 2017-04-21 11:08:11 +02:00
interrupt.c KVM: s390: take care of clock-comparator sign control 2018-03-08 22:41:21 -08:00
irq.h KVM: s390: irq routing for adapter interrupts. 2014-03-21 13:43:00 +01:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kvm-s390.c KVM: s390: consider epoch index on TOD clock syncs 2018-03-08 22:41:21 -08:00
kvm-s390.h KVM: s390: provide only a single function for setting the tod (fix SCK) 2018-03-08 22:41:21 -08:00
Makefile KVM: s390: vsie: initial support for nested virtualization 2016-06-21 09:43:33 +02:00
priv.c KVM: s390: provide only a single function for setting the tod (fix SCK) 2018-03-08 22:41:21 -08:00
sigp.c KVM: s390: Support Configuration z/Architecture Mode 2017-08-28 16:25:13 +02:00
sthyi.c KVM: s390: sthyi: remove invalid guest write access 2017-08-29 15:15:56 +02:00
trace-s390.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vsie.c First batch of KVM changes for 4.14 2017-09-08 15:18:36 -07:00