|
@@ -1040,8 +1040,8 @@ static int kvm_s390_set_tod(struct kvm *kvm, struct kvm_device_attr *attr)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static void kvm_s390_get_tod_clock_ext(struct kvm *kvm,
|
|
|
- struct kvm_s390_vm_tod_clock *gtod)
|
|
|
+static void kvm_s390_get_tod_clock(struct kvm *kvm,
|
|
|
+ struct kvm_s390_vm_tod_clock *gtod)
|
|
|
{
|
|
|
struct kvm_s390_tod_clock_ext htod;
|
|
|
|
|
@@ -1050,10 +1050,12 @@ static void kvm_s390_get_tod_clock_ext(struct kvm *kvm,
|
|
|
get_tod_clock_ext((char *)&htod);
|
|
|
|
|
|
gtod->tod = htod.tod + kvm->arch.epoch;
|
|
|
- gtod->epoch_idx = htod.epoch_idx + kvm->arch.epdx;
|
|
|
-
|
|
|
- if (gtod->tod < htod.tod)
|
|
|
- gtod->epoch_idx += 1;
|
|
|
+ gtod->epoch_idx = 0;
|
|
|
+ if (test_kvm_facility(kvm, 139)) {
|
|
|
+ gtod->epoch_idx = htod.epoch_idx + kvm->arch.epdx;
|
|
|
+ if (gtod->tod < htod.tod)
|
|
|
+ gtod->epoch_idx += 1;
|
|
|
+ }
|
|
|
|
|
|
preempt_enable();
|
|
|
}
|
|
@@ -1063,12 +1065,7 @@ static int kvm_s390_get_tod_ext(struct kvm *kvm, struct kvm_device_attr *attr)
|
|
|
struct kvm_s390_vm_tod_clock gtod;
|
|
|
|
|
|
memset(>od, 0, sizeof(gtod));
|
|
|
-
|
|
|
- if (test_kvm_facility(kvm, 139))
|
|
|
- kvm_s390_get_tod_clock_ext(kvm, >od);
|
|
|
- else
|
|
|
- gtod.tod = kvm_s390_get_tod_clock_fast(kvm);
|
|
|
-
|
|
|
+ kvm_s390_get_tod_clock(kvm, >od);
|
|
|
if (copy_to_user((void __user *)attr->addr, >od, sizeof(gtod)))
|
|
|
return -EFAULT;
|
|
|
|