Skip to content

Commit

Permalink
KVM: lapic: Split out x2apic ldr calculation
Browse files Browse the repository at this point in the history
Split out the ldr calculation from kvm_apic_set_x2apic_id
since we're about to reuse it in the following patch.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
dagrh authored and bonzini committed Nov 27, 2017
1 parent c4ad77e commit e872fa9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/x86/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ static inline void kvm_apic_set_ldr(struct kvm_lapic *apic, u32 id)
recalculate_apic_map(apic->vcpu->kvm);
}

static inline u32 kvm_apic_calc_x2apic_ldr(u32 id)
{
return ((id >> 4) << 16) | (1 << (id & 0xf));
}

static inline void kvm_apic_set_x2apic_id(struct kvm_lapic *apic, u32 id)
{
u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf));
u32 ldr = kvm_apic_calc_x2apic_ldr(id);

WARN_ON_ONCE(id != apic->vcpu->vcpu_id);

Expand Down

0 comments on commit e872fa9

Please sign in to comment.