History

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

Pull KVM updates from Paolo Bonzini: "ARM: - data abort report and injection - steal time support - GICv4 performance improvements - vgic ITS emulation fixes - simplify FWB handling - enable halt polling counters - make the emulated timer PREEMPT_RT compliant s390: - small fixes and cleanups - selftest improvements - yield improvements PPC: - add capability to tell userspace whether we can single-step the guest - improve the allocation of XIVE virtual processor IDs - rewrite interrupt synthesis code to deliver interrupts in virtual mode when appropriate. - minor cleanups and improvements. x86: - XSAVES support for AMD - more accurate report of nested guest TSC to the nested hypervisor - retpoline optimizations - support for nested 5-level page tables - PMU virtualization optimizations, and improved support for nested PMU virtualization - correct latching of INITs for nested virtualization - IOAPIC optimization - TSX_CTRL virtualization for more TAA happiness - improved allocation and flushing of SEV ASIDs - many bugfixes and cleanups" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (127 commits) kvm: nVMX: Relax guest IA32_FEATURE_CONTROL constraints KVM: x86: Grab KVM's srcu lock when setting nested state KVM: x86: Open code shared_msr_update() in its only caller KVM: Fix jump label out_free_* in kvm_init() KVM: x86: Remove a spurious export of a static function KVM: x86: create mmu/ subdirectory KVM: nVMX: Remove unnecessary TLB flushes on L1<->L2 switches when L1 use apic-access-page KVM: x86: remove set but not used variable 'called' KVM: nVMX: Do not mark vmcs02->apic_access_page as dirty when unpinning KVM: vmx: use MSR_IA32_TSX_CTRL to hard-disable TSX on guest that lack it KVM: vmx: implement MSR_IA32_TSX_CTRL disable RTM functionality KVM: x86: implement MSR_IA32_TSX_CTRL effect on CPUID KVM: x86: do not modify masked bits of shared MSRs KVM: x86: fix presentation of TSX feature in ARCH_CAPABILITIES KVM: PPC: Book3S HV: XIVE: Fix potential page leak on error path KVM: PPC: Book3S HV: XIVE: Free previous EQ page when setting up a new one KVM: nVMX: Assume TLB entries of L1 and L2 are tagged differently if L0 use EPT KVM: x86: Unexport kvm_vcpu_reload_apic_access_page() KVM: nVMX: add CR4_LA57 bit to nested CR4_FIXED1 KVM: nVMX: Use semi-colon instead of comma for exit-handlers initialization ...

Linus Torvalds committed 6 years ago

Commit 752272f2 parents 3f3c8be 9671024110 files · +2593 −924Browse files

Showing the changes to include/linux (6 of 110 files). Show all

Unified · Split

6 files
  1. include/linux/arm-smccc.h +59 −0
  2. include/linux/cpuhotplug.h +1 −0
  3. include/linux/irqchip/arm-gic-v4.h +4 −0
  4. include/linux/kvm_host.h +30 −11
  5. include/linux/kvm_types.h +2 −0
  6. include/linux/perf_event.h +10 −0
