From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [patch 2/4] libkvm: KVM_GET_PMTIMER ioctl support Date: Sat, 24 May 2008 20:43:44 -0300 Message-ID: <20080525000036.580903867@localhost.localdomain> References: <20080524234342.983197667@localhost.localdomain> Cc: kvm-devel To: Avi Kivity , Chris Wright Return-path: Received: from mx1.redhat.com ([66.187.233.31]:56104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752933AbYEYACs (ORCPT ); Sat, 24 May 2008 20:02:48 -0400 Content-Disposition: inline; filename=kvm_pmtimer Sender: kvm-owner@vger.kernel.org List-ID: Unfortunately there seems to be no standard interface to read the pmtimer... Index: kvm-userspace.tip/libkvm/libkvm.c =================================================================== --- kvm-userspace.tip.orig/libkvm/libkvm.c +++ kvm-userspace.tip/libkvm/libkvm.c @@ -794,6 +794,17 @@ int kvm_set_mpstate(kvm_context_t kvm, i return -ENOSYS; } #endif +#ifdef KVM_CAP_GET_PMTIMER +int kvm_get_pmtimer(kvm_context_t kvm, struct kvm_pmtimer *pmtmr) +{ + int r; + + r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_GET_PMTIMER); + if (r > 0) + return ioctl(kvm->vm_fd, KVM_GET_PMTIMER, pmtmr); + return -ENOSYS; +} +#endif static int handle_mmio(kvm_context_t kvm, struct kvm_run *kvm_run) { Index: kvm-userspace.tip/libkvm/libkvm.h =================================================================== --- kvm-userspace.tip.orig/libkvm/libkvm.h +++ kvm-userspace.tip/libkvm/libkvm.h @@ -325,6 +325,13 @@ static inline int kvm_reset_mpstate(kvm_ } #endif +#ifdef KVM_CAP_GET_PMTIMER +/*! + * \brief Read host pmtimer value + */ +int kvm_get_pmtimer(kvm_context_t kvm, struct kvm_pmtimer *pmtmr); +#endif + /*! * \brief Simulate an external vectored interrupt * --