All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nitin A Kamble <nitin.a.kamble@intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>, jun.nakajima@intel.com
Subject: Re: [patch] VMX Unrestricted mode support
Date: Wed, 03 Jun 2009 11:18:10 -0700	[thread overview]
Message-ID: <1244053090.26481.25.camel@mukti.sc.intel.com> (raw)
In-Reply-To: <1244052535.26481.22.camel@mukti.sc.intel.com>

Avi,
   I also tested the qemu change is not affecting vm86 (no unrestricted
guest) code path.

Thanks & Regards,
Nitin


On Wed, 2009-06-03 at 11:08 -0700, Nitin A Kamble wrote:
> Hi Avi,
>   I find that the qemu processor reset state is not per the IA32
> processor specifications. (Sections 8.1.1 of
> http://www.intel.com/Assets/PDF/manual/253668.pdf)
> 
> In qemu-kvm.git in file target-i386/helper.c in function cpu_reset the
> segment registers are initialized as follows:
> 
> cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff,
>                            DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | 
> 				DESC_R_MASK);
> cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff,
>                            DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff,
>                            DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff,
>                            DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff,
>                            DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff,
>                            DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> 
> While the IA32 cpu reset state specification says that Segment Accessed
> bit is also 1 at the time of cpu reset. so the above code should look
> like this:
> 
> cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff,
>                  DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | 
>                  DESC_R_MASK | DESC_A_MASK);
> cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff,
>                  DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK);
> cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff,
>                  DESC_P_MASK | DESC_S_MASK | DESC_W_MASK| DESC_A_MASK);
> cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff,
>                  DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |DESC_A_MASK);
> cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff,
>                  DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff,
>                  DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
> 
> This discrepancy is adding the need of the following function in the
> unrestricted guest patch.
> 
> +static inline u32 get_segment_ar(int seg)
> +{
> +       if (!enable_unrestricted_guest)
> +               return 0xf3;
> +
> +       switch (seg) {
> +       case VCPU_SREG_CS:
> +               return 0x9b;
> +       case VCPU_SREG_TR:
> +               return 0x8b;
> +       case VCPU_SREG_LDTR:
> +               return 0x82;
> +       default:
> +               return 0x93;
> +       }
> +}
> +
> 
> For the unrestricted guest support either we can fix this discrepancy in
> the qemu code, or have a functionality like get_segment_ar() in the kvm
> vmx code. 
>   what do you suggest ?
> 
> Thanks & Regards,
> Nitin
> 					                       
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2009-06-03 18:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28 23:11 [patch] VMX Unrestricted mode support Nitin A Kamble
2009-05-28 23:39 ` Alexey Eremenko
2009-05-29  4:04   ` [patch] VMX Unrestricted guest " Nitin A Kamble
2009-05-31  8:39 ` [patch] VMX Unrestricted " Avi Kivity
2009-06-01 18:06   ` Nitin A Kamble
2009-06-01 18:35     ` Nitin A Kamble
2009-06-01 18:38       ` Avi Kivity
2009-06-03 18:08         ` Nitin A Kamble
2009-06-03 18:18           ` Nitin A Kamble [this message]
2009-06-03 18:20           ` Avi Kivity
2009-06-04 18:13           ` Jan Kiszka
2009-05-31 15:23 ` Anthony Liguori
2009-05-31 16:01   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244053090.26481.25.camel@mukti.sc.intel.com \
    --to=nitin.a.kamble@intel.com \
    --cc=avi@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.