diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-11-17 12:52:49 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-11-27 17:32:52 +0100 |
commit | e872fa94662d0644057c7c80b3071bdb9249e5ab (patch) | |
tree | 7c88f3efd6ac26d71b838742b84cd865518ac866 /arch | |
parent | KVM: vmx: use X86_CR4_UMIP and X86_FEATURE_UMIP (diff) | |
download | linux-e872fa94662d0644057c7c80b3071bdb9249e5ab.tar.xz linux-e872fa94662d0644057c7c80b3071bdb9249e5ab.zip |
KVM: lapic: Split out x2apic ldr calculation
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 <dgilbert@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/lapic.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 943acbf00c69..e2edb1103002 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -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); |