Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307873
b: refs/heads/master
c: 4138377
h: refs/heads/master
i:
  307871: bda7ee8
v: v3
  • Loading branch information
Gleb Natapov authored and Avi Kivity committed Apr 24, 2012
1 parent 8e9b635 commit 55849cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 07975ad3b30579ca27d880491ad992326b930c63
refs/heads/master: 413837714232b3a4c0705e915d8af75ad521d083
4 changes: 4 additions & 0 deletions trunk/arch/x86/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ enum {
#define DR7_FIXED_1 0x00000400
#define DR7_VOLATILE 0xffff23ff

/* apic attention bits */
#define KVM_APIC_CHECK_VAPIC 0

/*
* We don't want allocation failures within the mmu code, so we preallocate
* enough memory for a single page fault in a cache.
Expand Down Expand Up @@ -337,6 +340,7 @@ struct kvm_vcpu_arch {
u64 efer;
u64 apic_base;
struct kvm_lapic *apic; /* kernel irqchip context */
unsigned long apic_attention;
int32_t apic_arb_prio;
int mp_state;
int sipi_vector;
Expand Down
12 changes: 7 additions & 5 deletions trunk/arch/x86/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu)
apic_update_ppr(apic);

vcpu->arch.apic_arb_prio = 0;
vcpu->arch.apic_attention = 0;

apic_debug(KERN_INFO "%s: vcpu=%p, id=%d, base_msr="
"0x%016" PRIx64 ", base_address=0x%0lx.\n", __func__,
Expand Down Expand Up @@ -1287,7 +1288,7 @@ void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu)
u32 data;
void *vapic;

if (!irqchip_in_kernel(vcpu->kvm) || !vcpu->arch.apic->vapic_addr)
if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention))
return;

vapic = kmap_atomic(vcpu->arch.apic->vapic_page);
Expand All @@ -1304,7 +1305,7 @@ void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu)
struct kvm_lapic *apic;
void *vapic;

if (!irqchip_in_kernel(vcpu->kvm) || !vcpu->arch.apic->vapic_addr)
if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention))
return;

apic = vcpu->arch.apic;
Expand All @@ -1324,10 +1325,11 @@ void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu)

void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr)
{
if (!irqchip_in_kernel(vcpu->kvm))
return;

vcpu->arch.apic->vapic_addr = vapic_addr;
if (vapic_addr)
__set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);
else
__clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);
}

int kvm_x2apic_msr_write(struct kvm_vcpu *vcpu, u32 msr, u64 data)
Expand Down

0 comments on commit 55849cf

Please sign in to comment.