diff options
author | Joao Martins <joao.m.martins@oracle.com> | 2018-07-23 18:20:57 +0300 |
---|---|---|
committer | David Woodhouse <dwmw@amazon.co.uk> | 2021-02-04 17:19:39 +0300 |
commit | f2340cd9e41dc463cb1189274f3db560c1dfa1f4 (patch) | |
tree | 6027d74c22ab8dde30f99ab49411c87eac5db8b9 /arch/x86/kvm/xen.c | |
parent | aa096aa0a05ff7f1e7b8da95fae7aa71668212c7 (diff) | |
download | linux-f2340cd9e41dc463cb1189274f3db560c1dfa1f4.tar.xz |
KVM: x86/xen: register vcpu time info region
Allow the Xen emulated guest the ability to register secondary
vcpu time information. On Xen guests this is used in order to be
mapped to userspace and hence allow vdso gettimeofday to work.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Diffstat (limited to 'arch/x86/kvm/xen.c')
-rw-r--r-- | arch/x86/kvm/xen.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index c307f8b7a8a3..bd343222e740 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -141,6 +141,17 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) } break; + case KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO: + r = kvm_gfn_to_hva_cache_init(vcpu->kvm, + &vcpu->arch.xen.vcpu_time_info_cache, + data->u.gpa, + sizeof(struct pvclock_vcpu_time_info)); + if (!r) { + vcpu->arch.xen.vcpu_time_info_set = true; + kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); + } + break; + default: break; } @@ -164,6 +175,13 @@ int kvm_xen_vcpu_get_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) } break; + case KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO: + if (vcpu->arch.xen.vcpu_time_info_set) { + data->u.gpa = vcpu->arch.xen.vcpu_time_info_cache.gpa; + r = 0; + } + break; + default: break; } |