diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:14:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:14:24 -0500 |
commit | 55065bc52795faae549abfb912aacc622dd63876 (patch) | |
tree | 63683547e41ed459a2a8747eeafb5e969633d54f /Documentation/kvm | |
parent | 008d23e4852d78bb2618f2035f8b2110b6a6b968 (diff) | |
parent | e5c301428294cb8925667c9ee39f817c4ab1c2c9 (diff) |
Merge branch 'kvm-updates/2.6.38' of git://git.kernel.org/pub/scm/virt/kvm/kvm
* 'kvm-updates/2.6.38' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (142 commits)
KVM: Initialize fpu state in preemptible context
KVM: VMX: when entering real mode align segment base to 16 bytes
KVM: MMU: handle 'map_writable' in set_spte() function
KVM: MMU: audit: allow audit more guests at the same time
KVM: Fetch guest cr3 from hardware on demand
KVM: Replace reads of vcpu->arch.cr3 by an accessor
KVM: MMU: only write protect mappings at pagetable level
KVM: VMX: Correct asm constraint in vmcs_load()/vmcs_clear()
KVM: MMU: Initialize base_role for tdp mmus
KVM: VMX: Optimize atomic EFER load
KVM: VMX: Add definitions for more vm entry/exit control bits
KVM: SVM: copy instruction bytes from VMCB
KVM: SVM: implement enhanced INVLPG intercept
KVM: SVM: enhance mov DR intercept handler
KVM: SVM: enhance MOV CR intercept handler
KVM: SVM: add new SVM feature bit names
KVM: cleanup emulate_instruction
KVM: move complete_insn_gp() into x86.c
KVM: x86: fix CR8 handling
KVM guest: Fix kvm clock initialization when it's configured out
...
Diffstat (limited to 'Documentation/kvm')
-rw-r--r-- | Documentation/kvm/api.txt | 178 | ||||
-rw-r--r-- | Documentation/kvm/cpuid.txt | 3 | ||||
-rw-r--r-- | Documentation/kvm/msr.txt | 36 |
3 files changed, 216 insertions, 1 deletions
diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index 50713e37c695..ad85797c1cf0 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt | |||
@@ -1085,6 +1085,184 @@ of 4 instructions that make up a hypercall. | |||
1085 | If any additional field gets added to this structure later on, a bit for that | 1085 | If any additional field gets added to this structure later on, a bit for that |
1086 | additional piece of information will be set in the flags bitmap. | 1086 | additional piece of information will be set in the flags bitmap. |
1087 | 1087 | ||
1088 | 4.47 KVM_ASSIGN_PCI_DEVICE | ||
1089 | |||
1090 | Capability: KVM_CAP_DEVICE_ASSIGNMENT | ||
1091 | Architectures: x86 ia64 | ||
1092 | Type: vm ioctl | ||
1093 | Parameters: struct kvm_assigned_pci_dev (in) | ||
1094 | Returns: 0 on success, -1 on error | ||
1095 | |||
1096 | Assigns a host PCI device to the VM. | ||
1097 | |||
1098 | struct kvm_assigned_pci_dev { | ||
1099 | __u32 assigned_dev_id; | ||
1100 | __u32 busnr; | ||
1101 | __u32 devfn; | ||
1102 | __u32 flags; | ||
1103 | __u32 segnr; | ||
1104 | union { | ||
1105 | __u32 reserved[11]; | ||
1106 | }; | ||
1107 | }; | ||
1108 | |||
1109 | The PCI device is specified by the triple segnr, busnr, and devfn. | ||
1110 | Identification in succeeding service requests is done via assigned_dev_id. The | ||
1111 | following flags are specified: | ||
1112 | |||
1113 | /* Depends on KVM_CAP_IOMMU */ | ||
1114 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | ||
1115 | |||
1116 | 4.48 KVM_DEASSIGN_PCI_DEVICE | ||
1117 | |||
1118 | Capability: KVM_CAP_DEVICE_DEASSIGNMENT | ||
1119 | Architectures: x86 ia64 | ||
1120 | Type: vm ioctl | ||
1121 | Parameters: struct kvm_assigned_pci_dev (in) | ||
1122 | Returns: 0 on success, -1 on error | ||
1123 | |||
1124 | Ends PCI device assignment, releasing all associated resources. | ||
1125 | |||
1126 | See KVM_CAP_DEVICE_ASSIGNMENT for the data structure. Only assigned_dev_id is | ||
1127 | used in kvm_assigned_pci_dev to identify the device. | ||
1128 | |||
1129 | 4.49 KVM_ASSIGN_DEV_IRQ | ||
1130 | |||
1131 | Capability: KVM_CAP_ASSIGN_DEV_IRQ | ||
1132 | Architectures: x86 ia64 | ||
1133 | Type: vm ioctl | ||
1134 | Parameters: struct kvm_assigned_irq (in) | ||
1135 | Returns: 0 on success, -1 on error | ||
1136 | |||
1137 | Assigns an IRQ to a passed-through device. | ||
1138 | |||
1139 | struct kvm_assigned_irq { | ||
1140 | __u32 assigned_dev_id; | ||
1141 | __u32 host_irq; | ||
1142 | __u32 guest_irq; | ||
1143 | __u32 flags; | ||
1144 | union { | ||
1145 | struct { | ||
1146 | __u32 addr_lo; | ||
1147 | __u32 addr_hi; | ||
1148 | __u32 data; | ||
1149 | } guest_msi; | ||
1150 | __u32 reserved[12]; | ||
1151 | }; | ||
1152 | }; | ||
1153 | |||
1154 | The following flags are defined: | ||
1155 | |||
1156 | #define KVM_DEV_IRQ_HOST_INTX (1 << 0) | ||
1157 | #define KVM_DEV_IRQ_HOST_MSI (1 << 1) | ||
1158 | #define KVM_DEV_IRQ_HOST_MSIX (1 << 2) | ||
1159 | |||
1160 | #define KVM_DEV_IRQ_GUEST_INTX (1 << 8) | ||
1161 | #define KVM_DEV_IRQ_GUEST_MSI (1 << 9) | ||
1162 | #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) | ||
1163 | |||
1164 | It is not valid to specify multiple types per host or guest IRQ. However, the | ||
1165 | IRQ type of host and guest can differ or can even be null. | ||
1166 | |||
1167 | 4.50 KVM_DEASSIGN_DEV_IRQ | ||
1168 | |||
1169 | Capability: KVM_CAP_ASSIGN_DEV_IRQ | ||
1170 | Architectures: x86 ia64 | ||
1171 | Type: vm ioctl | ||
1172 | Parameters: struct kvm_assigned_irq (in) | ||
1173 | Returns: 0 on success, -1 on error | ||
1174 | |||
1175 | Ends an IRQ assignment to a passed-through device. | ||
1176 | |||
1177 | See KVM_ASSIGN_DEV_IRQ for the data structure. The target device is specified | ||
1178 | by assigned_dev_id, flags must correspond to the IRQ type specified on | ||
1179 | KVM_ASSIGN_DEV_IRQ. Partial deassignment of host or guest IRQ is allowed. | ||
1180 | |||
1181 | 4.51 KVM_SET_GSI_ROUTING | ||
1182 | |||
1183 | Capability: KVM_CAP_IRQ_ROUTING | ||
1184 | Architectures: x86 ia64 | ||
1185 | Type: vm ioctl | ||
1186 | Parameters: struct kvm_irq_routing (in) | ||
1187 | Returns: 0 on success, -1 on error | ||
1188 | |||
1189 | Sets the GSI routing table entries, overwriting any previously set entries. | ||
1190 | |||
1191 | struct kvm_irq_routing { | ||
1192 | __u32 nr; | ||
1193 | __u32 flags; | ||
1194 | struct kvm_irq_routing_entry entries[0]; | ||
1195 | }; | ||
1196 | |||
1197 | No flags are specified so far, the corresponding field must be set to zero. | ||
1198 | |||
1199 | struct kvm_irq_routing_entry { | ||
1200 | __u32 gsi; | ||
1201 | __u32 type; | ||
1202 | __u32 flags; | ||
1203 | __u32 pad; | ||
1204 | union { | ||
1205 | struct kvm_irq_routing_irqchip irqchip; | ||
1206 | struct kvm_irq_routing_msi msi; | ||
1207 | __u32 pad[8]; | ||
1208 | } u; | ||
1209 | }; | ||
1210 | |||
1211 | /* gsi routing entry types */ | ||
1212 | #define KVM_IRQ_ROUTING_IRQCHIP 1 | ||
1213 | #define KVM_IRQ_ROUTING_MSI 2 | ||
1214 | |||
1215 | No flags are specified so far, the corresponding field must be set to zero. | ||
1216 | |||
1217 | struct kvm_irq_routing_irqchip { | ||
1218 | __u32 irqchip; | ||
1219 | __u32 pin; | ||
1220 | }; | ||
1221 | |||
1222 | struct kvm_irq_routing_msi { | ||
1223 | __u32 address_lo; | ||
1224 | __u32 address_hi; | ||
1225 | __u32 data; | ||
1226 | __u32 pad; | ||
1227 | }; | ||
1228 | |||
1229 | 4.52 KVM_ASSIGN_SET_MSIX_NR | ||
1230 | |||
1231 | Capability: KVM_CAP_DEVICE_MSIX | ||
1232 | Architectures: x86 ia64 | ||
1233 | Type: vm ioctl | ||
1234 | Parameters: struct kvm_assigned_msix_nr (in) | ||
1235 | Returns: 0 on success, -1 on error | ||
1236 | |||
1237 | Set the number of MSI-X interrupts for an assigned device. This service can | ||
1238 | only be called once in the lifetime of an assigned device. | ||
1239 | |||
1240 | struct kvm_assigned_msix_nr { | ||
1241 | __u32 assigned_dev_id; | ||
1242 | __u16 entry_nr; | ||
1243 | __u16 padding; | ||
1244 | }; | ||
1245 | |||
1246 | #define KVM_MAX_MSIX_PER_DEV 256 | ||
1247 | |||
1248 | 4.53 KVM_ASSIGN_SET_MSIX_ENTRY | ||
1249 | |||
1250 | Capability: KVM_CAP_DEVICE_MSIX | ||
1251 | Architectures: x86 ia64 | ||
1252 | Type: vm ioctl | ||
1253 | Parameters: struct kvm_assigned_msix_entry (in) | ||
1254 | Returns: 0 on success, -1 on error | ||
1255 | |||
1256 | Specifies the routing of an MSI-X assigned device interrupt to a GSI. Setting | ||
1257 | the GSI vector to zero means disabling the interrupt. | ||
1258 | |||
1259 | struct kvm_assigned_msix_entry { | ||
1260 | __u32 assigned_dev_id; | ||
1261 | __u32 gsi; | ||
1262 | __u16 entry; /* The index of entry in the MSI-X table */ | ||
1263 | __u16 padding[3]; | ||
1264 | }; | ||
1265 | |||
1088 | 5. The kvm_run structure | 1266 | 5. The kvm_run structure |
1089 | 1267 | ||
1090 | Application code obtains a pointer to the kvm_run structure by | 1268 | Application code obtains a pointer to the kvm_run structure by |
diff --git a/Documentation/kvm/cpuid.txt b/Documentation/kvm/cpuid.txt index 14a12ea92b7f..882068538c9c 100644 --- a/Documentation/kvm/cpuid.txt +++ b/Documentation/kvm/cpuid.txt | |||
@@ -36,6 +36,9 @@ KVM_FEATURE_MMU_OP || 2 || deprecated. | |||
36 | KVM_FEATURE_CLOCKSOURCE2 || 3 || kvmclock available at msrs | 36 | KVM_FEATURE_CLOCKSOURCE2 || 3 || kvmclock available at msrs |
37 | || || 0x4b564d00 and 0x4b564d01 | 37 | || || 0x4b564d00 and 0x4b564d01 |
38 | ------------------------------------------------------------------------------ | 38 | ------------------------------------------------------------------------------ |
39 | KVM_FEATURE_ASYNC_PF || 4 || async pf can be enabled by | ||
40 | || || writing to msr 0x4b564d02 | ||
41 | ------------------------------------------------------------------------------ | ||
39 | KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side | 42 | KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side |
40 | || || per-cpu warps are expected in | 43 | || || per-cpu warps are expected in |
41 | || || kvmclock. | 44 | || || kvmclock. |
diff --git a/Documentation/kvm/msr.txt b/Documentation/kvm/msr.txt index 8ddcfe84c09a..d079aed27e03 100644 --- a/Documentation/kvm/msr.txt +++ b/Documentation/kvm/msr.txt | |||
@@ -3,7 +3,6 @@ Glauber Costa <glommer@redhat.com>, Red Hat Inc, 2010 | |||
3 | ===================================================== | 3 | ===================================================== |
4 | 4 | ||
5 | KVM makes use of some custom MSRs to service some requests. | 5 | KVM makes use of some custom MSRs to service some requests. |
6 | At present, this facility is only used by kvmclock. | ||
7 | 6 | ||
8 | Custom MSRs have a range reserved for them, that goes from | 7 | Custom MSRs have a range reserved for them, that goes from |
9 | 0x4b564d00 to 0x4b564dff. There are MSRs outside this area, | 8 | 0x4b564d00 to 0x4b564dff. There are MSRs outside this area, |
@@ -151,3 +150,38 @@ MSR_KVM_SYSTEM_TIME: 0x12 | |||
151 | return PRESENT; | 150 | return PRESENT; |
152 | } else | 151 | } else |
153 | return NON_PRESENT; | 152 | return NON_PRESENT; |
153 | |||
154 | MSR_KVM_ASYNC_PF_EN: 0x4b564d02 | ||
155 | data: Bits 63-6 hold 64-byte aligned physical address of a | ||
156 | 64 byte memory area which must be in guest RAM and must be | ||
157 | zeroed. Bits 5-2 are reserved and should be zero. Bit 0 is 1 | ||
158 | when asynchronous page faults are enabled on the vcpu 0 when | ||
159 | disabled. Bit 2 is 1 if asynchronous page faults can be injected | ||
160 | when vcpu is in cpl == 0. | ||
161 | |||
162 | First 4 byte of 64 byte memory location will be written to by | ||
163 | the hypervisor at the time of asynchronous page fault (APF) | ||
164 | injection to indicate type of asynchronous page fault. Value | ||
165 | of 1 means that the page referred to by the page fault is not | ||
166 | present. Value 2 means that the page is now available. Disabling | ||
167 | interrupt inhibits APFs. Guest must not enable interrupt | ||
168 | before the reason is read, or it may be overwritten by another | ||
169 | APF. Since APF uses the same exception vector as regular page | ||
170 | fault guest must reset the reason to 0 before it does | ||
171 | something that can generate normal page fault. If during page | ||
172 | fault APF reason is 0 it means that this is regular page | ||
173 | fault. | ||
174 | |||
175 | During delivery of type 1 APF cr2 contains a token that will | ||
176 | be used to notify a guest when missing page becomes | ||
177 | available. When page becomes available type 2 APF is sent with | ||
178 | cr2 set to the token associated with the page. There is special | ||
179 | kind of token 0xffffffff which tells vcpu that it should wake | ||
180 | up all processes waiting for APFs and no individual type 2 APFs | ||
181 | will be sent. | ||
182 | |||
183 | If APF is disabled while there are outstanding APFs, they will | ||
184 | not be delivered. | ||
185 | |||
186 | Currently type 2 APF will be always delivered on the same vcpu as | ||
187 | type 1 was, but guest should not rely on that. | ||