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 ...
Showing the changes to include/linux (6 of 110 files). Show all
Unified · Split
| @@ -45,6 +45,7 @@ · 44 unmodified lines | |||
| 45 | #define ARM_SMCCC_OWNER_SIP 2 | 45 | #define ARM_SMCCC_OWNER_SIP 2 |
| 46 | #define ARM_SMCCC_OWNER_OEM 3 | 46 | #define ARM_SMCCC_OWNER_OEM 3 |
| 47 | #define ARM_SMCCC_OWNER_STANDARD 4 | 47 | #define ARM_SMCCC_OWNER_STANDARD 4 |
| 48 | #define ARM_SMCCC_OWNER_STANDARD_HYP 5 | ||
| 48 | #define ARM_SMCCC_OWNER_TRUSTED_APP 48 | 49 | #define ARM_SMCCC_OWNER_TRUSTED_APP 48 |
| 49 | #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49 | 50 | #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49 |
| 50 | #define ARM_SMCCC_OWNER_TRUSTED_OS 50 | 51 | #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 | |||
| 318 | #define SMCCC_RET_NOT_SUPPORTED -1 | 319 | #define SMCCC_RET_NOT_SUPPORTED -1 |
| 319 | #define SMCCC_RET_NOT_REQUIRED -2 | 320 | #define SMCCC_RET_NOT_REQUIRED -2 |
| 320 | 321 | ||
| 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 | |||
| 321 | #endif /*__ASSEMBLY__*/ | 380 | #endif /*__ASSEMBLY__*/ |
| 322 | #endif /*__LINUX_ARM_SMCCC_H*/ | 381 | #endif /*__LINUX_ARM_SMCCC_H*/ |
| @@ -136,6 +136,7 @@ enum cpuhp_state { · 135 unmodified lines | |||
| 136 | /* Must be the last timer callback */ | 136 | /* Must be the last timer callback */ |
| 137 | CPUHP_AP_DUMMY_TIMER_STARTING, | 137 | CPUHP_AP_DUMMY_TIMER_STARTING, |
| 138 | CPUHP_AP_ARM_XEN_STARTING, | 138 | CPUHP_AP_ARM_XEN_STARTING, |
| 139 | CPUHP_AP_ARM_KVMPV_STARTING, | ||
| 139 | CPUHP_AP_ARM_CORESIGHT_STARTING, | 140 | CPUHP_AP_ARM_CORESIGHT_STARTING, |
| 140 | CPUHP_AP_ARM64_ISNDEP_STARTING, | 141 | CPUHP_AP_ARM64_ISNDEP_STARTING, |
| 141 | CPUHP_AP_SMPCFD_DYING, | 142 | CPUHP_AP_SMPCFD_DYING, |
| @@ -32,9 +32,13 @@ struct its_vm { · 31 unmodified lines | |||
| 32 | struct its_vpe { | 32 | struct its_vpe { |
| 33 | struct page *vpt_page; | 33 | struct page *vpt_page; |
| 34 | struct its_vm *its_vm; | 34 | struct its_vm *its_vm; |
| 35 | /* per-vPE VLPI tracking */ | ||
| 36 | atomic_t vlpi_count; | ||
| 35 | /* Doorbell interrupt */ | 37 | /* Doorbell interrupt */ |
| 36 | int irq; | 38 | int irq; |
| 37 | irq_hw_number_t vpe_db_lpi; | 39 | irq_hw_number_t vpe_db_lpi; |
| 40 | /* VPE resident */ | ||
| 41 | bool resident; | ||
| 38 | /* VPE proxy mapping */ | 42 | /* VPE proxy mapping */ |
| 39 | int vpe_proxy_event; | 43 | int vpe_proxy_event; |
| 40 | /* | 44 | /* |
| @@ -266,7 +266,8 @@ struct kvm_vcpu { · 265 unmodified lines | |||
| 266 | struct preempt_notifier preempt_notifier; | 266 | struct preempt_notifier preempt_notifier; |
| 267 | #endif | 267 | #endif |
| 268 | int cpu; | 268 | 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 */ | ||
| 270 | int srcu_idx; | 271 | int srcu_idx; |
| 271 | int mode; | 272 | int mode; |
| 272 | u64 requests; | 273 | u64 requests; |
| @@ -278,7 +279,6 @@ struct kvm_vcpu { · 5 unmodified lines | |||
| 278 | struct mutex mutex; | 279 | struct mutex mutex; |
| 279 | struct kvm_run *run; | 280 | struct kvm_run *run; |
| 280 | 281 | ||
| 281 | int guest_xcr0_loaded; | ||
| 282 | struct swait_queue_head wq; | 282 | struct swait_queue_head wq; |
| 283 | struct pid __rcu *pid; | 283 | struct pid __rcu *pid; |
| 284 | int sigset_active; | 284 | 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 | |||
| 571 | 571 | ||
| 572 | static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) | 572 | static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) |
| 573 | { | 573 | { |
| 574 | struct kvm_vcpu *tmp; | 574 | return vcpu->vcpu_idx; |
| 575 | int idx; | ||
| 576 | |||
| 577 | kvm_for_each_vcpu(idx, tmp, vcpu->kvm) | ||
| 578 | if (tmp == vcpu) | ||
| 579 | return idx; | ||
| 580 | BUG(); | ||
| 581 | } | 575 | } |
| 582 | 576 | ||
| 583 | #define kvm_for_each_memslot(memslot, slots) \ | 577 | #define kvm_for_each_memslot(memslot, slots) \ |
| @@ -622,6 +616,7 @@ void kvm_exit(void); · 38 unmodified lines | |||
| 622 | 616 | ||
| 623 | void kvm_get_kvm(struct kvm *kvm); | 617 | void kvm_get_kvm(struct kvm *kvm); |
| 624 | void kvm_put_kvm(struct kvm *kvm); | 618 | void kvm_put_kvm(struct kvm *kvm); |
| 619 | void kvm_put_kvm_no_destroy(struct kvm *kvm); | ||
| 625 | 620 | ||
| 626 | static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) | 621 | static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) |
| 627 | { | 622 | { |
| @@ -746,6 +741,28 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 118 unmodified lines | |||
| 746 | unsigned long len); | 741 | unsigned long len); |
| 747 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | 742 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 748 | gpa_t gpa, unsigned long len); | 743 | 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 | |||
| 749 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | 766 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
| 750 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); | 767 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
| 751 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | 768 | 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 | |||
| 791 | bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, | 808 | bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, |
| 792 | unsigned long *vcpu_bitmap, cpumask_var_t tmp); | 809 | unsigned long *vcpu_bitmap, cpumask_var_t tmp); |
| 793 | bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req); | 810 | 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); | ||
| 794 | 813 | ||
| 795 | long kvm_arch_dev_ioctl(struct file *filp, | 814 | long kvm_arch_dev_ioctl(struct file *filp, |
| 796 | unsigned int ioctl, unsigned long arg); | 815 | unsigned int ioctl, unsigned long arg); |
| @@ -1241,7 +1260,7 @@ extern unsigned int halt_poll_ns_grow_start; · 444 unmodified lines | |||
| 1241 | extern unsigned int halt_poll_ns_shrink; | 1260 | extern unsigned int halt_poll_ns_shrink; |
| 1242 | 1261 | ||
| 1243 | struct kvm_device { | 1262 | struct kvm_device { |
| 1244 | struct kvm_device_ops *ops; | 1263 | const struct kvm_device_ops *ops; |
| 1245 | struct kvm *kvm; | 1264 | struct kvm *kvm; |
| 1246 | void *private; | 1265 | void *private; |
| 1247 | struct list_head vm_node; | 1266 | struct list_head vm_node; |
| @@ -1294,7 +1313,7 @@ struct kvm_device_ops { · 46 unmodified lines | |||
| 1294 | void kvm_device_get(struct kvm_device *dev); | 1313 | void kvm_device_get(struct kvm_device *dev); |
| 1295 | void kvm_device_put(struct kvm_device *dev); | 1314 | void kvm_device_put(struct kvm_device *dev); |
| 1296 | struct kvm_device *kvm_device_from_filp(struct file *filp); | 1315 | 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); |
| 1298 | void kvm_unregister_device_ops(u32 type); | 1317 | void kvm_unregister_device_ops(u32 type); |
| 1299 | 1318 | ||
| 1300 | extern struct kvm_device_ops kvm_mpic_ops; | 1319 | extern struct kvm_device_ops kvm_mpic_ops; |
| @@ -35,6 +35,8 @@ typedef unsigned long gva_t; · 34 unmodified lines | |||
| 35 | typedef u64 gpa_t; | 35 | typedef u64 gpa_t; |
| 36 | typedef u64 gfn_t; | 36 | typedef u64 gfn_t; |
| 37 | 37 | ||
| 38 | #define GPA_INVALID (~(gpa_t)0) | ||
| 39 | |||
| 38 | typedef unsigned long hva_t; | 40 | typedef unsigned long hva_t; |
| 39 | typedef u64 hpa_t; | 41 | typedef u64 hpa_t; |
| 40 | typedef u64 hfn_t; | 42 | typedef u64 hfn_t; |
| @@ -1336,6 +1336,8 @@ extern void perf_event_disable_local(struct perf_event *event); · 1335 unmodified lines | |||
| 1336 | extern void perf_event_disable_inatomic(struct perf_event *event); | 1336 | extern void perf_event_disable_inatomic(struct perf_event *event); |
| 1337 | extern void perf_event_task_tick(void); | 1337 | extern void perf_event_task_tick(void); |
| 1338 | extern int perf_event_account_interrupt(struct perf_event *event); | 1338 | 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); | ||
| 1339 | #else /* !CONFIG_PERF_EVENTS: */ | 1341 | #else /* !CONFIG_PERF_EVENTS: */ |
| 1340 | static inline void * | 1342 | static inline void * |
| 1341 | perf_aux_output_begin(struct perf_output_handle *handle, | 1343 | 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 | |||
| 1415 | static inline int __perf_event_disable(void *info) { return -1; } | 1417 | static inline int __perf_event_disable(void *info) { return -1; } |
| 1416 | static inline void perf_event_task_tick(void) { } | 1418 | static inline void perf_event_task_tick(void) { } |
| 1417 | static inline int perf_event_release_kernel(struct perf_event *event) { return 0; } | 1419 | 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 | } | ||
| 1418 | #endif | 1428 | #endif |
| 1419 | 1429 | ||
| 1420 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) | 1430 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) |