kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Matthias Lange <mlange@sec.t-labs.tu-berlin.de>
Cc: kvm@vger.kernel.org
Subject: Re: [RFC][PATCH] Add support for the GUEST_SMBASE VMCS field for Intel VT-x.
Date: Sun, 20 May 2012 15:39:30 +0300	[thread overview]
Message-ID: <4FB8E602.5030409@redhat.com> (raw)
In-Reply-To: <4FB61795.9080601@sec.t-labs.tu-berlin.de>

On 05/18/2012 12:34 PM, Matthias Lange wrote:
> Hi,
>
> I was playing around with kvm's nested virtualization feature on Intel
> VT-x. When trying to access the GUEST_SMBASE (offset 0x4828)field of the
> VMCS I got a "VMREAD/VMWRITE from/to unsupported VMCS component" error.
> According to the Intel manual this field is not optional. The error
> results from the "vmcs_field_to_offset" function in vmx.c because the
> offset of GUEST_SMBASE is not defined.
>
> The following patch adds support for the GUEST_SMBASE field. This allows
> hypervisors running inside kvm read/write access to this field. I have
> tested this to work on a Core i5 machine.
>
> diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
> index 31f180c..6a14720 100644
> --- a/arch/x86/include/asm/vmx.h
> +++ b/arch/x86/include/asm/vmx.h
> @@ -194,6 +194,7 @@ enum vmcs_field {
>  	GUEST_TR_AR_BYTES               = 0x00004822,
>  	GUEST_INTERRUPTIBILITY_INFO     = 0x00004824,
>  	GUEST_ACTIVITY_STATE            = 0X00004826,
> +	GUEST_SMBASE			= 0x00004828,
>  	GUEST_SYSENTER_CS               = 0x0000482A,
>  	HOST_IA32_SYSENTER_CS           = 0x00004c00,
>  	CR0_GUEST_HOST_MASK             = 0x00006000,
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 4ff0ab9..0063743 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -285,6 +285,7 @@ struct __packed vmcs12 {
>  	u32 guest_tr_ar_bytes;
>  	u32 guest_interruptibility_info;
>  	u32 guest_activity_state;
> +	u32 guest_smbase;
>  	u32 guest_sysenter_cs;
>  	u32 host_ia32_sysenter_cs;
>  	u32 padding32[8]; /* room for future expansion */
> @@ -546,6 +547,7 @@ static unsigned short vmcs_field_to_offset_table[] = {
>

vmcs12 is an ABI, so you can't insert fields at random.  Grab one from
padding32.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2012-05-20 12:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18  9:34 [RFC][PATCH] Add support for the GUEST_SMBASE VMCS field for Intel VT-x Matthias Lange
2012-05-20 12:39 ` Avi Kivity [this message]
2012-06-05 11:59   ` Matthias Lange
2012-06-05 13:09     ` Avi Kivity
2012-06-05 18:27       ` Matthias Lange
2012-06-06  7:55         ` 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=4FB8E602.5030409@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mlange@sec.t-labs.tu-berlin.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).