Skip to content

Commit 90568ec

Browse files
committed
Merge tag 'kvm-5.6-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull more KVM updates from Paolo Bonzini: "s390: - fix register corruption - ENOTSUPP/EOPNOTSUPP mixed - reset cleanups/fixes - selftests x86: - Bug fixes and cleanups - AMD support for APIC virtualization even in combination with in-kernel PIT or IOAPIC. MIPS: - Compilation fix. Generic: - Fix refcount overflow for zero page" * tag 'kvm-5.6-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (42 commits) KVM: vmx: delete meaningless vmx_decache_cr0_guest_bits() declaration KVM: x86: Mark CR4.UMIP as reserved based on associated CPUID bit x86: vmxfeatures: rename features for consistency with KVM and manual KVM: SVM: relax conditions for allowing MSR_IA32_SPEC_CTRL accesses KVM: x86: Fix perfctr WRMSR for running counters x86/kvm/hyper-v: don't allow to turn on unsupported VMX controls for nested guests x86/kvm/hyper-v: move VMX controls sanitization out of nested_enable_evmcs() kvm: mmu: Separate generating and setting mmio ptes kvm: mmu: Replace unsigned with unsigned int for PTE access KVM: nVMX: Remove stale comment from nested_vmx_load_cr3() KVM: MIPS: Fold comparecount_func() into comparecount_wakeup() KVM: MIPS: Fix a build error due to referencing not-yet-defined function x86/kvm: do not setup pv tlb flush when not paravirtualized KVM: fix overflow of zero page refcount with ksm running KVM: x86: Take a u64 when checking for a valid dr7 value KVM: x86: use raw clock values consistently KVM: x86: reorganize pvclock_gtod_data members KVM: nVMX: delete meaningless nested_vmx_run() declaration KVM: SVM: allow AVIC without split irqchip kvm: ioapic: Lazy update IOAPIC EOI ...
2 parents d854b2d + a8be1ad commit 90568ec

File tree

30 files changed

+925
-233
lines changed

30 files changed

+925
-233
lines changed

Documentation/virt/kvm/api.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4177,6 +4177,42 @@ This ioctl issues an ultravisor call to terminate the secure guest,
41774177
unpins the VPA pages and releases all the device pages that are used to
41784178
track the secure pages by hypervisor.
41794179

4180+
4.122 KVM_S390_NORMAL_RESET
4181+
4182+
Capability: KVM_CAP_S390_VCPU_RESETS
4183+
Architectures: s390
4184+
Type: vcpu ioctl
4185+
Parameters: none
4186+
Returns: 0
4187+
4188+
This ioctl resets VCPU registers and control structures according to
4189+
the cpu reset definition in the POP (Principles Of Operation).
4190+
4191+
4.123 KVM_S390_INITIAL_RESET
4192+
4193+
Capability: none
4194+
Architectures: s390
4195+
Type: vcpu ioctl
4196+
Parameters: none
4197+
Returns: 0
4198+
4199+
This ioctl resets VCPU registers and control structures according to
4200+
the initial cpu reset definition in the POP. However, the cpu is not
4201+
put into ESA mode. This reset is a superset of the normal reset.
4202+
4203+
4.124 KVM_S390_CLEAR_RESET
4204+
4205+
Capability: KVM_CAP_S390_VCPU_RESETS
4206+
Architectures: s390
4207+
Type: vcpu ioctl
4208+
Parameters: none
4209+
Returns: 0
4210+
4211+
This ioctl resets VCPU registers and control structures according to
4212+
the clear cpu reset definition in the POP. However, the cpu is not put
4213+
into ESA mode. This reset is a superset of the initial reset.
4214+
4215+
41804216
5. The kvm_run structure
41814217
------------------------
41824218

