History

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini: "RISC-V: - Fix compilation without RISCV_ISA_ZICBOM - Fix kvm_riscv_vcpu_timer_pending() for Sstc ARM: - Fix a bug preventing restoring an ITS containing mappings for very large and very sparse device topology - Work around a relocation handling error when compiling the nVHE object with profile optimisation - Fix for stage-2 invalidation holding the VM MMU lock for too long by limiting the walk to the largest block mapping size - Enable stack protection and branch profiling for VHE - Two selftest fixes x86: - add compat implementation for KVM_X86_SET_MSR_FILTER ioctl selftests: - synchronize includes between include/uapi and tools/include/uapi" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: tools: include: sync include/api/linux/kvm.h KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter() kvm: Add support for arch compat vm ioctls RISC-V: KVM: Fix kvm_riscv_vcpu_timer_pending() for Sstc RISC-V: Fix compilation without RISCV_ISA_ZICBOM KVM: arm64: vgic: Fix exit condition in scan_its_table() KVM: arm64: nvhe: Fix build with profile optimization KVM: selftests: Fix number of pages for memory slot in memslot_modification_stress_test KVM: arm64: selftests: Fix multiple versions of GIC creation KVM: arm64: Enable stack protection and branch profiling for VHE KVM: arm64: Limit stage2_apply_range() batch size to largest block KVM: arm64: Work out supported block level at compile time

Linus Torvalds committed 4 years ago

Commit 05b4ebd2 parents ca4582c 9aec60618 files · +180 −99Browse files

Unified · Split

18 files
  1. arch/arm64/include/asm/kvm_pgtable.h +13 −5
  2. arch/arm64/include/asm/stage2_pgtable.h +0 −20
  3. arch/arm64/kvm/hyp/Makefile +1 −4
  4. arch/arm64/kvm/hyp/nvhe/Makefile +7 −0
  5. arch/arm64/kvm/mmu.c +8 −1
  6. arch/arm64/kvm/vgic/vgic-its.c +4 −1
  7. arch/riscv/include/asm/cacheflush.h +0 −8
  8. arch/riscv/include/asm/kvm_vcpu_timer.h +1 −0
  9. arch/riscv/kvm/vcpu.c +3 −0
  10. arch/riscv/kvm/vcpu_timer.c +15 −2
  11. arch/riscv/mm/cacheflush.c +38 −0
  12. arch/riscv/mm/dma-noncoherent.c +0 −41
  13. arch/x86/kvm/x86.c +73 −14
  14. include/linux/kvm_host.h +2 −0
  15. tools/include/uapi/linux/kvm.h +1 −0
  16. tools/testing/selftests/kvm/aarch64/vgic_init.c +2 −2
  17. tools/testing/selftests/kvm/memslot_modification_stress_test.c +1 −1
  18. virt/kvm/kvm_main.c +11 −0
arch/arm64/include/asm/kvm_pgtable.h+13−5
@@ -13,6 +13,18 @@ · 12 unmodified lines
1313
1414 #define KVM_PGTABLE_MAX_LEVELS 4U
1515
16+/*
17+ * The largest supported block sizes for KVM (no 52-bit PA support):
18+ * - 4K (level 1): 1GB
19+ * - 16K (level 2): 32MB
20+ * - 64K (level 2): 512MB
21+ */
22+#ifdef CONFIG_ARM64_4K_PAGES
23+#define KVM_PGTABLE_MIN_BLOCK_LEVEL 1U
24+#else
25+#define KVM_PGTABLE_MIN_BLOCK_LEVEL 2U
26+#endif
27+
1628 static inline u64 kvm_get_parange(u64 mmfr0)
1729 {
1830 u64 parange = cpuid_feature_extract_unsigned_field(mmfr0,
@@ -58,11 +70,7 @@ static inline u64 kvm_granule_size(u32 level) · 39 unmodified lines
5870
5971 static inline bool kvm_level_supports_block_mapping(u32 level)
6072 {
61− /*
62− * Reject invalid block mappings and don't bother with 4TB mappings for
63− * 52-bit PAs.
64− */
65− return !(level == 0 || (PAGE_SIZE != SZ_4K && level == 1));
73+ return level >= KVM_PGTABLE_MIN_BLOCK_LEVEL;
6674 }
6775
6876 /**
arch/arm64/include/asm/stage2_pgtable.h+0−20
@@ -10,13 +10,6 @@ · 9 unmodified lines
1010
1111 #include <linux/pgtable.h>
1212
13−/*
14− * PGDIR_SHIFT determines the size a top-level page table entry can map
15− * and depends on the number of levels in the page table. Compute the
16− * PGDIR_SHIFT for a given number of levels.
17− */
18−#define pt_levels_pgdir_shift(lvls) ARM64_HW_PGTABLE_LEVEL_SHIFT(4 - (lvls))
19−
2013 /*
2114 * The hardware supports concatenation of up to 16 tables at stage2 entry
2215 * level and we use the feature whenever possible, which means we resolve 4
@@ -30,11 +23,6 @@ · 7 unmodified lines
3023 #define stage2_pgtable_levels(ipa) ARM64_HW_PGTABLE_LEVELS((ipa) - 4)
3124 #define kvm_stage2_levels(kvm) VTCR_EL2_LVLS(kvm->arch.vtcr)
3225
33−/* stage2_pgdir_shift() is the size mapped by top-level stage2 entry for the VM */
34−#define stage2_pgdir_shift(kvm) pt_levels_pgdir_shift(kvm_stage2_levels(kvm))
35−#define stage2_pgdir_size(kvm) (1ULL << stage2_pgdir_shift(kvm))
36−#define stage2_pgdir_mask(kvm) ~(stage2_pgdir_size(kvm) - 1)
37−
3826 /*
3927 * kvm_mmmu_cache_min_pages() is the number of pages required to install
4028 * a stage-2 translation. We pre-allocate the entry level page table at
@@ -42,12 +30,4 @@ · 1 unmodified line
4230 */
4331 #define kvm_mmu_cache_min_pages(kvm) (kvm_stage2_levels(kvm) - 1)
4432
45−static inline phys_addr_t
46−stage2_pgd_addr_end(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
47−{
48− phys_addr_t boundary = (addr + stage2_pgdir_size(kvm)) & stage2_pgdir_mask(kvm);
49−
50− return (boundary - 1 < end - 1) ? boundary : end;
51−}
52−
5333 #endif /* __ARM64_S2_PGTABLE_H_ */
arch/arm64/kvm/hyp/Makefile+1−4
@@ -5,9 +5,6 @@ · 4 unmodified lines
55
66 incdir := $(srctree)/$(src)/include
77 subdir-asflags-y := -I$(incdir)
8−subdir-ccflags-y := -I$(incdir) \
9− -fno-stack-protector \
10− -DDISABLE_BRANCH_PROFILING \
11− $(DISABLE_STACKLEAK_PLUGIN)
8+subdir-ccflags-y := -I$(incdir)
129
1310 obj-$(CONFIG_KVM) += vhe/ nvhe/ pgtable.o
arch/arm64/kvm/hyp/nvhe/Makefile+7−0
@@ -10,6 +10,9 @@ asflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS · 9 unmodified lines
1010 # will explode instantly (Words of Marc Zyngier). So introduce a generic flag
1111 # __DISABLE_TRACE_MMIO__ to disable MMIO tracing for nVHE KVM.
1212 ccflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS -D__DISABLE_TRACE_MMIO__
13+ccflags-y += -fno-stack-protector \
14+ -DDISABLE_BRANCH_PROFILING \
15+ $(DISABLE_STACKLEAK_PLUGIN)
1316
1417 hostprogs := gen-hyprel
1518 HOST_EXTRACFLAGS += -I$(objtree)/include
@@ -89,6 +92,10 @@ quiet_cmd_hypcopy = HYPCOPY $@ · 73 unmodified lines
8992 # Remove ftrace, Shadow Call Stack, and CFI CFLAGS.
9093 # This is equivalent to the 'notrace', '__noscs', and '__nocfi' annotations.
9194 KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_CFI), $(KBUILD_CFLAGS))
95+# Starting from 13.0.0 llvm emits SHT_REL section '.llvm.call-graph-profile'
96+# when profile optimization is applied. gen-hyprel does not support SHT_REL and
97+# causes a build failure. Remove profile optimization flags.
98+KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%, $(KBUILD_CFLAGS))
9299
93100 # KVM nVHE code is run at a different exception code with a different map, so
94101 # compiler instrumentation that inserts callbacks or checks into the code may
arch/arm64/kvm/mmu.c+8−1
@@ -31,6 +31,13 @@ static phys_addr_t hyp_idmap_vector; · 30 unmodified lines
3131
3232 static unsigned long io_map_base;
3333
34+static phys_addr_t stage2_range_addr_end(phys_addr_t addr, phys_addr_t end)
35+{
36+ phys_addr_t size = kvm_granule_size(KVM_PGTABLE_MIN_BLOCK_LEVEL);
37+ phys_addr_t boundary = ALIGN_DOWN(addr + size, size);
38+
39+ return (boundary - 1 < end - 1) ? boundary : end;
40+}
3441
3542 /*
3643 * Release kvm_mmu_lock periodically if the memory region is large. Otherwise,
@@ -52,7 +59,7 @@ static int stage2_apply_range(struct kvm *kvm, phys_addr_t addr, · 15 unmodified lines
5259 if (!pgt)
5360 return -EINVAL;
5461
55− next = stage2_pgd_addr_end(kvm, addr, end);
62+ next = stage2_range_addr_end(addr, end);
5663 ret = fn(pgt, addr, next - addr);
5764 if (ret)
5865 break;
arch/arm64/kvm/vgic/vgic-its.c+4−1
@@ -2149,7 +2149,7 @@ static int scan_its_table(struct vgic_its *its, gpa_t base, int size, u32 esz, · 2148 unmodified lines
21492149
21502150 memset(entry, 0, esz);
21512151
2152− while (len > 0) {
2152+ while (true) {
21532153 int next_offset;
21542154 size_t byte_offset;
21552155
@@ -2162,6 +2162,9 @@ static int scan_its_table(struct vgic_its *its, gpa_t base, int size, u32 esz, · 6 unmodified lines
21622162 return next_offset;
21632163
21642164 byte_offset = next_offset * esz;
2165+ if (byte_offset >= len)
2166+ break;
2167+
21652168 id += next_offset;
21662169 gpa += byte_offset;
21672170 len -= byte_offset;
arch/riscv/include/asm/cacheflush.h+0−8
@@ -42,16 +42,8 @@ void flush_icache_mm(struct mm_struct *mm, bool local); · 41 unmodified lines
4242
4343 #endif /* CONFIG_SMP */
4444
45−/*
46− * The T-Head CMO errata internally probe the CBOM block size, but otherwise
47− * don't depend on Zicbom.
48− */
4945 extern unsigned int riscv_cbom_block_size;
50−#ifdef CONFIG_RISCV_ISA_ZICBOM
5146 void riscv_init_cbom_blocksize(void);
52−#else
53−static inline void riscv_init_cbom_blocksize(void) { }
54−#endif
5547
5648 #ifdef CONFIG_RISCV_DMA_NONCOHERENT
5749 void riscv_noncoherent_supported(void);
arch/riscv/include/asm/kvm_vcpu_timer.h+1−0
@@ -45,6 +45,7 @@ int kvm_riscv_vcpu_timer_deinit(struct kvm_vcpu *vcpu); · 44 unmodified lines
4545 int kvm_riscv_vcpu_timer_reset(struct kvm_vcpu *vcpu);
4646 void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu);
4747 void kvm_riscv_guest_timer_init(struct kvm *kvm);
48+void kvm_riscv_vcpu_timer_sync(struct kvm_vcpu *vcpu);
4849 void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu);
4950 bool kvm_riscv_vcpu_timer_pending(struct kvm_vcpu *vcpu);
5051
arch/riscv/kvm/vcpu.c+3−0
@@ -708,6 +708,9 @@ void kvm_riscv_vcpu_sync_interrupts(struct kvm_vcpu *vcpu) · 707 unmodified lines
708708 clear_bit(IRQ_VS_SOFT, &v->irqs_pending);
709709 }
710710 }
711+
712+ /* Sync-up timer CSRs */
713+ kvm_riscv_vcpu_timer_sync(vcpu);
711714 }
712715
713716 int kvm_riscv_vcpu_set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq)
arch/riscv/kvm/vcpu_timer.c+15−2
@@ -320,20 +320,33 @@ void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu) · 319 unmodified lines
320320 kvm_riscv_vcpu_timer_unblocking(vcpu);
321321 }
322322
323−void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu)
323+void kvm_riscv_vcpu_timer_sync(struct kvm_vcpu *vcpu)
324324 {
325325 struct kvm_vcpu_timer *t = &vcpu->arch.timer;
326326
327327 if (!t->sstc_enabled)
328328 return;
329329
330− t = &vcpu->arch.timer;
331330 #if defined(CONFIG_32BIT)
332331 t->next_cycles = csr_read(CSR_VSTIMECMP);
333332 t->next_cycles |= (u64)csr_read(CSR_VSTIMECMPH) << 32;
334333 #else
335334 t->next_cycles = csr_read(CSR_VSTIMECMP);
336335 #endif
336+}
337+
338+void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu)
339+{
340+ struct kvm_vcpu_timer *t = &vcpu->arch.timer;
341+
342+ if (!t->sstc_enabled)
343+ return;
344+
345+ /*
346+ * The vstimecmp CSRs are saved by kvm_riscv_vcpu_timer_sync()
347+ * upon every VM exit so no need to save here.
348+ */
349+
337350 /* timer should be enabled for the remaining operations */
338351 if (unlikely(!t->init_done))
339352 return;
arch/riscv/mm/cacheflush.c+38−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 * Copyright (C) 2017 SiFive
44 */
55
6+#include <linux/of.h>
67 #include <asm/cacheflush.h>
78
89 #ifdef CONFIG_SMP
@@ -86,3 +87,40 @@ void flush_icache_pte(pte_t pte) · 77 unmodified lines
8687 flush_icache_all();
8788 }
8889 #endif /* CONFIG_MMU */
90+
91+unsigned int riscv_cbom_block_size;
92+EXPORT_SYMBOL_GPL(riscv_cbom_block_size);
93+
94+void riscv_init_cbom_blocksize(void)
95+{
96+ struct device_node *node;
97+ unsigned long cbom_hartid;
98+ u32 val, probed_block_size;
99+ int ret;
100+
101+ probed_block_size = 0;
102+ for_each_of_cpu_node(node) {
103+ unsigned long hartid;
104+
105+ ret = riscv_of_processor_hartid(node, &hartid);
106+ if (ret)
107+ continue;
108+
109+ /* set block-size for cbom extension if available */
110+ ret = of_property_read_u32(node, "riscv,cbom-block-size", &val);
111+ if (ret)
112+ continue;
113+
114+ if (!probed_block_size) {
115+ probed_block_size = val;
116+ cbom_hartid = hartid;
117+ } else {
118+ if (probed_block_size != val)
119+ pr_warn("cbom-block-size mismatched between harts %lu and %lu\n",
120+ cbom_hartid, hartid);
121+ }
122+ }
123+
124+ if (probed_block_size)
125+ riscv_cbom_block_size = probed_block_size;
126+}
arch/riscv/mm/dma-noncoherent.c+0−41
@@ -8,13 +8,8 @@ · 7 unmodified lines
88 #include <linux/dma-direct.h>
99 #include <linux/dma-map-ops.h>
1010 #include <linux/mm.h>
11−#include <linux/of.h>
12−#include <linux/of_device.h>
1311 #include <asm/cacheflush.h>
1412
15−unsigned int riscv_cbom_block_size;
16−EXPORT_SYMBOL_GPL(riscv_cbom_block_size);
17−
1813 static bool noncoherent_supported;
1914
2015 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
@@ -77,42 +72,6 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 56 unmodified lines
7772 dev->dma_coherent = coherent;
7873 }
7974
80−#ifdef CONFIG_RISCV_ISA_ZICBOM
81−void riscv_init_cbom_blocksize(void)
82−{
83− struct device_node *node;
84− unsigned long cbom_hartid;
85− u32 val, probed_block_size;
86− int ret;
87−
88− probed_block_size = 0;
89− for_each_of_cpu_node(node) {
90− unsigned long hartid;
91−
92− ret = riscv_of_processor_hartid(node, &hartid);
93− if (ret)
94− continue;
95−
96− /* set block-size for cbom extension if available */
97− ret = of_property_read_u32(node, "riscv,cbom-block-size", &val);
98− if (ret)
99− continue;
100−
101− if (!probed_block_size) {
102− probed_block_size = val;
103− cbom_hartid = hartid;
104− } else {
105− if (probed_block_size != val)
106− pr_warn("cbom-block-size mismatched between harts %lu and %lu\n",
107− cbom_hartid, hartid);
108− }
109− }
110−
111− if (probed_block_size)
112− riscv_cbom_block_size = probed_block_size;
113−}
114−#endif
115−
11675 void riscv_noncoherent_supported(void)
11776 {
11877 WARN(!riscv_cbom_block_size,
arch/x86/kvm/x86.c+73−14
@@ -6442,26 +6442,22 @@ static int kvm_add_msr_filter(struct kvm_x86_msr_filter *msr_filter, · 6441 unmodified lines
64426442 return 0;
64436443 }
64446444
6445−static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp)
6445+static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm,
6446+ struct kvm_msr_filter *filter)
64466447 {
6447− struct kvm_msr_filter __user *user_msr_filter = argp;
64486448 struct kvm_x86_msr_filter *new_filter, *old_filter;
6449− struct kvm_msr_filter filter;
64506449 bool default_allow;
64516450 bool empty = true;
64526451 int r = 0;
64536452 u32 i;
64546453
6455− if (copy_from_user(&filter, user_msr_filter, sizeof(filter)))
6456− return -EFAULT;
6457−
6458− if (filter.flags & ~KVM_MSR_FILTER_DEFAULT_DENY)
6454+ if (filter->flags & ~KVM_MSR_FILTER_DEFAULT_DENY)
64596455 return -EINVAL;
64606456
6461− for (i = 0; i < ARRAY_SIZE(filter.ranges); i++)
6462− empty &= !filter.ranges[i].nmsrs;
6457+ for (i = 0; i < ARRAY_SIZE(filter->ranges); i++)
6458+ empty &= !filter->ranges[i].nmsrs;
64636459
6464− default_allow = !(filter.flags & KVM_MSR_FILTER_DEFAULT_DENY);
6460+ default_allow = !(filter->flags & KVM_MSR_FILTER_DEFAULT_DENY);
64656461 if (empty && !default_allow)
64666462 return -EINVAL;
64676463
@@ -6469,8 +6465,8 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) · 1 unmodified line
64696465 if (!new_filter)
64706466 return -ENOMEM;
64716467
6472− for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) {
6473− r = kvm_add_msr_filter(new_filter, &filter.ranges[i]);
6468+ for (i = 0; i < ARRAY_SIZE(filter->ranges); i++) {
6469+ r = kvm_add_msr_filter(new_filter, &filter->ranges[i]);
64746470 if (r) {
64756471 kvm_free_msr_filter(new_filter);
64766472 return r;
@@ -6493,6 +6489,62 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) · 16 unmodified lines
64936489 return 0;
64946490 }
64956491
6492+#ifdef CONFIG_KVM_COMPAT
6493+/* for KVM_X86_SET_MSR_FILTER */
6494+struct kvm_msr_filter_range_compat {
6495+ __u32 flags;
6496+ __u32 nmsrs;
6497+ __u32 base;
6498+ __u32 bitmap;
6499+};
6500+
6501+struct kvm_msr_filter_compat {
6502+ __u32 flags;
6503+ struct kvm_msr_filter_range_compat ranges[KVM_MSR_FILTER_MAX_RANGES];
6504+};
6505+
6506+#define KVM_X86_SET_MSR_FILTER_COMPAT _IOW(KVMIO, 0xc6, struct kvm_msr_filter_compat)
6507+
6508+long kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl,
6509+ unsigned long arg)
6510+{
6511+ void __user *argp = (void __user *)arg;
6512+ struct kvm *kvm = filp->private_data;
6513+ long r = -ENOTTY;
6514+
6515+ switch (ioctl) {
6516+ case KVM_X86_SET_MSR_FILTER_COMPAT: {
6517+ struct kvm_msr_filter __user *user_msr_filter = argp;
6518+ struct kvm_msr_filter_compat filter_compat;
6519+ struct kvm_msr_filter filter;
6520+ int i;
6521+
6522+ if (copy_from_user(&filter_compat, user_msr_filter,
6523+ sizeof(filter_compat)))
6524+ return -EFAULT;
6525+
6526+ filter.flags = filter_compat.flags;
6527+ for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) {
6528+ struct kvm_msr_filter_range_compat *cr;
6529+
6530+ cr = &filter_compat.ranges[i];
6531+ filter.ranges[i] = (struct kvm_msr_filter_range) {
6532+ .flags = cr->flags,
6533+ .nmsrs = cr->nmsrs,
6534+ .base = cr->base,
6535+ .bitmap = (__u8 *)(ulong)cr->bitmap,
6536+ };
6537+ }
6538+
6539+ r = kvm_vm_ioctl_set_msr_filter(kvm, &filter);
6540+ break;
6541+ }
6542+ }
6543+
6544+ return r;
6545+}
6546+#endif
6547+
64966548 #ifdef CONFIG_HAVE_KVM_PM_NOTIFIER
64976549 static int kvm_arch_suspend_notifier(struct kvm *kvm)
64986550 {
@@ -6915,9 +6967,16 @@ set_pit2_out: · 416 unmodified lines
69156967 case KVM_SET_PMU_EVENT_FILTER:
69166968 r = kvm_vm_ioctl_set_pmu_event_filter(kvm, argp);
69176969 break;
6918− case KVM_X86_SET_MSR_FILTER:
6919− r = kvm_vm_ioctl_set_msr_filter(kvm, argp);
6970+ case KVM_X86_SET_MSR_FILTER: {
6971+ struct kvm_msr_filter __user *user_msr_filter = argp;
6972+ struct kvm_msr_filter filter;
6973+
6974+ if (copy_from_user(&filter, user_msr_filter, sizeof(filter)))
6975+ return -EFAULT;
6976+
6977+ r = kvm_vm_ioctl_set_msr_filter(kvm, &filter);
69206978 break;
6979+ }
69216980 default:
69226981 r = -ENOTTY;
69236982 }
include/linux/kvm_host.h+2−0
@@ -1390,6 +1390,8 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, · 1389 unmodified lines
13901390 struct kvm_enable_cap *cap);
13911391 long kvm_arch_vm_ioctl(struct file *filp,
13921392 unsigned int ioctl, unsigned long arg);
1393+long kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl,
1394+ unsigned long arg);
13931395
13941396 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
13951397 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
tools/include/uapi/linux/kvm.h+1−0
@@ -1177,6 +1177,7 @@ struct kvm_ppc_resize_hpt { · 1176 unmodified lines
11771177 #define KVM_CAP_VM_DISABLE_NX_HUGE_PAGES 220
11781178 #define KVM_CAP_S390_ZPCI_OP 221
11791179 #define KVM_CAP_S390_CPU_TOPOLOGY 222
1180+#define KVM_CAP_DIRTY_LOG_RING_ACQ_REL 223
11801181
11811182 #ifdef KVM_CAP_IRQ_ROUTING
11821183
tools/testing/selftests/kvm/aarch64/vgic_init.c+2−2
@@ -662,8 +662,8 @@ int test_kvm_device(uint32_t gic_dev_type) · 661 unmodified lines
662662 : KVM_DEV_TYPE_ARM_VGIC_V2;
663663
664664 if (!__kvm_test_create_device(v.vm, other)) {
665− ret = __kvm_test_create_device(v.vm, other);
666− TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
665+ ret = __kvm_create_device(v.vm, other);
666+ TEST_ASSERT(ret < 0 && (errno == EINVAL || errno == EEXIST),
667667 "create GIC device while other version exists");
668668 }
669669
tools/testing/selftests/kvm/memslot_modification_stress_test.c+1−1
@@ -67,7 +67,7 @@ struct memslot_antagonist_args { · 66 unmodified lines
6767 static void add_remove_memslot(struct kvm_vm *vm, useconds_t delay,
6868 uint64_t nr_modifications)
6969 {
70− const uint64_t pages = 1;
70+ uint64_t pages = max_t(int, vm->page_size, getpagesize()) / vm->page_size;
7171 uint64_t gpa;
7272 int i;
7373
virt/kvm/kvm_main.c+11−0
@@ -4839,6 +4839,12 @@ struct compat_kvm_clear_dirty_log { · 4838 unmodified lines
48394839 };
48404840 };
48414841
4842+long __weak kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl,
4843+ unsigned long arg)
4844+{
4845+ return -ENOTTY;
4846+}
4847+
48424848 static long kvm_vm_compat_ioctl(struct file *filp,
48434849 unsigned int ioctl, unsigned long arg)
48444850 {
@@ -4847,6 +4853,11 @@ static long kvm_vm_compat_ioctl(struct file *filp, · 2 unmodified lines
48474853
48484854 if (kvm->mm != current->mm || kvm->vm_dead)
48494855 return -EIO;
4856+
4857+ r = kvm_arch_vm_compat_ioctl(filp, ioctl, arg);
4858+ if (r != -ENOTTY)
4859+ return r;
4860+
48504861 switch (ioctl) {
48514862 #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
48524863 case KVM_CLEAR_DIRTY_LOG: {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t