s390/kvm: use union tod_clock
Use union tod_clock and get rid of the kvm specific struct kvm_s390_tod_clock_ext which apparently was introduced for the same purpose. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
169ceac429
commit
2cfd7b73f5
1 changed files with 9 additions and 15 deletions
|
@ -165,12 +165,6 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kvm_s390_tod_clock_ext {
|
|
||||||
__u8 epoch_idx;
|
|
||||||
__u64 tod;
|
|
||||||
__u8 reserved[7];
|
|
||||||
} __packed;
|
|
||||||
|
|
||||||
/* allow nested virtualization in KVM (if enabled by user space) */
|
/* allow nested virtualization in KVM (if enabled by user space) */
|
||||||
static int nested;
|
static int nested;
|
||||||
module_param(nested, int, S_IRUGO);
|
module_param(nested, int, S_IRUGO);
|
||||||
|
@ -1166,17 +1160,17 @@ static int kvm_s390_set_tod(struct kvm *kvm, struct kvm_device_attr *attr)
|
||||||
static void kvm_s390_get_tod_clock(struct kvm *kvm,
|
static void kvm_s390_get_tod_clock(struct kvm *kvm,
|
||||||
struct kvm_s390_vm_tod_clock *gtod)
|
struct kvm_s390_vm_tod_clock *gtod)
|
||||||
{
|
{
|
||||||
struct kvm_s390_tod_clock_ext htod;
|
union tod_clock clk;
|
||||||
|
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
|
|
||||||
get_tod_clock_ext((char *)&htod);
|
store_tod_clock_ext(&clk);
|
||||||
|
|
||||||
gtod->tod = htod.tod + kvm->arch.epoch;
|
gtod->tod = clk.tod + kvm->arch.epoch;
|
||||||
gtod->epoch_idx = 0;
|
gtod->epoch_idx = 0;
|
||||||
if (test_kvm_facility(kvm, 139)) {
|
if (test_kvm_facility(kvm, 139)) {
|
||||||
gtod->epoch_idx = htod.epoch_idx + kvm->arch.epdx;
|
gtod->epoch_idx = clk.ei + kvm->arch.epdx;
|
||||||
if (gtod->tod < htod.tod)
|
if (gtod->tod < clk.tod)
|
||||||
gtod->epoch_idx += 1;
|
gtod->epoch_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3867,18 +3861,18 @@ void kvm_s390_set_tod_clock(struct kvm *kvm,
|
||||||
const struct kvm_s390_vm_tod_clock *gtod)
|
const struct kvm_s390_vm_tod_clock *gtod)
|
||||||
{
|
{
|
||||||
struct kvm_vcpu *vcpu;
|
struct kvm_vcpu *vcpu;
|
||||||
struct kvm_s390_tod_clock_ext htod;
|
union tod_clock clk;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&kvm->lock);
|
mutex_lock(&kvm->lock);
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
|
|
||||||
get_tod_clock_ext((char *)&htod);
|
store_tod_clock_ext(&clk);
|
||||||
|
|
||||||
kvm->arch.epoch = gtod->tod - htod.tod;
|
kvm->arch.epoch = gtod->tod - clk.tod;
|
||||||
kvm->arch.epdx = 0;
|
kvm->arch.epdx = 0;
|
||||||
if (test_kvm_facility(kvm, 139)) {
|
if (test_kvm_facility(kvm, 139)) {
|
||||||
kvm->arch.epdx = gtod->epoch_idx - htod.epoch_idx;
|
kvm->arch.epdx = gtod->epoch_idx - clk.ei;
|
||||||
if (kvm->arch.epoch > gtod->tod)
|
if (kvm->arch.epoch > gtod->tod)
|
||||||
kvm->arch.epdx -= 1;
|
kvm->arch.epdx -= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue