All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jidong Xiao <jidong.xiao@gmail.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: question about "struct kvm_segment"
Date: Fri, 30 May 2014 22:49:51 +0200	[thread overview]
Message-ID: <5388EEEF.8080108@redhat.com> (raw)
In-Reply-To: <CAG4AFWbMxbGsLrd_pGzUmwfmq4E3BKDHCZN6xKKqMt2-1dHOXw@mail.gmail.com>

Il 20/05/2014 04:25, Jidong Xiao ha scritto:
> Hi,
>
> The structure kvm_segment is defined as follows:
>
> struct kvm_segment {
>         __u64 base;
>         __u32 limit;
>         __u16 selector;
>         __u8  type;
>         __u8  present, dpl, db, s, l, g, avl;
>         __u8  unusable;
>         __u8  padding;
> };
>
> Since the VMX spec defines base is 64 bits, limit is 32bits, selector
> is 16bits, understandably, __u64, __u32, __u16 is used for them
> respectively.
>
> However, the VMX spec defines that the access rights is 32bits, which
> includes a 4 bits type, 2 bits dpl, and 1 bit for the
> present,dpl,db,s,l,g,avl. So why here they are all defined as __u8? It
> means that, each of them is represented by 8bits? This looks
> inconsistent with the VMX spec.

This is not a VMX definition, it's part of the ioctl interface between 
KVM and user-mode programs.

For the conversion code see vmx_get_segment and vmx_set_segment.  These 
should be never called in hot paths, except unfortunately when doing 
nested virtualization.

Paolo

  reply	other threads:[~2014-05-30 20:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20  2:25 question about "struct kvm_segment" Jidong Xiao
2014-05-30 20:49 ` Paolo Bonzini [this message]
2014-06-01  1:41   ` Jidong Xiao

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=5388EEEF.8080108@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jidong.xiao@gmail.com \
    --cc=virtualization@lists.linux-foundation.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.