@@ -5405,3 +5441,10 @@ handling by KVM (as some KVM hypercall may be mistakenly treated as TLB
54055441
flush hypercalls by Hyper-V) so userspace should disable KVM identification
54065442
in CPUID and only exposes Hyper-V identification. In this case, guest
54075443
thinks it's running on Hyper-V and only use Hyper-V hypercalls.
5444+
5445+
8.22 KVM_CAP_S390_VCPU_RESETS
5446+
5447+
Architectures: s390
5448+
5449+
This capability indicates that the KVM_S390_NORMAL_RESET and
5450+
KVM_S390_CLEAR_RESET ioctls are available.

arch/mips/kvm/mips.c

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,22 @@ static inline void dump_handler(const char *symbol, void *start, void *end)
280280
pr_debug("\tEND(%s)\n", symbol);
281281
}
282282

283+
/* low level hrtimer wake routine */
284+
static enum hrtimer_restart kvm_mips_comparecount_wakeup(struct hrtimer *timer)
285+
{
286+
struct kvm_vcpu *vcpu;
287+
288+
vcpu = container_of(timer, struct kvm_vcpu, arch.comparecount_timer);
289+
290+
kvm_mips_callbacks->queue_timer_int(vcpu);
291+
292+
vcpu->arch.wait = 0;
293+
if (swq_has_sleeper(&vcpu->wq))
294+
swake_up_one(&vcpu->wq);
295+
296+
return kvm_mips_count_timeout(vcpu);
297+
}
298+
283299
int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
284300
{
285301
return 0;
@@ -1209,27 +1225,6 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
12091225
return 0;
12101226
}
12111227

1212-
static void kvm_mips_comparecount_func(unsigned long data)
1213-
{
1214-
struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
1215-
1216-
kvm_mips_callbacks->queue_timer_int(vcpu);
1217-
1218-
vcpu->arch.wait = 0;
1219-
if (swq_has_sleeper(&vcpu->wq))
1220-
swake_up_one(&vcpu->wq);
1221-
}
1222-
1223-
/* low level hrtimer wake routine */
1224-
static enum hrtimer_restart kvm_mips_comparecount_wakeup(struct hrtimer *timer)
1225-
{
1226-
struct kvm_vcpu *vcpu;
1227-
1228-
vcpu = container_of(timer, struct kvm_vcpu, arch.comparecount_timer);
1229-
kvm_mips_comparecount_func((unsigned long) vcpu);
1230-
return kvm_mips_count_timeout(vcpu);
1231-
}
1232-
12331228
int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
12341229
struct kvm_translation *tr)
12351230
{

arch/s390/include/asm/kvm_host.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ struct mcck_volatile_info {
122122
__u32 reserved;
123123
};
124124

125+
#define CR0_INITIAL_MASK (CR0_UNUSED_56 | CR0_INTERRUPT_KEY_SUBMASK | \
126+
CR0_MEASUREMENT_ALERT_SUBMASK)
127+
#define CR14_INITIAL_MASK (CR14_UNUSED_32 | CR14_UNUSED_33 | \
128+
CR14_EXTERNAL_DAMAGE_SUBMASK)
129+
125130
#define CPUSTAT_STOPPED 0x80000000
126131
#define CPUSTAT_WAIT 0x10000000
127132
#define CPUSTAT_ECALL_PEND 0x08000000

arch/s390/kvm/interrupt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ static int flic_ais_mode_get_all(struct kvm *kvm, struct kvm_device_attr *attr)
21902190
return -EINVAL;
21912191

21922192
if (!test_kvm_facility(kvm, 72))
2193-
return -ENOTSUPP;
2193+
return -EOPNOTSUPP;
21942194

21952195
mutex_lock(&fi->ais_lock);
21962196
ais.simm = fi->simm;
@@ -2499,7 +2499,7 @@ static int modify_ais_mode(struct kvm *kvm, struct kvm_device_attr *attr)
24992499
int ret = 0;
25002500

25012501
if (!test_kvm_facility(kvm, 72))
2502-
return -ENOTSUPP;
2502+
return -EOPNOTSUPP;
25032503

