summaryrefslogtreecommitdiff
path: root/kvm_para.h
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2012-08-24 20:23:44 +0000
committerRobert Mustacchi <rm@joyent.com>2012-09-24 20:55:46 +0000
commitbb04ae8a50029589b0b2df66bcb1136c1624d72a (patch)
treec443f83553535dbc95a8346a3ca96e1896c6a445 /kvm_para.h
parent5e3b9e3a835ea9100d3abff5a09fb8d1f7600dfb (diff)
downloadillumos-kvm-bb04ae8a50029589b0b2df66bcb1136c1624d72a.tar.gz
HVM-745 Reintroduce kvm_para.h20121004
Diffstat (limited to 'kvm_para.h')
-rw-r--r--kvm_para.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/kvm_para.h b/kvm_para.h
new file mode 100644
index 0000000..db414b1
--- /dev/null
+++ b/kvm_para.h
@@ -0,0 +1,115 @@
+/*
+ * GPL HEADER START
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * GPL HEADER END
+ *
+ * Copyright (c) 2011 various Linux Kernel contributors.
+ * Copyright (c) 2012 Joyent, Inc. All Rights Reserved.
+ */
+
+#ifndef _KVM_PARA_H
+#define _KVM_PARA_H
+
+#include <sys/types.h>
+#include "hyperv.h"
+
+/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
+ * should be used to determine that a VM is running under KVM.
+ */
+#define KVM_CPUID_SIGNATURE 0x40000000
+
+/* This CPUID returns a feature bitmap in eax. Before enabling a particular
+ * paravirtualization, the appropriate feature bit should be checked.
+ */
+#define KVM_CPUID_FEATURES 0x40000001
+#define KVM_FEATURE_CLOCKSOURCE 0
+#define KVM_FEATURE_NOP_IO_DELAY 1
+#define KVM_FEATURE_MMU_OP 2
+/* This indicates that the new set of kvmclock msrs
+ * are available. The use of 0x11 and 0x12 is deprecated
+ */
+#define KVM_FEATURE_CLOCKSOURCE2 3
+#define KVM_FEATURE_ASYNC_PF 4
+#define KVM_FEATURE_STEAL_TIME 5
+
+/* The last 8 bits are used to indicate how to interpret the flags field
+ * in pvclock structure. If no bits are set, all flags are ignored.
+ */
+#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24
+
+#define MSR_KVM_WALL_CLOCK 0x11
+#define MSR_KVM_SYSTEM_TIME 0x12
+
+#define KVM_MSR_ENABLED 1
+/* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
+#define MSR_KVM_WALL_CLOCK_NEW 0x4b564d00
+#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
+#define MSR_KVM_ASYNC_PF_EN 0x4b564d02
+#define MSR_KVM_STEAL_TIME 0x4b564d03
+
+struct kvm_steal_time {
+ uint64_t steal;
+ uint32_t version;
+ uint32_t flags;
+ uint32_t pad[12];
+};
+
+#define KVM_STEAL_ALIGNMENT_BITS 5
+#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
+#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
+
+#define KVM_MAX_MMU_OP_BATCH 32
+
+#define KVM_ASYNC_PF_ENABLED (1 << 0)
+#define KVM_ASYNC_PF_SEND_ALWAYS (1 << 1)
+
+/* Operations for KVM_HC_MMU_OP */
+#define KVM_MMU_OP_WRITE_PTE 1
+#define KVM_MMU_OP_FLUSH_TLB 2
+#define KVM_MMU_OP_RELEASE_PT 3
+
+/* Payload for KVM_HC_MMU_OP */
+struct kvm_mmu_op_header {
+ uint32_t op;
+ uint32_t pad;
+};
+
+struct kvm_mmu_op_write_pte {
+ struct kvm_mmu_op_header header;
+ uint64_t pte_phys;
+ uint64_t pte_val;
+};
+
+struct kvm_mmu_op_flush_tlb {
+ struct kvm_mmu_op_header header;
+};
+
+struct kvm_mmu_op_release_pt {
+ struct kvm_mmu_op_header header;
+ uint64_t pt_phys;
+};
+
+#define KVM_PV_REASON_PAGE_NOT_PRESENT 1
+#define KVM_PV_REASON_PAGE_READY 2
+
+struct kvm_vcpu_pv_apf_data {
+ uint32_t reason;
+ uint8_t pad[60];
+ uint32_t enabled;
+};
+
+
+#endif /* _KVM_PARA_H */