Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d81bc7e authored by Yang Zhang's avatar Yang Zhang Committed by Marcelo Tosatti
Browse files

KVM: Call common update function when ioapic entry changed.



Both TMR and EOI exit bitmap need to be updated when ioapic changed
or vcpu's id/ldr/dfr changed. So use common function instead eoi exit
bitmap specific function.

Signed-off-by: default avatarYang Zhang <yang.z.zhang@Intel.com>
Reviewed-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 01e439be
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -27,10 +27,4 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq);
#define kvm_apic_present(x) (true)
#define kvm_lapic_enabled(x) (true)

static inline bool kvm_apic_vid_enabled(void)
{
	/* IA64 has no apicv supporting, do nothing here */
	return false;
}

#endif
+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ static void recalculate_apic_map(struct kvm *kvm)
	if (old)
		kfree_rcu(old, rcu);

	kvm_ioapic_make_eoibitmap_request(kvm);
	kvm_vcpu_request_scan_ioapic(kvm);
}

static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id)
+3 −0
Original line number Diff line number Diff line
@@ -6414,6 +6414,9 @@ static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)

static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
{
	if (!vmx_vm_has_apicv(vcpu->kvm))
		return;

	vmcs_write64(EOI_EXIT_BITMAP0, eoi_exit_bitmap[0]);
	vmcs_write64(EOI_EXIT_BITMAP1, eoi_exit_bitmap[1]);
	vmcs_write64(EOI_EXIT_BITMAP2, eoi_exit_bitmap[2]);
+7 −4
Original line number Diff line number Diff line
@@ -5661,13 +5661,16 @@ static void kvm_gen_update_masterclock(struct kvm *kvm)
#endif
}

static void update_eoi_exitmap(struct kvm_vcpu *vcpu)
static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
{
	u64 eoi_exit_bitmap[4];

	if (!kvm_apic_hw_enabled(vcpu->arch.apic))
		return;

	memset(eoi_exit_bitmap, 0, 32);

	kvm_ioapic_calculate_eoi_exitmap(vcpu, eoi_exit_bitmap);
	kvm_ioapic_scan_entry(vcpu, eoi_exit_bitmap);
	kvm_x86_ops->load_eoi_exitmap(vcpu, eoi_exit_bitmap);
}

@@ -5724,8 +5727,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
			kvm_handle_pmu_event(vcpu);
		if (kvm_check_request(KVM_REQ_PMI, vcpu))
			kvm_deliver_pmi(vcpu);
		if (kvm_check_request(KVM_REQ_EOIBITMAP, vcpu))
			update_eoi_exitmap(vcpu);
		if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu))
			vcpu_scan_ioapic(vcpu);
	}

	if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
+2 −2
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ static inline bool is_error_page(struct page *page)
#define KVM_REQ_MASTERCLOCK_UPDATE 19
#define KVM_REQ_MCLOCK_INPROGRESS 20
#define KVM_REQ_EPR_EXIT          21
#define KVM_REQ_EOIBITMAP         22
#define KVM_REQ_SCAN_IOAPIC       22

#define KVM_USERSPACE_IRQ_SOURCE_ID		0
#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
@@ -575,7 +575,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
void kvm_flush_remote_tlbs(struct kvm *kvm);
void kvm_reload_remote_mmus(struct kvm *kvm);
void kvm_make_mclock_inprogress_request(struct kvm *kvm);
void kvm_make_update_eoibitmap_request(struct kvm *kvm);
void kvm_make_scan_ioapic_request(struct kvm *kvm);

long kvm_arch_dev_ioctl(struct file *filp,
			unsigned int ioctl, unsigned long arg);
Loading