@@ -54,6 +54,9 @@ int kvm_irqchip = 1;
int kvm_pit = 1;
int kvm_pit_reinject = 1;
int kvm_nested = 0;
+#ifdef KVM_CAP_PMTMR
+int kvm_pmtmr = 0;
+#endif
KVMState *kvm_state;
@@ -186,7 +189,7 @@ int kvm_init(int smp_cpus)
kvm_context->no_irqchip_creation = 0;
kvm_context->no_pit_creation = 0;
#ifdef KVM_CAP_PMTMR
- kvm_context->no_pmtmr_creation = 0;
+ kvm_context->no_pmtmr_creation = 1;
#endif
#ifdef KVM_CAP_SET_GUEST_DEBUG
@@ -241,6 +244,11 @@ void kvm_disable_pit_creation(kvm_contex
}
#ifdef KVM_CAP_PMTMR
+void kvm_enable_pmtmr_creation(kvm_context_t kvm)
+{
+ kvm->no_pmtmr_creation = 0;
+}
+
void (*kvm_arch_pmtmr_handler)(kvm_context_t kvm);
/*
* This handler is called by
@@ -1654,6 +1662,11 @@ static int kvm_create_context(void)
if (!kvm_pit) {
kvm_disable_pit_creation(kvm_context);
}
+#ifdef KVM_CAP_PMTMR
+ if (kvm_pmtmr) {
+ kvm_enable_pmtmr_creation(kvm_context);
+ }
+#endif
if (kvm_create(kvm_context, 0, NULL) < 0) {
kvm_finalize(kvm_state);
return -1;
@@ -124,6 +124,18 @@ void kvm_disable_irqchip_creation(kvm_co
*/
void kvm_disable_pit_creation(kvm_context_t kvm);
+#ifdef KVM_CAP_PMTMR
+/*!
+ * \brief Enable the in-kernel ACPI PM Timer register creation
+ *
+ * In-kernel ACPI PM Timer register is disabled by default.
+ * If in-kernel is to be used, this should be called prior to kvm_create().
+ *
+ * \param kvm Pointer to the kvm_context
+ */
+void kvm_enable_pmtmr_creation(kvm_context_t kvm);
+#endif
+
/*!
* \brief Create new virtual machine
*
@@ -706,6 +718,9 @@ extern int kvm_irqchip;
extern int kvm_pit;
extern int kvm_pit_reinject;
extern int kvm_nested;
+#ifdef KVM_CAP_PMTMR
+extern int kvm_pmtmr;
+#endif
extern kvm_context_t kvm_context;
struct ioperm_data {
@@ -2330,6 +2330,9 @@ DEF("no-kvm-pit-reinjection", 0, QEMU_OP
QEMU_ARCH_I386)
DEF("enable-nesting", 0, QEMU_OPTION_enable_nesting,
"-enable-nesting enable support for running a VM inside the VM (AMD only)\n", QEMU_ARCH_I386)
+DEF("kvm-pmtmr", 0, QEMU_OPTION_kvm_pmtmr,
+ "-kvm-pmtmr enable KVM kernel mode ACPI PM Timer register emulation\n",
+ QEMU_ARCH_I386)
DEF("nvram", HAS_ARG, QEMU_OPTION_nvram,
"-nvram FILE provide ia64 nvram contents\n", QEMU_ARCH_ALL)
DEF("tdf", 0, QEMU_OPTION_tdf,
@@ -2474,6 +2474,12 @@ int main(int argc, char **argv, char **e
kvm_nested = 1;
break;
}
+#ifdef KVM_CAP_PMTMR
+ case QEMU_OPTION_kvm_pmtmr: {
+ kvm_pmtmr = 1;
+ break;
+ }
+#endif
#endif
case QEMU_OPTION_usb:
usb_enabled = 1;