diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-17 13:33:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-17 13:33:30 -0400 |
commit | 0ef0fd351550130129bbdb77362488befd7b69d2 (patch) | |
tree | 23186172f5f85c06e18e3ee1a9619879df03c5df /virt | |
parent | 4489da7183099f569a7d3dd819c975073c04bc72 (diff) | |
parent | c011d23ba046826ccf8c4a4a6c1d01c9ccaa1403 (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM updates from Paolo Bonzini:
"ARM:
- support for SVE and Pointer Authentication in guests
- PMU improvements
POWER:
- support for direct access to the POWER9 XIVE interrupt controller
- memory and performance optimizations
x86:
- support for accessing memory not backed by struct page
- fixes and refactoring
Generic:
- dirty page tracking improvements"
* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (155 commits)
kvm: fix compilation on aarch64
Revert "KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU"
kvm: x86: Fix L1TF mitigation for shadow MMU
KVM: nVMX: Disable intercept for FS/GS base MSRs in vmcs02 when possible
KVM: PPC: Book3S: Remove useless checks in 'release' method of KVM device
KVM: PPC: Book3S HV: XIVE: Fix spelling mistake "acessing" -> "accessing"
KVM: PPC: Book3S HV: Make sure to load LPID for radix VCPUs
kvm: nVMX: Set nested_run_pending in vmx_set_nested_state after checks complete
tests: kvm: Add tests for KVM_SET_NESTED_STATE
KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state
tests: kvm: Add tests for KVM_CAP_MAX_VCPUS and KVM_CAP_MAX_CPU_ID
tests: kvm: Add tests to .gitignore
KVM: Introduce KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
KVM: Fix kvm_clear_dirty_log_protect off-by-(minus-)one
KVM: Fix the bitmap range to copy during clear dirty
KVM: arm64: Fix ptrauth ID register masking logic
KVM: x86: use direct accessors for RIP and RSP
KVM: VMX: Use accessors for GPRs outside of dedicated caching logic
KVM: x86: Omit caching logic for always-available GPRs
kvm, x86: Properly check whether a pfn is an MMIO or not
...
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/Kconfig | 3 | ||||
-rw-r--r-- | virt/kvm/arm/arm.c | 43 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 103 |
3 files changed, 131 insertions, 18 deletions
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index ea434ddc8499..aad9284c043a 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig | |||
@@ -57,3 +57,6 @@ config HAVE_KVM_VCPU_ASYNC_IOCTL | |||
57 | 57 | ||
58 | config HAVE_KVM_VCPU_RUN_PID_CHANGE | 58 | config HAVE_KVM_VCPU_RUN_PID_CHANGE |
59 | bool | 59 | bool |
60 | |||
61 | config HAVE_KVM_NO_POLL | ||
62 | bool | ||
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index f412ebc90610..90cedebaeb94 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c | |||
@@ -56,7 +56,7 @@ | |||
56 | __asm__(".arch_extension virt"); | 56 | __asm__(".arch_extension virt"); |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | DEFINE_PER_CPU(kvm_cpu_context_t, kvm_host_cpu_state); | 59 | DEFINE_PER_CPU(kvm_host_data_t, kvm_host_data); |
60 | static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page); | 60 | static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page); |
61 | 61 | ||
62 | /* Per-CPU variable containing the currently running vcpu. */ | 62 | /* Per-CPU variable containing the currently running vcpu. */ |
@@ -224,9 +224,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) | |||
224 | case KVM_CAP_MAX_VCPUS: | 224 | case KVM_CAP_MAX_VCPUS: |
225 | r = KVM_MAX_VCPUS; | 225 | r = KVM_MAX_VCPUS; |
226 | break; | 226 | break; |
227 | case KVM_CAP_NR_MEMSLOTS: | ||
228 | r = KVM_USER_MEM_SLOTS; | ||
229 | break; | ||
230 | case KVM_CAP_MSI_DEVID: | 227 | case KVM_CAP_MSI_DEVID: |
231 | if (!kvm) | 228 | if (!kvm) |
232 | r = -EINVAL; | 229 | r = -EINVAL; |
@@ -360,8 +357,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
360 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 357 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
361 | { | 358 | { |
362 | int *last_ran; | 359 | int *last_ran; |
360 | kvm_host_data_t *cpu_data; | ||
363 | 361 | ||
364 | last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran); | 362 | last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran); |
363 | cpu_data = this_cpu_ptr(&kvm_host_data); | ||
365 | 364 | ||
366 | /* | 365 | /* |
367 | * We might get preempted before the vCPU actually runs, but | 366 | * We might get preempted before the vCPU actually runs, but |
@@ -373,18 +372,21 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
373 | } | 372 | } |
374 | 373 | ||
375 | vcpu->cpu = cpu; | 374 | vcpu->cpu = cpu; |
376 | vcpu->arch.host_cpu_context = this_cpu_ptr(&kvm_host_cpu_state); | 375 | vcpu->arch.host_cpu_context = &cpu_data->host_ctxt; |
377 | 376 | ||
378 | kvm_arm_set_running_vcpu(vcpu); | 377 | kvm_arm_set_running_vcpu(vcpu); |
379 | kvm_vgic_load(vcpu); | 378 | kvm_vgic_load(vcpu); |
380 | kvm_timer_vcpu_load(vcpu); | 379 | kvm_timer_vcpu_load(vcpu); |
381 | kvm_vcpu_load_sysregs(vcpu); | 380 | kvm_vcpu_load_sysregs(vcpu); |
382 | kvm_arch_vcpu_load_fp(vcpu); | 381 | kvm_arch_vcpu_load_fp(vcpu); |
382 | kvm_vcpu_pmu_restore_guest(vcpu); | ||
383 | 383 | ||
384 | if (single_task_running()) | 384 | if (single_task_running()) |
385 | vcpu_clear_wfe_traps(vcpu); | 385 | vcpu_clear_wfe_traps(vcpu); |
386 | else | 386 | else |
387 | vcpu_set_wfe_traps(vcpu); | 387 | vcpu_set_wfe_traps(vcpu); |
388 | |||
389 | vcpu_ptrauth_setup_lazy(vcpu); | ||
388 | } | 390 | } |
389 | 391 | ||
390 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | 392 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) |
@@ -393,6 +395,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | |||
393 | kvm_vcpu_put_sysregs(vcpu); | 395 | kvm_vcpu_put_sysregs(vcpu); |
394 | kvm_timer_vcpu_put(vcpu); | 396 | kvm_timer_vcpu_put(vcpu); |
395 | kvm_vgic_put(vcpu); | 397 | kvm_vgic_put(vcpu); |
398 | kvm_vcpu_pmu_restore_host(vcpu); | ||
396 | 399 | ||
397 | vcpu->cpu = -1; | 400 | vcpu->cpu = -1; |
398 | 401 | ||
@@ -545,6 +548,9 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) | |||
545 | if (likely(vcpu->arch.has_run_once)) | 548 | if (likely(vcpu->arch.has_run_once)) |
546 | return 0; | 549 | return 0; |
547 | 550 | ||
551 | if (!kvm_arm_vcpu_is_finalized(vcpu)) | ||
552 | return -EPERM; | ||
553 | |||
548 | vcpu->arch.has_run_once = true; | 554 | vcpu->arch.has_run_once = true; |
549 | 555 | ||
550 | if (likely(irqchip_in_kernel(kvm))) { | 556 | if (likely(irqchip_in_kernel(kvm))) { |
@@ -1121,6 +1127,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
1121 | if (unlikely(!kvm_vcpu_initialized(vcpu))) | 1127 | if (unlikely(!kvm_vcpu_initialized(vcpu))) |
1122 | break; | 1128 | break; |
1123 | 1129 | ||
1130 | r = -EPERM; | ||
1131 | if (!kvm_arm_vcpu_is_finalized(vcpu)) | ||
1132 | break; | ||
1133 | |||
1124 | r = -EFAULT; | 1134 | r = -EFAULT; |
1125 | if (copy_from_user(®_list, user_list, sizeof(reg_list))) | 1135 | if (copy_from_user(®_list, user_list, sizeof(reg_list))) |
1126 | break; | 1136 | break; |
@@ -1174,6 +1184,17 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
1174 | 1184 | ||
1175 | return kvm_arm_vcpu_set_events(vcpu, &events); | 1185 | return kvm_arm_vcpu_set_events(vcpu, &events); |
1176 | } | 1186 | } |
1187 | case KVM_ARM_VCPU_FINALIZE: { | ||
1188 | int what; | ||
1189 | |||
1190 | if (!kvm_vcpu_initialized(vcpu)) | ||
1191 | return -ENOEXEC; | ||
1192 | |||
1193 | if (get_user(what, (const int __user *)argp)) | ||
1194 | return -EFAULT; | ||
1195 | |||
1196 | return kvm_arm_vcpu_finalize(vcpu, what); | ||
1197 | } | ||
1177 | default: | 1198 | default: |
1178 | r = -EINVAL; | 1199 | r = -EINVAL; |
1179 | } | 1200 | } |
@@ -1554,11 +1575,11 @@ static int init_hyp_mode(void) | |||
1554 | } | 1575 | } |
1555 | 1576 | ||
1556 | for_each_possible_cpu(cpu) { | 1577 | for_each_possible_cpu(cpu) { |
1557 | kvm_cpu_context_t *cpu_ctxt; | 1578 | kvm_host_data_t *cpu_data; |
1558 | 1579 | ||
1559 | cpu_ctxt = per_cpu_ptr(&kvm_host_cpu_state, cpu); | 1580 | cpu_data = per_cpu_ptr(&kvm_host_data, cpu); |
1560 | kvm_init_host_cpu_context(cpu_ctxt, cpu); | 1581 | kvm_init_host_cpu_context(&cpu_data->host_ctxt, cpu); |
1561 | err = create_hyp_mappings(cpu_ctxt, cpu_ctxt + 1, PAGE_HYP); | 1582 | err = create_hyp_mappings(cpu_data, cpu_data + 1, PAGE_HYP); |
1562 | 1583 | ||
1563 | if (err) { | 1584 | if (err) { |
1564 | kvm_err("Cannot map host CPU state: %d\n", err); | 1585 | kvm_err("Cannot map host CPU state: %d\n", err); |
@@ -1669,6 +1690,10 @@ int kvm_arch_init(void *opaque) | |||
1669 | if (err) | 1690 | if (err) |
1670 | return err; | 1691 | return err; |
1671 | 1692 | ||
1693 | err = kvm_arm_init_sve(); | ||
1694 | if (err) | ||
1695 | return err; | ||
1696 | |||
1672 | if (!in_hyp_mode) { | 1697 | if (!in_hyp_mode) { |
1673 | err = init_hyp_mode(); | 1698 | err = init_hyp_mode(); |
1674 | if (err) | 1699 | if (err) |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 5fb0f1656a96..f0d13d9d125d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -51,9 +51,9 @@ | |||
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/sort.h> | 52 | #include <linux/sort.h> |
53 | #include <linux/bsearch.h> | 53 | #include <linux/bsearch.h> |
54 | #include <linux/io.h> | ||
54 | 55 | ||
55 | #include <asm/processor.h> | 56 | #include <asm/processor.h> |
56 | #include <asm/io.h> | ||
57 | #include <asm/ioctl.h> | 57 | #include <asm/ioctl.h> |
58 | #include <linux/uaccess.h> | 58 | #include <linux/uaccess.h> |
59 | #include <asm/pgtable.h> | 59 | #include <asm/pgtable.h> |
@@ -1135,11 +1135,11 @@ EXPORT_SYMBOL_GPL(kvm_get_dirty_log); | |||
1135 | 1135 | ||
1136 | #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT | 1136 | #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT |
1137 | /** | 1137 | /** |
1138 | * kvm_get_dirty_log_protect - get a snapshot of dirty pages, and if any pages | 1138 | * kvm_get_dirty_log_protect - get a snapshot of dirty pages |
1139 | * and reenable dirty page tracking for the corresponding pages. | 1139 | * and reenable dirty page tracking for the corresponding pages. |
1140 | * @kvm: pointer to kvm instance | 1140 | * @kvm: pointer to kvm instance |
1141 | * @log: slot id and address to which we copy the log | 1141 | * @log: slot id and address to which we copy the log |
1142 | * @is_dirty: flag set if any page is dirty | 1142 | * @flush: true if TLB flush is needed by caller |
1143 | * | 1143 | * |
1144 | * We need to keep it in mind that VCPU threads can write to the bitmap | 1144 | * We need to keep it in mind that VCPU threads can write to the bitmap |
1145 | * concurrently. So, to avoid losing track of dirty pages we keep the | 1145 | * concurrently. So, to avoid losing track of dirty pages we keep the |
@@ -1224,6 +1224,7 @@ EXPORT_SYMBOL_GPL(kvm_get_dirty_log_protect); | |||
1224 | * and reenable dirty page tracking for the corresponding pages. | 1224 | * and reenable dirty page tracking for the corresponding pages. |
1225 | * @kvm: pointer to kvm instance | 1225 | * @kvm: pointer to kvm instance |
1226 | * @log: slot id and address from which to fetch the bitmap of dirty pages | 1226 | * @log: slot id and address from which to fetch the bitmap of dirty pages |
1227 | * @flush: true if TLB flush is needed by caller | ||
1227 | */ | 1228 | */ |
1228 | int kvm_clear_dirty_log_protect(struct kvm *kvm, | 1229 | int kvm_clear_dirty_log_protect(struct kvm *kvm, |
1229 | struct kvm_clear_dirty_log *log, bool *flush) | 1230 | struct kvm_clear_dirty_log *log, bool *flush) |
@@ -1251,7 +1252,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm, | |||
1251 | if (!dirty_bitmap) | 1252 | if (!dirty_bitmap) |
1252 | return -ENOENT; | 1253 | return -ENOENT; |
1253 | 1254 | ||
1254 | n = kvm_dirty_bitmap_bytes(memslot); | 1255 | n = ALIGN(log->num_pages, BITS_PER_LONG) / 8; |
1255 | 1256 | ||
1256 | if (log->first_page > memslot->npages || | 1257 | if (log->first_page > memslot->npages || |
1257 | log->num_pages > memslot->npages - log->first_page || | 1258 | log->num_pages > memslot->npages - log->first_page || |
@@ -1264,8 +1265,8 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm, | |||
1264 | return -EFAULT; | 1265 | return -EFAULT; |
1265 | 1266 | ||
1266 | spin_lock(&kvm->mmu_lock); | 1267 | spin_lock(&kvm->mmu_lock); |
1267 | for (offset = log->first_page, | 1268 | for (offset = log->first_page, i = offset / BITS_PER_LONG, |
1268 | i = offset / BITS_PER_LONG, n = log->num_pages / BITS_PER_LONG; n--; | 1269 | n = DIV_ROUND_UP(log->num_pages, BITS_PER_LONG); n--; |
1269 | i++, offset += BITS_PER_LONG) { | 1270 | i++, offset += BITS_PER_LONG) { |
1270 | unsigned long mask = *dirty_bitmap_buffer++; | 1271 | unsigned long mask = *dirty_bitmap_buffer++; |
1271 | atomic_long_t *p = (atomic_long_t *) &dirty_bitmap[i]; | 1272 | atomic_long_t *p = (atomic_long_t *) &dirty_bitmap[i]; |
@@ -1742,6 +1743,70 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) | |||
1742 | } | 1743 | } |
1743 | EXPORT_SYMBOL_GPL(gfn_to_page); | 1744 | EXPORT_SYMBOL_GPL(gfn_to_page); |
1744 | 1745 | ||
1746 | static int __kvm_map_gfn(struct kvm_memory_slot *slot, gfn_t gfn, | ||
1747 | struct kvm_host_map *map) | ||
1748 | { | ||
1749 | kvm_pfn_t pfn; | ||
1750 | void *hva = NULL; | ||
1751 | struct page *page = KVM_UNMAPPED_PAGE; | ||
1752 | |||
1753 | if (!map) | ||
1754 | return -EINVAL; | ||
1755 | |||
1756 | pfn = gfn_to_pfn_memslot(slot, gfn); | ||
1757 | if (is_error_noslot_pfn(pfn)) | ||
1758 | return -EINVAL; | ||
1759 | |||
1760 | if (pfn_valid(pfn)) { | ||
1761 | page = pfn_to_page(pfn); | ||
1762 | hva = kmap(page); | ||
1763 | } else { | ||
1764 | hva = memremap(pfn_to_hpa(pfn), PAGE_SIZE, MEMREMAP_WB); | ||
1765 | } | ||
1766 | |||
1767 | if (!hva) | ||
1768 | return -EFAULT; | ||
1769 | |||
1770 | map->page = page; | ||
1771 | map->hva = hva; | ||
1772 | map->pfn = pfn; | ||
1773 | map->gfn = gfn; | ||
1774 | |||
1775 | return 0; | ||
1776 | } | ||
1777 | |||
1778 | int kvm_vcpu_map(struct kvm_vcpu *vcpu, gfn_t gfn, struct kvm_host_map *map) | ||
1779 | { | ||
1780 | return __kvm_map_gfn(kvm_vcpu_gfn_to_memslot(vcpu, gfn), gfn, map); | ||
1781 | } | ||
1782 | EXPORT_SYMBOL_GPL(kvm_vcpu_map); | ||
1783 | |||
1784 | void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, | ||
1785 | bool dirty) | ||
1786 | { | ||
1787 | if (!map) | ||
1788 | return; | ||
1789 | |||
1790 | if (!map->hva) | ||
1791 | return; | ||
1792 | |||
1793 | if (map->page) | ||
1794 | kunmap(map->page); | ||
1795 | else | ||
1796 | memunmap(map->hva); | ||
1797 | |||
1798 | if (dirty) { | ||
1799 | kvm_vcpu_mark_page_dirty(vcpu, map->gfn); | ||
1800 | kvm_release_pfn_dirty(map->pfn); | ||
1801 | } else { | ||
1802 | kvm_release_pfn_clean(map->pfn); | ||
1803 | } | ||
1804 | |||
1805 | map->hva = NULL; | ||
1806 | map->page = NULL; | ||
1807 | } | ||
1808 | EXPORT_SYMBOL_GPL(kvm_vcpu_unmap); | ||
1809 | |||
1745 | struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn) | 1810 | struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn) |
1746 | { | 1811 | { |
1747 | kvm_pfn_t pfn; | 1812 | kvm_pfn_t pfn; |
@@ -2255,7 +2320,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) | |||
2255 | u64 block_ns; | 2320 | u64 block_ns; |
2256 | 2321 | ||
2257 | start = cur = ktime_get(); | 2322 | start = cur = ktime_get(); |
2258 | if (vcpu->halt_poll_ns) { | 2323 | if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) { |
2259 | ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); | 2324 | ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); |
2260 | 2325 | ||
2261 | ++vcpu->stat.halt_attempted_poll; | 2326 | ++vcpu->stat.halt_attempted_poll; |
@@ -2886,6 +2951,16 @@ out: | |||
2886 | } | 2951 | } |
2887 | #endif | 2952 | #endif |
2888 | 2953 | ||
2954 | static int kvm_device_mmap(struct file *filp, struct vm_area_struct *vma) | ||
2955 | { | ||
2956 | struct kvm_device *dev = filp->private_data; | ||
2957 | |||
2958 | if (dev->ops->mmap) | ||
2959 | return dev->ops->mmap(dev, vma); | ||
2960 | |||
2961 | return -ENODEV; | ||
2962 | } | ||
2963 | |||
2889 | static int kvm_device_ioctl_attr(struct kvm_device *dev, | 2964 | static int kvm_device_ioctl_attr(struct kvm_device *dev, |
2890 | int (*accessor)(struct kvm_device *dev, | 2965 | int (*accessor)(struct kvm_device *dev, |
2891 | struct kvm_device_attr *attr), | 2966 | struct kvm_device_attr *attr), |
@@ -2930,6 +3005,13 @@ static int kvm_device_release(struct inode *inode, struct file *filp) | |||
2930 | struct kvm_device *dev = filp->private_data; | 3005 | struct kvm_device *dev = filp->private_data; |
2931 | struct kvm *kvm = dev->kvm; | 3006 | struct kvm *kvm = dev->kvm; |
2932 | 3007 | ||
3008 | if (dev->ops->release) { | ||
3009 | mutex_lock(&kvm->lock); | ||
3010 | list_del(&dev->vm_node); | ||
3011 | dev->ops->release(dev); | ||
3012 | mutex_unlock(&kvm->lock); | ||
3013 | } | ||
3014 | |||
2933 | kvm_put_kvm(kvm); | 3015 | kvm_put_kvm(kvm); |
2934 | return 0; | 3016 | return 0; |
2935 | } | 3017 | } |
@@ -2938,6 +3020,7 @@ static const struct file_operations kvm_device_fops = { | |||
2938 | .unlocked_ioctl = kvm_device_ioctl, | 3020 | .unlocked_ioctl = kvm_device_ioctl, |
2939 | .release = kvm_device_release, | 3021 | .release = kvm_device_release, |
2940 | KVM_COMPAT(kvm_device_ioctl), | 3022 | KVM_COMPAT(kvm_device_ioctl), |
3023 | .mmap = kvm_device_mmap, | ||
2941 | }; | 3024 | }; |
2942 | 3025 | ||
2943 | struct kvm_device *kvm_device_from_filp(struct file *filp) | 3026 | struct kvm_device *kvm_device_from_filp(struct file *filp) |
@@ -3046,7 +3129,7 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) | |||
3046 | case KVM_CAP_CHECK_EXTENSION_VM: | 3129 | case KVM_CAP_CHECK_EXTENSION_VM: |
3047 | case KVM_CAP_ENABLE_CAP_VM: | 3130 | case KVM_CAP_ENABLE_CAP_VM: |
3048 | #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT | 3131 | #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT |
3049 | case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT: | 3132 | case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2: |
3050 | #endif | 3133 | #endif |
3051 | return 1; | 3134 | return 1; |
3052 | #ifdef CONFIG_KVM_MMIO | 3135 | #ifdef CONFIG_KVM_MMIO |
@@ -3065,6 +3148,8 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) | |||
3065 | #endif | 3148 | #endif |
3066 | case KVM_CAP_MAX_VCPU_ID: | 3149 | case KVM_CAP_MAX_VCPU_ID: |
3067 | return KVM_MAX_VCPU_ID; | 3150 | return KVM_MAX_VCPU_ID; |
3151 | case KVM_CAP_NR_MEMSLOTS: | ||
3152 | return KVM_USER_MEM_SLOTS; | ||
3068 | default: | 3153 | default: |
3069 | break; | 3154 | break; |
3070 | } | 3155 | } |
@@ -3082,7 +3167,7 @@ static int kvm_vm_ioctl_enable_cap_generic(struct kvm *kvm, | |||
3082 | { | 3167 | { |
3083 | switch (cap->cap) { | 3168 | switch (cap->cap) { |
3084 | #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT | 3169 | #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT |
3085 | case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT: | 3170 | case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2: |
3086 | if (cap->flags || (cap->args[0] & ~1)) | 3171 | if (cap->flags || (cap->args[0] & ~1)) |
3087 | return -EINVAL; | 3172 | return -EINVAL; |
3088 | kvm->manual_dirty_log_protect = cap->args[0]; | 3173 | kvm->manual_dirty_log_protect = cap->args[0]; |