include/linux/arm-smccc.h+59−0
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #define ARM_SMCCC_OWNER_SIP 2
4646 #define ARM_SMCCC_OWNER_OEM 3
4747 #define ARM_SMCCC_OWNER_STANDARD 4
48+#define ARM_SMCCC_OWNER_STANDARD_HYP 5
4849 #define ARM_SMCCC_OWNER_TRUSTED_APP 48
4950 #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49
5051 #define ARM_SMCCC_OWNER_TRUSTED_OS 50
@@ -318,5 +319,63 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, · 267 unmodified lines
318319 #define SMCCC_RET_NOT_SUPPORTED -1
319320 #define SMCCC_RET_NOT_REQUIRED -2
320321
322+/*
323+ * Like arm_smccc_1_1* but always returns SMCCC_RET_NOT_SUPPORTED.
324+ * Used when the SMCCC conduit is not defined. The empty asm statement
325+ * avoids compiler warnings about unused variables.
326+ */
327+#define __fail_smccc_1_1(...) \
328+ do { \
329+ __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
330+ asm ("" __constraints(__count_args(__VA_ARGS__))); \
331+ if (___res) \
332+ ___res->a0 = SMCCC_RET_NOT_SUPPORTED; \
333+ } while (0)
334+
335+/*
336+ * arm_smccc_1_1_invoke() - make an SMCCC v1.1 compliant call
337+ *
338+ * This is a variadic macro taking one to eight source arguments, and
339+ * an optional return structure.
340+ *
341+ * @a0-a7: arguments passed in registers 0 to 7
342+ * @res: result values from registers 0 to 3
343+ *
344+ * This macro will make either an HVC call or an SMC call depending on the
345+ * current SMCCC conduit. If no valid conduit is available then -1
346+ * (SMCCC_RET_NOT_SUPPORTED) is returned in @res.a0 (if supplied).
347+ *
348+ * The return value also provides the conduit that was used.
349+ */
350+#define arm_smccc_1_1_invoke(...) ({ \
351+ int method = arm_smccc_1_1_get_conduit(); \
352+ switch (method) { \
353+ case SMCCC_CONDUIT_HVC: \
354+ arm_smccc_1_1_hvc(__VA_ARGS__); \
355+ break; \
356+ case SMCCC_CONDUIT_SMC: \
357+ arm_smccc_1_1_smc(__VA_ARGS__); \
358+ break; \
359+ default: \
360+ __fail_smccc_1_1(__VA_ARGS__); \
361+ method = SMCCC_CONDUIT_NONE; \
362+ break; \
363+ } \
364+ method; \
365+ })
366+
367+/* Paravirtualised time calls (defined by ARM DEN0057A) */
368+#define ARM_SMCCC_HV_PV_TIME_FEATURES \
369+ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
370+ ARM_SMCCC_SMC_64, \
371+ ARM_SMCCC_OWNER_STANDARD_HYP, \
372+ 0x20)
373+
374+#define ARM_SMCCC_HV_PV_TIME_ST \
375+ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
376+ ARM_SMCCC_SMC_64, \
377+ ARM_SMCCC_OWNER_STANDARD_HYP, \
378+ 0x21)
379+
321380 #endif /*__ASSEMBLY__*/
322381 #endif /*__LINUX_ARM_SMCCC_H*/
include/linux/cpuhotplug.h+1−0
@@ -136,6 +136,7 @@ enum cpuhp_state { · 135 unmodified lines
136136 /* Must be the last timer callback */
137137 CPUHP_AP_DUMMY_TIMER_STARTING,
138138 CPUHP_AP_ARM_XEN_STARTING,
139+ CPUHP_AP_ARM_KVMPV_STARTING,
139140 CPUHP_AP_ARM_CORESIGHT_STARTING,
140141 CPUHP_AP_ARM64_ISNDEP_STARTING,
141142 CPUHP_AP_SMPCFD_DYING,
include/linux/irqchip/arm-gic-v4.h+4−0
@@ -32,9 +32,13 @@ struct its_vm { · 31 unmodified lines
3232 struct its_vpe {
3333 struct page *vpt_page;
3434 struct its_vm *its_vm;
35+ /* per-vPE VLPI tracking */
36+ atomic_t vlpi_count;
3537 /* Doorbell interrupt */
3638 int irq;
3739 irq_hw_number_t vpe_db_lpi;
40+ /* VPE resident */
41+ bool resident;
3842 /* VPE proxy mapping */
3943 int vpe_proxy_event;
4044 /*
include/linux/kvm_host.h+30−11
@@ -266,7 +266,8 @@ struct kvm_vcpu { · 265 unmodified lines
266266 struct preempt_notifier preempt_notifier;
267267 #endif
268268 int cpu;
269− int vcpu_id;
269+ int vcpu_id; /* id given by userspace at creation */
270+ int vcpu_idx; /* index in kvm->vcpus array */
270271 int srcu_idx;
271272 int mode;
272273 u64 requests;
@@ -278,7 +279,6 @@ struct kvm_vcpu { · 5 unmodified lines
278279 struct mutex mutex;
279280 struct kvm_run *run;
280281
281− int guest_xcr0_loaded;
282282 struct swait_queue_head wq;
283283 struct pid __rcu *pid;
284284 int sigset_active;
@@ -571,13 +571,7 @@ static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) · 286 unmodified lines
571571
572572 static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu)
573573 {
574− struct kvm_vcpu *tmp;
575− int idx;
576−
577− kvm_for_each_vcpu(idx, tmp, vcpu->kvm)
578− if (tmp == vcpu)
579− return idx;
580− BUG();
574+ return vcpu->vcpu_idx;
581575 }
582576
583577 #define kvm_for_each_memslot(memslot, slots) \
@@ -622,6 +616,7 @@ void kvm_exit(void); · 38 unmodified lines
622616
623617 void kvm_get_kvm(struct kvm *kvm);
624618 void kvm_put_kvm(struct kvm *kvm);
619+void kvm_put_kvm_no_destroy(struct kvm *kvm);
625620
626621 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
627622 {
@@ -746,6 +741,28 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 118 unmodified lines
746741 unsigned long len);
747742 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
748743 gpa_t gpa, unsigned long len);
744+
745+#define __kvm_put_guest(kvm, gfn, offset, value, type) \
746+({ \
747+ unsigned long __addr = gfn_to_hva(kvm, gfn); \
748+ type __user *__uaddr = (type __user *)(__addr + offset); \
749+ int __ret = -EFAULT; \
750+ \
751+ if (!kvm_is_error_hva(__addr)) \
752+ __ret = put_user(value, __uaddr); \
753+ if (!__ret) \
754+ mark_page_dirty(kvm, gfn); \
755+ __ret; \
756+})
757+
758+#define kvm_put_guest(kvm, gpa, value, type) \
759+({ \
760+ gpa_t __gpa = gpa; \
761+ struct kvm *__kvm = kvm; \
762+ __kvm_put_guest(__kvm, __gpa >> PAGE_SHIFT, \
763+ offset_in_page(__gpa), (value), type); \
764+})
765+
749766 int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
750767 int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
751768 struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
@@ -791,6 +808,8 @@ void kvm_reload_remote_mmus(struct kvm *kvm); · 39 unmodified lines
791808 bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
792809 unsigned long *vcpu_bitmap, cpumask_var_t tmp);
793810 bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
811+bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req,
812+ unsigned long *vcpu_bitmap);
794813
795814 long kvm_arch_dev_ioctl(struct file *filp,
796815 unsigned int ioctl, unsigned long arg);
@@ -1241,7 +1260,7 @@ extern unsigned int halt_poll_ns_grow_start; · 444 unmodified lines
12411260 extern unsigned int halt_poll_ns_shrink;
12421261
12431262 struct kvm_device {
1244− struct kvm_device_ops *ops;
1263+ const struct kvm_device_ops *ops;
12451264 struct kvm *kvm;
12461265 void *private;
12471266 struct list_head vm_node;
@@ -1294,7 +1313,7 @@ struct kvm_device_ops { · 46 unmodified lines
12941313 void kvm_device_get(struct kvm_device *dev);
12951314 void kvm_device_put(struct kvm_device *dev);
12961315 struct kvm_device *kvm_device_from_filp(struct file *filp);
1297−int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type);
1316+int kvm_register_device_ops(const struct kvm_device_ops *ops, u32 type);
12981317 void kvm_unregister_device_ops(u32 type);
12991318
13001319 extern struct kvm_device_ops kvm_mpic_ops;
include/linux/kvm_types.h+2−0
@@ -35,6 +35,8 @@ typedef unsigned long gva_t; · 34 unmodified lines
3535 typedef u64 gpa_t;
3636 typedef u64 gfn_t;
3737
38+#define GPA_INVALID (~(gpa_t)0)
39+
3840 typedef unsigned long hva_t;
3941 typedef u64 hpa_t;
4042 typedef u64 hfn_t;
include/linux/perf_event.h+10−0
@@ -1336,6 +1336,8 @@ extern void perf_event_disable_local(struct perf_event *event); · 1335 unmodified lines
13361336 extern void perf_event_disable_inatomic(struct perf_event *event);
13371337 extern void perf_event_task_tick(void);
13381338 extern int perf_event_account_interrupt(struct perf_event *event);
1339+extern int perf_event_period(struct perf_event *event, u64 value);
1340+extern u64 perf_event_pause(struct perf_event *event, bool reset);
13391341 #else /* !CONFIG_PERF_EVENTS: */
13401342 static inline void *
13411343 perf_aux_output_begin(struct perf_output_handle *handle,
@@ -1415,6 +1417,14 @@ static inline void perf_event_disable(struct perf_event *event) { } · 73 unmodified lines
14151417 static inline int __perf_event_disable(void *info) { return -1; }
14161418 static inline void perf_event_task_tick(void) { }
14171419 static inline int perf_event_release_kernel(struct perf_event *event) { return 0; }
1420+static inline int perf_event_period(struct perf_event *event, u64 value)
1421+{
1422+ return -EINVAL;
1423+}
1424+static inline u64 perf_event_pause(struct perf_event *event, bool reset)
1425+{
1426+ return 0;
1427+}
14181428 #endif
14191429
14201430 #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)

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