diff options
| -rw-r--r-- | arch/powerpc/kvm/book3s_xive.c | 5 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_xive.h | 1 | ||||
| -rw-r--r-- | arch/x86/include/asm/kvm_para.h | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/kvm.c | 14 | ||||
| -rw-r--r-- | arch/x86/kvm/Kconfig | 1 | ||||
| -rw-r--r-- | arch/x86/kvm/emulate.c | 6 | ||||
| -rw-r--r-- | arch/x86/kvm/mmu.c | 2 |
7 files changed, 20 insertions, 13 deletions
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c index 13304622ab1c..bf457843e032 100644 --- a/arch/powerpc/kvm/book3s_xive.c +++ b/arch/powerpc/kvm/book3s_xive.c | |||
| @@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, | |||
| 622 | return -EINVAL; | 622 | return -EINVAL; |
| 623 | state = &sb->irq_state[idx]; | 623 | state = &sb->irq_state[idx]; |
| 624 | arch_spin_lock(&sb->lock); | 624 | arch_spin_lock(&sb->lock); |
| 625 | *server = state->guest_server; | 625 | *server = state->act_server; |
| 626 | *priority = state->guest_priority; | 626 | *priority = state->guest_priority; |
| 627 | arch_spin_unlock(&sb->lock); | 627 | arch_spin_unlock(&sb->lock); |
| 628 | 628 | ||
| @@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr) | |||
| 1331 | xive->saved_src_count++; | 1331 | xive->saved_src_count++; |
| 1332 | 1332 | ||
| 1333 | /* Convert saved state into something compatible with xics */ | 1333 | /* Convert saved state into something compatible with xics */ |
| 1334 | val = state->guest_server; | 1334 | val = state->act_server; |
| 1335 | prio = state->saved_scan_prio; | 1335 | prio = state->saved_scan_prio; |
| 1336 | 1336 | ||
| 1337 | if (prio == MASKED) { | 1337 | if (prio == MASKED) { |
| @@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) | |||
| 1507 | /* First convert prio and mark interrupt as untargetted */ | 1507 | /* First convert prio and mark interrupt as untargetted */ |
| 1508 | act_prio = xive_prio_from_guest(guest_prio); | 1508 | act_prio = xive_prio_from_guest(guest_prio); |
| 1509 | state->act_priority = MASKED; | 1509 | state->act_priority = MASKED; |
| 1510 | state->guest_server = server; | ||
| 1511 | 1510 | ||
| 1512 | /* | 1511 | /* |
| 1513 | * We need to drop the lock due to the mutex below. Hopefully | 1512 | * We need to drop the lock due to the mutex below. Hopefully |
diff --git a/arch/powerpc/kvm/book3s_xive.h b/arch/powerpc/kvm/book3s_xive.h index 5938f7644dc1..6ba63f8e8a61 100644 --- a/arch/powerpc/kvm/book3s_xive.h +++ b/arch/powerpc/kvm/book3s_xive.h | |||
| @@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state { | |||
| 35 | struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ | 35 | struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ |
| 36 | 36 | ||
| 37 | /* Targetting as set by guest */ | 37 | /* Targetting as set by guest */ |
| 38 | u32 guest_server; /* Current guest selected target */ | ||
| 39 | u8 guest_priority; /* Guest set priority */ | 38 | u8 guest_priority; /* Guest set priority */ |
| 40 | u8 saved_priority; /* Saved priority when masking */ | 39 | u8 saved_priority; /* Saved priority when masking */ |
| 41 | 40 | ||
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index bc62e7cbf1b1..59ad3d132353 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h | |||
| @@ -88,7 +88,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, | |||
| 88 | bool kvm_para_available(void); | 88 | bool kvm_para_available(void); |
| 89 | unsigned int kvm_arch_para_features(void); | 89 | unsigned int kvm_arch_para_features(void); |
| 90 | void __init kvm_guest_init(void); | 90 | void __init kvm_guest_init(void); |
| 91 | void kvm_async_pf_task_wait(u32 token); | 91 | void kvm_async_pf_task_wait(u32 token, int interrupt_kernel); |
| 92 | void kvm_async_pf_task_wake(u32 token); | 92 | void kvm_async_pf_task_wake(u32 token); |
| 93 | u32 kvm_read_and_reset_pf_reason(void); | 93 | u32 kvm_read_and_reset_pf_reason(void); |
| 94 | extern void kvm_disable_steal_time(void); | 94 | extern void kvm_disable_steal_time(void); |
| @@ -103,7 +103,7 @@ static inline void kvm_spinlock_init(void) | |||
| 103 | 103 | ||
| 104 | #else /* CONFIG_KVM_GUEST */ | 104 | #else /* CONFIG_KVM_GUEST */ |
| 105 | #define kvm_guest_init() do {} while (0) | 105 | #define kvm_guest_init() do {} while (0) |
| 106 | #define kvm_async_pf_task_wait(T) do {} while(0) | 106 | #define kvm_async_pf_task_wait(T, I) do {} while(0) |
| 107 | #define kvm_async_pf_task_wake(T) do {} while(0) | 107 | #define kvm_async_pf_task_wake(T) do {} while(0) |
| 108 | 108 | ||
| 109 | static inline bool kvm_para_available(void) | 109 | static inline bool kvm_para_available(void) |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index e675704fa6f7..8bb9594d0761 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
| @@ -117,7 +117,11 @@ static struct kvm_task_sleep_node *_find_apf_task(struct kvm_task_sleep_head *b, | |||
| 117 | return NULL; | 117 | return NULL; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | void kvm_async_pf_task_wait(u32 token) | 120 | /* |
| 121 | * @interrupt_kernel: Is this called from a routine which interrupts the kernel | ||
| 122 | * (other than user space)? | ||
| 123 | */ | ||
| 124 | void kvm_async_pf_task_wait(u32 token, int interrupt_kernel) | ||
| 121 | { | 125 | { |
| 122 | u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); | 126 | u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); |
| 123 | struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; | 127 | struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; |
| @@ -140,8 +144,10 @@ void kvm_async_pf_task_wait(u32 token) | |||
| 140 | 144 | ||
| 141 | n.token = token; | 145 | n.token = token; |
| 142 | n.cpu = smp_processor_id(); | 146 | n.cpu = smp_processor_id(); |
| 143 | n.halted = is_idle_task(current) || preempt_count() > 1 || | 147 | n.halted = is_idle_task(current) || |
| 144 | rcu_preempt_depth(); | 148 | (IS_ENABLED(CONFIG_PREEMPT_COUNT) |
| 149 | ? preempt_count() > 1 || rcu_preempt_depth() | ||
| 150 | : interrupt_kernel); | ||
| 145 | init_swait_queue_head(&n.wq); | 151 | init_swait_queue_head(&n.wq); |
| 146 | hlist_add_head(&n.link, &b->list); | 152 | hlist_add_head(&n.link, &b->list); |
| 147 | raw_spin_unlock(&b->lock); | 153 | raw_spin_unlock(&b->lock); |
| @@ -269,7 +275,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
| 269 | case KVM_PV_REASON_PAGE_NOT_PRESENT: | 275 | case KVM_PV_REASON_PAGE_NOT_PRESENT: |
| 270 | /* page is swapped out by the host. */ | 276 | /* page is swapped out by the host. */ |
| 271 | prev_state = exception_enter(); | 277 | prev_state = exception_enter(); |
| 272 | kvm_async_pf_task_wait((u32)read_cr2()); | 278 | kvm_async_pf_task_wait((u32)read_cr2(), !user_mode(regs)); |
| 273 | exception_exit(prev_state); | 279 | exception_exit(prev_state); |
| 274 | break; | 280 | break; |
| 275 | case KVM_PV_REASON_PAGE_READY: | 281 | case KVM_PV_REASON_PAGE_READY: |
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index 3ea624452f93..3c48bc8bf08c 100644 --- a/arch/x86/kvm/Kconfig +++ b/arch/x86/kvm/Kconfig | |||
| @@ -23,6 +23,7 @@ config KVM | |||
| 23 | depends on HIGH_RES_TIMERS | 23 | depends on HIGH_RES_TIMERS |
| 24 | # for TASKSTATS/TASK_DELAY_ACCT: | 24 | # for TASKSTATS/TASK_DELAY_ACCT: |
| 25 | depends on NET && MULTIUSER | 25 | depends on NET && MULTIUSER |
| 26 | depends on X86_LOCAL_APIC | ||
| 26 | select PREEMPT_NOTIFIERS | 27 | select PREEMPT_NOTIFIERS |
| 27 | select MMU_NOTIFIER | 28 | select MMU_NOTIFIER |
| 28 | select ANON_INODES | 29 | select ANON_INODES |
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a36254cbf776..d90cdc77e077 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
| @@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)); | |||
| 425 | #op " %al \n\t" \ | 425 | #op " %al \n\t" \ |
| 426 | FOP_RET | 426 | FOP_RET |
| 427 | 427 | ||
| 428 | asm(".global kvm_fastop_exception \n" | 428 | asm(".pushsection .fixup, \"ax\"\n" |
| 429 | "kvm_fastop_exception: xor %esi, %esi; ret"); | 429 | ".global kvm_fastop_exception \n" |
| 430 | "kvm_fastop_exception: xor %esi, %esi; ret\n" | ||
| 431 | ".popsection"); | ||
| 430 | 432 | ||
| 431 | FOP_START(setcc) | 433 | FOP_START(setcc) |
| 432 | FOP_SETCC(seto) | 434 | FOP_SETCC(seto) |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index eca30c1eb1d9..106d4a029a8a 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -3837,7 +3837,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code, | |||
| 3837 | case KVM_PV_REASON_PAGE_NOT_PRESENT: | 3837 | case KVM_PV_REASON_PAGE_NOT_PRESENT: |
| 3838 | vcpu->arch.apf.host_apf_reason = 0; | 3838 | vcpu->arch.apf.host_apf_reason = 0; |
| 3839 | local_irq_disable(); | 3839 | local_irq_disable(); |
| 3840 | kvm_async_pf_task_wait(fault_address); | 3840 | kvm_async_pf_task_wait(fault_address, 0); |
| 3841 | local_irq_enable(); | 3841 | local_irq_enable(); |
| 3842 | break; | 3842 | break; |
| 3843 | case KVM_PV_REASON_PAGE_READY: | 3843 | case KVM_PV_REASON_PAGE_READY: |