25042504
if (copy_from_user(&req, (void __user *)attr->addr, sizeof(req)))
25052505
return -EFAULT;
@@ -2579,7 +2579,7 @@ static int flic_ais_mode_set_all(struct kvm *kvm, struct kvm_device_attr *attr)
25792579
struct kvm_s390_ais_all ais;
25802580

25812581
if (!test_kvm_facility(kvm, 72))
2582-
return -ENOTSUPP;
2582+
return -EOPNOTSUPP;
25832583

25842584
if (copy_from_user(&ais, (void __user *)attr->addr, sizeof(ais)))
25852585
return -EFAULT;

arch/s390/kvm/kvm-s390.c

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
529529
case KVM_CAP_S390_CMMA_MIGRATION:
530530
case KVM_CAP_S390_AIS:
531531
case KVM_CAP_S390_AIS_MIGRATION:
532+
case KVM_CAP_S390_VCPU_RESETS:
532533
r = 1;
533534
break;
534535
case KVM_CAP_S390_HPAGE_1M:
@@ -2808,35 +2809,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
28082809

28092810
}
28102811

2811-
static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
2812-
{
2813-
/* this equals initial cpu reset in pop, but we don't switch to ESA */
2814-
vcpu->arch.sie_block->gpsw.mask = 0UL;
2815-
vcpu->arch.sie_block->gpsw.addr = 0UL;
2816-
kvm_s390_set_prefix(vcpu, 0);
2817-
kvm_s390_set_cpu_timer(vcpu, 0);
2818-
vcpu->arch.sie_block->ckc = 0UL;
2819-
vcpu->arch.sie_block->todpr = 0;
2820-
memset(vcpu->arch.sie_block->gcr, 0, 16 * sizeof(__u64));
2821-
vcpu->arch.sie_block->gcr[0] = CR0_UNUSED_56 |
2822-
CR0_INTERRUPT_KEY_SUBMASK |
2823-
CR0_MEASUREMENT_ALERT_SUBMASK;
2824-
vcpu->arch.sie_block->gcr[14] = CR14_UNUSED_32 |
2825-
CR14_UNUSED_33 |
2826-
CR14_EXTERNAL_DAMAGE_SUBMASK;
2827-
/* make sure the new fpc will be lazily loaded */
2828-
save_fpu_regs();
2829-
current->thread.fpu.fpc = 0;
2830-
vcpu->arch.sie_block->gbea = 1;
2831-
vcpu->arch.sie_block->pp = 0;
2832-
vcpu->arch.sie_block->fpf &= ~FPF_BPBC;
2833-
vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID;
2834-
kvm_clear_async_pf_completion_queue(vcpu);
2835-
if (!kvm_s390_user_cpu_state_ctrl(vcpu->kvm))
2836-
kvm_s390_vcpu_stop(vcpu);
2837-
kvm_s390_clear_local_irqs(vcpu);
2838-
}
2839-
28402812
void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
28412813
{
28422814
mutex_lock(&vcpu->kvm->lock);
@@ -3279,10 +3251,53 @@ static int kvm_arch_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu,
32793251
return r;
32803252
}
32813253

3282-
static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
3254+
static void kvm_arch_vcpu_ioctl_normal_reset(struct kvm_vcpu *vcpu)
32833255
{
3284-
kvm_s390_vcpu_initial_reset(vcpu);
3285-
return 0;
3256+
vcpu->arch.sie_block->gpsw.mask &= ~PSW_MASK_RI;
3257+
vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID;
3258+
memset(vcpu->run->s.regs.riccb, 0, sizeof(vcpu->run->s.regs.riccb));
3259+
3260+
kvm_clear_async_pf_completion_queue(vcpu);
3261+
if (!kvm_s390_user_cpu_state_ctrl(vcpu->kvm))
3262+
kvm_s390_vcpu_stop(vcpu);
3263+
kvm_s390_clear_local_irqs(vcpu);
3264+
}
3265+
3266+
static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
3267+
{
3268+
/* Initial reset is a superset of the normal reset */
3269+
kvm_arch_vcpu_ioctl_normal_reset(vcpu);
3270+
3271+
/* this equals initial cpu reset in pop, but we don't switch to ESA */
3272+
vcpu->arch.sie_block->gpsw.mask = 0;
3273+
vcpu->arch.sie_block->gpsw.addr = 0;
3274+
kvm_s390_set_prefix(vcpu, 0);
3275+
kvm_s390_set_cpu_timer(vcpu, 0);
3276+
vcpu->arch.sie_block->ckc = 0;
3277+
vcpu->arch.sie_block->todpr = 0;
3278+
memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
3279+
vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
3280+
vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
3281+
vcpu->run->s.regs.fpc = 0;
3282+
vcpu->arch.sie_block->gbea = 1;
3283+
vcpu->arch.sie_block->pp = 0;
3284+
vcpu->arch.sie_block->fpf &= ~FPF_BPBC;
3285+
}
3286+
3287+
static void kvm_arch_vcpu_ioctl_clear_reset(struct kvm_vcpu *vcpu)
3288+
{
3289+
struct kvm_sync_regs *regs = &vcpu->run->s.regs;
3290+
3291+
/* Clear reset is a superset of the initial reset */
3292+
kvm_arch_vcpu_ioctl_initial_reset(vcpu);
3293+
3294+
memset(&regs->gprs, 0, sizeof(regs->gprs));
3295+
memset(&regs->vrs, 0, sizeof(regs->vrs));
3296+
memset(&regs->acrs, 0, sizeof(regs->acrs));
3297+
memset(&regs->gscb, 0, sizeof(regs->gscb));
3298+
3299+
regs->etoken = 0;
3300+
regs->etoken_extension = 0;
32863301
}
32873302

