From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Cc: "Dong, Eddie" <eddie.dong@intel.com>,
Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: Configuration of nestedhvm
Date: Fri, 8 Oct 2010 10:44:15 +0200 [thread overview]
Message-ID: <201010081044.17176.Christoph.Egger@amd.com> (raw)
In-Reply-To: <1A42CE6F5F474C41B63392A5F80372B22DBEA36C@shsmsx501.ccr.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4683 bytes --]
Eddie,
you can simplify the second patch with attached patch merged
and is correct for AMD side.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Christoph
On Friday 08 October 2010 06:34:14 Dong, Eddie wrote:
> Keir:
> Despite of the negotioatiom of nested virtualization wrapper, here
> comes with the global configuration parameter and the CR4 layout handling
> between SVM & VMX. These are wrapper neutral IMO.
>
> Thx, Eddie
>
>
>
> ===Patch1
>
> Nested virtualization usage model is emerging, however we must guarantee it
> won't impact the performance of simple virtualization. This patch add an
> boot parameter for nested virtualization, which is disabled by default for
> now.
>
> Signed-off-by: Eddie Dong <eddie.dong@intel.com>
>
>
> diff -r 1385b15e168f xen/arch/x86/hvm/hvm.c
> --- a/xen/arch/x86/hvm/hvm.c Wed Oct 06 17:38:15 2010 +0100
> +++ b/xen/arch/x86/hvm/hvm.c Fri Oct 08 10:29:38 2010 +0800
> @@ -66,6 +66,9 @@ unsigned int opt_hvm_debug_level __read_
> unsigned int opt_hvm_debug_level __read_mostly;
> integer_param("hvm_debug", opt_hvm_debug_level);
>
> +unsigned int enable_nested_hvm __read_mostly;
> +integer_param("nested_hvm", enable_nested_hvm);
> +
> struct hvm_function_table hvm_funcs __read_mostly;
>
> /* I/O permission bitmap is globally shared by all HVM guests. */
> diff -r 1385b15e168f xen/include/asm-x86/hvm/hvm.h
> --- a/xen/include/asm-x86/hvm/hvm.h Wed Oct 06 17:38:15 2010 +0100
> +++ b/xen/include/asm-x86/hvm/hvm.h Fri Oct 08 10:35:03 2010 +0800
> @@ -250,6 +250,9 @@ hvm_set_segment_register(struct vcpu *v,
> #define is_viridian_domain(_d)
> \ (is_hvm_domain(_d) && ((_d)->arch.hvm_domain.params[HVM_PARAM_VIRIDIAN]))
>
> +/* TODO: handle per domain configuration */
> +#define is_nestedhvm(_d) (enable_nested_hvm && is_hvm_domain(_d))
> +
> void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
> unsigned int *ecx, unsigned int *edx);
> void hvm_migrate_timers(struct vcpu *v);
>
>
> ===Patch2
>
> This patch solves the CR4 bit (VMXE) format difference between AMD & Intel
> processor.
>
> Signed-off-by: Qing He <qing.he@intel.com>
> Signed-off-by: Eddie Dong <eddie.dong@intel.com>
>
> diff -r 1385b15e168f xen/arch/x86/hvm/hvm.c
> --- a/xen/arch/x86/hvm/hvm.c Wed Oct 06 17:38:15 2010 +0100
> +++ b/xen/arch/x86/hvm/hvm.c Fri Oct 08 10:46:55 2010 +0800
> @@ -630,6 +630,11 @@ static int hvm_load_cpu_ctxt(struct doma
> struct hvm_hw_cpu ctxt;
> struct segment_register seg;
> struct vcpu_guest_context *vc;
> + unsigned long rsv_bits = HVM_CR4_GUEST_RESERVED_BITS;
> +
> + if ( !is_nestedhvm(d) ||
> + boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
> + rsv_bits |= X86_CR4_VMXE;
>
> /* Which vcpu is this? */
> vcpuid = hvm_load_instance(h);
> @@ -662,7 +667,7 @@ static int hvm_load_cpu_ctxt(struct doma
> return -EINVAL;
> }
>
> - if ( ctxt.cr4 & HVM_CR4_GUEST_RESERVED_BITS )
> + if ( ctxt.cr4 & rsv_bits )
> {
> gdprintk(XENLOG_ERR, "HVM restore: bad CR4 0x%"PRIx64"\n",
> ctxt.cr4);
> @@ -1243,8 +1248,12 @@ int hvm_set_cr4(unsigned long value)
> {
> struct vcpu *v = current;
> unsigned long old_cr;
> -
> - if ( value & HVM_CR4_GUEST_RESERVED_BITS )
> + unsigned long rsv_bits = HVM_CR4_GUEST_RESERVED_BITS;
> +
> + if ( !is_nestedhvm(v->domain) ||
> + boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
> + rsv_bits |= X86_CR4_VMXE;
> + if ( value & rsv_bits )
> {
> HVM_DBG_LOG(DBG_LEVEL_1,
> "Guest attempts to set reserved bit in CR4: %lx",
> diff -r 1385b15e168f xen/include/asm-x86/hvm/hvm.h
> --- a/xen/include/asm-x86/hvm/hvm.h Wed Oct 06 17:38:15 2010 +0100
> +++ b/xen/include/asm-x86/hvm/hvm.h Fri Oct 08 10:46:35 2010 +0800
> @@ -291,7 +291,8 @@ static inline int hvm_do_pmu_interrupt(s
> X86_CR4_DE | X86_CR4_PSE | X86_CR4_PAE | \
> X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
> X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | \
> - (cpu_has_xsave ? X86_CR4_OSXSAVE : 0))))
> + (cpu_has_xsave ? X86_CR4_OSXSAVE : 0))) | \
> + X86_CR4_VMXE)
>
> /* These exceptions must always be intercepted. */
> #define HVM_TRAP_MASK ((1U << TRAP_machine_check) | (1U <<
> TRAP_invalid_op))
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_vmx_enable.diff --]
[-- Type: text/x-diff, Size: 988 bytes --]
diff -r b1ace8d2143c -r 325392ae335f xen/include/asm-x86/cpufeature.h
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -201,6 +201,8 @@
#define cpu_has_svm boot_cpu_has(X86_FEATURE_SVME)
+#define cpu_has_vmx boot_cpu_has(X86_FEATURE_VMXE)
+
#endif /* __ASM_I386_CPUFEATURE_H */
/*
diff -r b1ace8d2143c -r 325392ae335f xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -315,7 +315,8 @@ static inline int hvm_do_pmu_interrupt(s
X86_CR4_DE | X86_CR4_PSE | X86_CR4_PAE | \
X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | \
- (cpu_has_xsave ? X86_CR4_OSXSAVE : 0))))
+ (cpu_has_xsave ? X86_CR4_OSXSAVE : 0) | \
+ (cpu_has_vmx ? X86_CR4_VMXE : 0))))
/* These exceptions must always be intercepted. */
#define HVM_TRAP_MASK ((1U << TRAP_machine_check) | (1U << TRAP_invalid_op))
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2010-10-08 8:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 0:28 build break in xl.c in python Kay, Allen M
2010-10-08 4:34 ` Configuration of nestedhvm Dong, Eddie
2010-10-08 7:12 ` Keir Fraser
2010-10-08 7:56 ` Dong, Eddie
2010-10-08 8:15 ` Keir Fraser
2010-10-08 8:22 ` Keir Fraser
2010-10-08 8:47 ` Dong, Eddie
2010-10-08 11:29 ` Keir Fraser
2010-10-08 8:44 ` Christoph Egger [this message]
2010-10-08 8:54 ` Dong, Eddie
2010-10-08 10:02 ` Christoph Egger
2010-10-08 13:33 ` Dong, Eddie
2010-10-08 13:48 ` Christoph Egger
2010-10-09 2:54 ` add missing VMCS definition Dong, Eddie
2010-10-08 8:28 ` build break in xl.c in python Gianni Tedesco
2010-10-08 8:33 ` Gianni Tedesco
2010-10-08 10:43 ` Stefano Stabellini
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=201010081044.17176.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=eddie.dong@intel.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.