[Devel] [PATCH rh7 v1 05/36] kvm/x86: Use is_64_bit_mode() helper

Konstantin Khorenko khorenko at virtuozzo.com
Tue Feb 16 00:34:13 PST 2016


This is a part of

commit a449c7aa51e10c9bde0ea9bee4e682d6d067ebab
Author: Nadav Amit <namit at cs.technion.ac.il>
Date:   Wed Jun 18 17:19:24 2014 +0300

     KVM: x86: Hypercall handling does not considers opsize correctly

     Currently, the hypercall handling routine only considers LME as an indication
     to whether the guest uses 32/64-bit mode. This is incosistent with hyperv
     hypercalls handling and against the common sense of considering cs.l as well.
     This patch uses is_64_bit_mode instead of is_long_mode for that matter. In
     addition, the result is masked in respect to the guest execution mode. Last, it
     changes kvm_hv_hypercall to use is_64_bit_mode as well to simplify the code.

     Signed-off-by: Nadav Amit <namit at cs.technion.ac.il>
     Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>

What about other hunks of this commit?

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 02/10/2016 06:17 PM, Andrey Smetanin wrote:
> Signed-off-by: Andrey Smetanin <asmetanin at virtuozzo.com>
> ---
>   arch/x86/kvm/hyperv.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
> index 8102d69..a8160d2 100644
> --- a/arch/x86/kvm/hyperv.c
> +++ b/arch/x86/kvm/hyperv.c
> @@ -321,7 +321,6 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
>   	u64 param, ingpa, outgpa, ret;
>   	uint16_t code, rep_idx, rep_cnt, res = HV_STATUS_SUCCESS, rep_done = 0;
>   	bool fast, longmode;
> -	int cs_db, cs_l;
>
>   	/*
>   	 * hypercall generates UD from non zero cpl and real mode
> @@ -332,8 +331,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
>   		return 0;
>   	}
>
> -	kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
> -	longmode = is_long_mode(vcpu) && cs_l == 1;
> +	longmode = is_64_bit_mode(vcpu);
>
>   	if (!longmode) {
>   		param = ((u64)kvm_register_read(vcpu, VCPU_REGS_RDX) << 32) |
>


More information about the Devel mailing list