Re: [PATCH v3 4/5] KVM: X86: TSCDEADLINE MSR emulation fastpath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 24, 2020 at 02:22:43PM +0800, Wanpeng Li wrote:
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 4561104..99061ba 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1616,27 +1616,45 @@ static int handle_fastpath_set_x2apic_icr_irqoff(struct kvm_vcpu *vcpu, u64 data
>  	return 1;
>  }
>  
> +static int handle_fastpath_set_tscdeadline(struct kvm_vcpu *vcpu, u64 data)
> +{
> +	if (!kvm_x86_ops.set_hv_timer ||
> +		kvm_mwait_in_guest(vcpu->kvm) ||
> +		kvm_can_post_timer_interrupt(vcpu))

Bad indentation.

> +		return 1;
> +
> +	kvm_set_lapic_tscdeadline_msr(vcpu, data);
> +	return 0;
> +}
> +
>  enum exit_fastpath_completion handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu)
>  {
>  	u32 msr = kvm_rcx_read(vcpu);
>  	u64 data;
> -	int ret = 0;
> +	int ret = EXIT_FASTPATH_NONE;
>  
>  	switch (msr) {
>  	case APIC_BASE_MSR + (APIC_ICR >> 4):
>  		data = kvm_read_edx_eax(vcpu);
> -		ret = handle_fastpath_set_x2apic_icr_irqoff(vcpu, data);
> +		if (!handle_fastpath_set_x2apic_icr_irqoff(vcpu, data))
> +			ret = EXIT_FASTPATH_SKIP_EMUL_INS;
> +		break;
> +	case MSR_IA32_TSCDEADLINE:
> +		data = kvm_read_edx_eax(vcpu);
> +		if (!handle_fastpath_set_tscdeadline(vcpu, data))
> +			ret = EXIT_FASTPATH_CONT_RUN;
>  		break;
>  	default:
> -		return EXIT_FASTPATH_NONE;
> +		ret = EXIT_FASTPATH_NONE;
>  	}
>  
> -	if (!ret) {
> +	if (ret != EXIT_FASTPATH_NONE) {
>  		trace_kvm_msr_write(msr, data);
> -		return EXIT_FASTPATH_SKIP_EMUL_INS;
> +		if (ret == EXIT_FASTPATH_CONT_RUN)
> +			kvm_skip_emulated_instruction(vcpu);
>  	}
>  
> -	return EXIT_FASTPATH_NONE;
> +	return ret;
>  }
>  EXPORT_SYMBOL_GPL(handle_fastpath_set_msr_irqoff);
>  
> -- 
> 2.7.4
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux