aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2009-07-20 22:42:48 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:33:16 -0400
commitb927a3cec081a605142f5b7e90b730611bee28b1 (patch)
treeed7609e83e89c0830d568aa8304200cdb0c58736 /arch/x86/kvm/x86.c
parentb792c344dfd57ee2cf737440e4a9b4a5bc39d1db (diff)
KVM: VMX: Introduce KVM_SET_IDENTITY_MAP_ADDR ioctl
Now KVM allow guest to modify guest's physical address of EPT's identity mapping page. (change from v1, discard unnecessary check, change ioctl to accept parameter address rather than value) Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c7ec0c921c01..f4cb1baaa04b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1206,6 +1206,7 @@ int kvm_dev_ioctl_check_extension(long ext)
1206 case KVM_CAP_IOEVENTFD: 1206 case KVM_CAP_IOEVENTFD:
1207 case KVM_CAP_PIT2: 1207 case KVM_CAP_PIT2:
1208 case KVM_CAP_PIT_STATE2: 1208 case KVM_CAP_PIT_STATE2:
1209 case KVM_CAP_SET_IDENTITY_MAP_ADDR:
1209 r = 1; 1210 r = 1;
1210 break; 1211 break;
1211 case KVM_CAP_COALESCED_MMIO: 1212 case KVM_CAP_COALESCED_MMIO:
@@ -1906,6 +1907,13 @@ static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr)
1906 return ret; 1907 return ret;
1907} 1908}
1908 1909
1910static int kvm_vm_ioctl_set_identity_map_addr(struct kvm *kvm,
1911 u64 ident_addr)
1912{
1913 kvm->arch.ept_identity_map_addr = ident_addr;
1914 return 0;
1915}
1916
1909static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm, 1917static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
1910 u32 kvm_nr_mmu_pages) 1918 u32 kvm_nr_mmu_pages)
1911{ 1919{
@@ -2173,6 +2181,17 @@ long kvm_arch_vm_ioctl(struct file *filp,
2173 if (r < 0) 2181 if (r < 0)
2174 goto out; 2182 goto out;
2175 break; 2183 break;
2184 case KVM_SET_IDENTITY_MAP_ADDR: {
2185 u64 ident_addr;
2186
2187 r = -EFAULT;
2188 if (copy_from_user(&ident_addr, argp, sizeof ident_addr))
2189 goto out;
2190 r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
2191 if (r < 0)
2192 goto out;
2193 break;
2194 }
2176 case KVM_SET_MEMORY_REGION: { 2195 case KVM_SET_MEMORY_REGION: {
2177 struct kvm_memory_region kvm_mem; 2196 struct kvm_memory_region kvm_mem;
2178 struct kvm_userspace_memory_region kvm_userspace_mem; 2197 struct kvm_userspace_memory_region kvm_userspace_mem;