KVM: x86: use hardware-compatible format for APIC ID register
We currently always shift APIC ID as if APIC was in xAPIC mode. x2APIC mode wants to use more bits and storing a hardware-compabible value is the the sanest option. KVM API to set the lapic expects that bottom 8 bits of APIC ID are in top 8 bits of APIC_ID register, so the register needs to be shifted in x2APIC mode. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:

کامیت شده توسط
Paolo Bonzini

والد
3159d36ad7
کامیت
a92e2543d6
@@ -2779,15 +2779,17 @@ static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu,
|
||||
if (vcpu->arch.apicv_active)
|
||||
kvm_x86_ops->sync_pir_to_irr(vcpu);
|
||||
|
||||
memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s);
|
||||
|
||||
return 0;
|
||||
return kvm_apic_get_state(vcpu, s);
|
||||
}
|
||||
|
||||
static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
|
||||
struct kvm_lapic_state *s)
|
||||
{
|
||||
kvm_apic_post_state_restore(vcpu, s);
|
||||
int r;
|
||||
|
||||
r = kvm_apic_set_state(vcpu, s);
|
||||
if (r)
|
||||
return r;
|
||||
update_cr8_intercept(vcpu);
|
||||
|
||||
return 0;
|
||||
|
مرجع در شماره جدید
Block a user