32883303
int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
@@ -4343,7 +4358,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
43434358
switch (ioctl) {
43444359
case KVM_S390_STORE_STATUS:
43454360
idx = srcu_read_lock(&vcpu->kvm->srcu);
4346-
r = kvm_s390_vcpu_store_status(vcpu, arg);
4361+
r = kvm_s390_store_status_unloaded(vcpu, arg);
43474362
srcu_read_unlock(&vcpu->kvm->srcu, idx);
43484363
break;
43494364
case KVM_S390_SET_INITIAL_PSW: {
@@ -4355,8 +4370,17 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
43554370
r = kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw);
43564371
break;
43574372
}
4373+
case KVM_S390_CLEAR_RESET:
4374+
r = 0;
4375+
kvm_arch_vcpu_ioctl_clear_reset(vcpu);
4376+
break;
43584377
case KVM_S390_INITIAL_RESET:
4359-
r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
4378+
r = 0;
4379+
kvm_arch_vcpu_ioctl_initial_reset(vcpu);
4380+
break;
4381+
case KVM_S390_NORMAL_RESET:
4382+
r = 0;
4383+
kvm_arch_vcpu_ioctl_normal_reset(vcpu);
43604384
break;
43614385
case KVM_SET_ONE_REG:
43624386
case KVM_GET_ONE_REG: {

arch/x86/include/asm/kvm_host.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
#define KVM_REQ_HV_STIMER KVM_ARCH_REQ(22)
7979
#define KVM_REQ_LOAD_EOI_EXITMAP KVM_ARCH_REQ(23)
8080
#define KVM_REQ_GET_VMCS12_PAGES KVM_ARCH_REQ(24)
81+
#define KVM_REQ_APICV_UPDATE \
82+
KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
8183

8284
#define CR0_RESERVED_BITS \
8385
(~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
@@ -873,6 +875,12 @@ enum kvm_irqchip_mode {
873875
KVM_IRQCHIP_SPLIT, /* created with KVM_CAP_SPLIT_IRQCHIP */
874876
};
875877

878+
#define APICV_INHIBIT_REASON_DISABLE 0
879+
#define APICV_INHIBIT_REASON_HYPERV 1
880+
#define APICV_INHIBIT_REASON_NESTED 2
881+
#define APICV_INHIBIT_REASON_IRQWIN 3
882+
#define APICV_INHIBIT_REASON_PIT_REINJ 4
883+
876884
struct kvm_arch {
877885
unsigned long n_used_mmu_pages;
878886
unsigned long n_requested_mmu_pages;
@@ -904,6 +912,7 @@ struct kvm_arch {
904912
struct kvm_apic_map *apic_map;
905913

906914
bool apic_access_page_done;
915+
unsigned long apicv_inhibit_reasons;
907916

908917
gpa_t wall_clock;
909918

@@ -1118,7 +1127,8 @@ struct kvm_x86_ops {
11181127
void (*enable_nmi_window)(struct kvm_vcpu *vcpu);
11191128
void (*enable_irq_window)(struct kvm_vcpu *vcpu);
11201129
void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr);
1121-
bool (*get_enable_apicv)(struct kvm *kvm);
1130+
bool (*check_apicv_inhibit_reasons)(ulong bit);
1131+
void (*pre_update_apicv_exec_ctrl)(struct kvm *kvm, bool activate);
11221132
void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu);
11231133
void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr);
11241134
void (*hwapic_isr_update)(struct kvm_vcpu *vcpu, int isr);
@@ -1477,7 +1487,11 @@ gpa_t kvm_mmu_gva_to_gpa_write(struct kvm_vcpu *vcpu, gva_t gva,
14771487
gpa_t kvm_mmu_gva_to_gpa_system(struct kvm_vcpu *vcpu, gva_t gva,
14781488
struct x86_exception *exception);
14791489

1480-
void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu);
1490+
bool kvm_apicv_activated(struct kvm *kvm);
1491+
void kvm_apicv_init(struct kvm *kvm, bool enable);
1492+
void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu);
1493+
void kvm_request_apicv_update(struct kvm *kvm, bool activate,
1494+
unsigned long bit);
14811495

14821496
int kvm_emulate_hypercall(struct kvm_vcpu *vcpu);
14831497

arch/x86/include/asm/vmx.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
/*
2323
* Definitions of Primary Processor-Based VM-Execution Controls.
2424
*/
25-
#define CPU_BASED_INTR_WINDOW_EXITING VMCS_CONTROL_BIT(VIRTUAL_INTR_PENDING)
26-
#define CPU_BASED_USE_TSC_OFFSETTING VMCS_CONTROL_BIT(TSC_OFFSETTING)
25+
#define CPU_BASED_INTR_WINDOW_EXITING VMCS_CONTROL_BIT(INTR_WINDOW_EXITING)
26+
#define CPU_BASED_USE_TSC_OFFSETTING VMCS_CONTROL_BIT(USE_TSC_OFFSETTING)
2727
#define CPU_BASED_HLT_EXITING VMCS_CONTROL_BIT(HLT_EXITING)
2828
#define CPU_BASED_INVLPG_EXITING VMCS_CONTROL_BIT(INVLPG_EXITING)
2929
#define CPU_BASED_MWAIT_EXITING VMCS_CONTROL_BIT(MWAIT_EXITING)
@@ -34,7 +34,7 @@
3434
#define CPU_BASED_CR8_LOAD_EXITING VMCS_CONTROL_BIT(CR8_LOAD_EXITING)
3535
#define CPU_BASED_CR8_STORE_EXITING VMCS_CONTROL_BIT(CR8_STORE_EXITING)
3636
#define CPU_BASED_TPR_SHADOW VMCS_CONTROL_BIT(VIRTUAL_TPR)
37-
#define CPU_BASED_NMI_WINDOW_EXITING VMCS_CONTROL_BIT(VIRTUAL_NMI_PENDING)
37+
#define CPU_BASED_NMI_WINDOW_EXITING VMCS_CONTROL_BIT(NMI_WINDOW_EXITING)
3838
#define CPU_BASED_MOV_DR_EXITING VMCS_CONTROL_BIT(MOV_DR_EXITING)
3939
#define CPU_BASED_UNCOND_IO_EXITING VMCS_CONTROL_BIT(UNCOND_IO_EXITING)
4040
#define CPU_BASED_USE_IO_BITMAPS VMCS_CONTROL_BIT(USE_IO_BITMAPS)

arch/x86/include/asm/vmxfeatures.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#define VMX_FEATURE_EPTP_SWITCHING ( 0*32+ 28) /* EPTP switching (in guest) */
3535

3636
/* Primary Processor-Based VM-Execution Controls, word 1 */
37-
#define VMX_FEATURE_VIRTUAL_INTR_PENDING ( 1*32+ 2) /* "" VM-Exit if INTRs are unblocked in guest */
38-
#define VMX_FEATURE_TSC_OFFSETTING ( 1*32+ 3) /* "tsc_offset" Offset hardware TSC when read in guest */
37+
#define VMX_FEATURE_INTR_WINDOW_EXITING ( 1*32+ 2) /* "" VM-Exit if INTRs are unblocked in guest */
38+
#define VMX_FEATURE_USE_TSC_OFFSETTING ( 1*32+ 3) /* "tsc_offset" Offset hardware TSC when read in guest */
3939
#define VMX_FEATURE_HLT_EXITING ( 1*32+ 7) /* "" VM-Exit on HLT */
4040
#define VMX_FEATURE_INVLPG_EXITING ( 1*32+ 9) /* "" VM-Exit on INVLPG */
4141
#define VMX_FEATURE_MWAIT_EXITING ( 1*32+ 10) /* "" VM-Exit on MWAIT */
@@ -46,7 +46,7 @@
4646
#define VMX_FEATURE_CR8_LOAD_EXITING ( 1*32+ 19) /* "" VM-Exit on writes to CR8 */
4747
#define VMX_FEATURE_CR8_STORE_EXITING ( 1*32+ 20) /* "" VM-Exit on reads from CR8 */
4848
#define VMX_FEATURE_VIRTUAL_TPR ( 1*32+ 21) /* "vtpr" TPR virtualization, a.k.a. TPR shadow */
49-
#define VMX_FEATURE_VIRTUAL_NMI_PENDING ( 1*32+ 22) /* "" VM-Exit if NMIs are unblocked in guest */
49+
#define VMX_FEATURE_NMI_WINDOW_EXITING ( 1*32+ 22) /* "" VM-Exit if NMIs are unblocked in guest */
5050
#define VMX_FEATURE_MOV_DR_EXITING ( 1*32+ 23) /* "" VM-Exit on accesses to debug registers */
5151
#define VMX_FEATURE_UNCOND_IO_EXITING ( 1*32+ 24) /* "" VM-Exit on *all* IN{S} and OUT{S}*/
5252
#define VMX_FEATURE_USE_IO_BITMAPS ( 1*32+ 25) /* "" VM-Exit based on I/O port */

arch/x86/kernel/kvm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,9 @@ static __init int kvm_setup_pv_tlb_flush(void)
736736
{
737737
int cpu;
738738

739+
if (!kvm_para_available() || nopv)
740+
return 0;
741+
739742
if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
740743
!kvm_para_has_hint(KVM_HINTS_REALTIME) &&
741744
kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {

arch/x86/kvm/hyperv.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,10 @@ int kvm_hv_activate_synic(struct kvm_vcpu *vcpu, bool dont_zero_synic_pages)
776776

777777
/*
778778
* Hyper-V SynIC auto EOI SINT's are
779-
* not compatible with APICV, so deactivate APICV
779+
* not compatible with APICV, so request
780+
* to deactivate APICV permanently.
780781
*/
781-
kvm_vcpu_deactivate_apicv(vcpu);
782+
kvm_request_apicv_update(vcpu->kvm, false, APICV_INHIBIT_REASON_HYPERV);
782783
synic->active = true;
783784
synic->dont_zero_synic_pages = dont_zero_synic_pages;
784785
return 0;

0 commit comments

Comments
 (0)