* [PATCH 01/13] Nested Virtualization: tools
@ 2010-09-01 14:54 Christoph Egger
2010-09-03 7:54 ` Dong, Eddie
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Egger @ 2010-09-01 14:54 UTC (permalink / raw)
To: xen-devel@lists.xensource.com; +Cc: Dong, Eddie, Tim Deegan
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---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_nh01_tools.diff --]
[-- Type: text/x-diff, Size: 7335 bytes --]
# HG changeset patch
# User cegger
# Date 1283345869 -7200
tools: Add nestedhvm guest config option
diff -r 80ef08613ec2 -r ecec3d163efa tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -30,7 +30,7 @@
#define set_bit(idx, dst) ((dst) |= (1u << ((idx) & 31)))
#define DEF_MAX_BASE 0x0000000du
-#define DEF_MAX_EXT 0x80000008u
+#define DEF_MAX_EXT 0x8000000au
static int hypervisor_is_64bit(xc_interface *xch)
{
@@ -78,7 +78,7 @@ static void xc_cpuid_brand_get(char *str
static void amd_xc_cpuid_policy(
xc_interface *xch, domid_t domid,
const unsigned int *input, unsigned int *regs,
- int is_pae)
+ int is_pae, int is_nestedhvm)
{
switch ( input[0] )
{
@@ -97,6 +97,7 @@ static void amd_xc_cpuid_policy(
/* Filter all other features according to a whitelist. */
regs[2] &= ((is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
bitmaskof(X86_FEATURE_CMP_LEGACY) |
+ (is_nestedhvm ? bitmaskof(X86_FEATURE_SVME) : 0) |
bitmaskof(X86_FEATURE_ALTMOVCR) |
bitmaskof(X86_FEATURE_ABM) |
bitmaskof(X86_FEATURE_SSE4A) |
@@ -121,13 +122,43 @@ static void amd_xc_cpuid_policy(
*/
regs[2] = ((regs[2] & 0xf000u) + 1) | ((regs[2] & 0xffu) << 1) | 1u;
break;
+
+ case 0x8000000a: {
+ uint32_t edx;
+
+ if (!is_nestedhvm) {
+ regs[0] = regs[1] = regs[2] = regs[3] = 0;
+ break;
+ }
+
+#define SVM_FEATURE_NPT 0x00000001
+#define SVM_FEATURE_LBRV 0x00000002
+#define SVM_FEATURE_SVML 0x00000004
+#define SVM_FEATURE_NRIPS 0x00000008
+#define SVM_FEATURE_PAUSEFILTER 0x00000400
+
+ /* Only passthrough SVM features which are implemented */
+ edx = 0;
+ if (regs[3] & SVM_FEATURE_NPT)
+ edx |= SVM_FEATURE_NPT;
+ if (regs[3] & SVM_FEATURE_LBRV)
+ edx |= SVM_FEATURE_LBRV;
+ if (regs[3] & SVM_FEATURE_NRIPS)
+ edx |= SVM_FEATURE_NRIPS;
+ if (regs[3] & SVM_FEATURE_PAUSEFILTER)
+ edx |= SVM_FEATURE_PAUSEFILTER;
+
+ regs[3] = edx;
+ break;
+ }
+
}
}
static void intel_xc_cpuid_policy(
xc_interface *xch, domid_t domid,
const unsigned int *input, unsigned int *regs,
- int is_pae)
+ int is_pae, int is_nestedhvm)
{
switch ( input[0] )
{
@@ -161,6 +192,11 @@ static void intel_xc_cpuid_policy(
/* Mask AMD Number of Cores information. */
regs[2] = 0;
break;
+
+ case 0x8000000a:
+ /* Clear AMD SVM feature bits */
+ regs[0] = regs[1] = regs[2] = regs[3] = 0;
+ break;
}
}
@@ -169,12 +205,17 @@ static void xc_cpuid_hvm_policy(
const unsigned int *input, unsigned int *regs)
{
char brand[13];
+ unsigned long nestedhvm;
unsigned long pae;
int is_pae;
+ int is_nestedhvm;
xc_get_hvm_param(xch, domid, HVM_PARAM_PAE_ENABLED, &pae);
is_pae = !!pae;
+ xc_get_hvm_param(xch, domid, HVM_PARAM_NESTEDHVM, &nestedhvm);
+ is_nestedhvm = !!nestedhvm;
+
switch ( input[0] )
{
case 0x00000000:
@@ -260,6 +301,7 @@ static void xc_cpuid_hvm_policy(
case 0x80000004: /* ... continued */
case 0x80000005: /* AMD L1 cache/TLB info (dumped by Intel policy) */
case 0x80000006: /* AMD L2/3 cache/TLB info ; Intel L2 cache features */
+ case 0x8000000a: /* AMD SVM feature bits */
break;
default:
@@ -269,9 +311,9 @@ static void xc_cpuid_hvm_policy(
xc_cpuid_brand_get(brand);
if ( strstr(brand, "AMD") )
- amd_xc_cpuid_policy(xch, domid, input, regs, is_pae);
+ amd_xc_cpuid_policy(xch, domid, input, regs, is_pae, is_nestedhvm);
else
- intel_xc_cpuid_policy(xch, domid, input, regs, is_pae);
+ intel_xc_cpuid_policy(xch, domid, input, regs, is_pae, is_nestedhvm);
}
diff -r 80ef08613ec2 -r ecec3d163efa tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -185,6 +185,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
'vhpt': int,
'guest_os_type': str,
'hap': int,
+ 'nestedhvm' : int,
'xen_extended_power_mgmt': int,
'pci_msitranslate': int,
'pci_power_mgmt': int,
diff -r 80ef08613ec2 -r ecec3d163efa tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py
+++ b/tools/python/xen/xend/XendConstants.py
@@ -52,6 +52,7 @@ HVM_PARAM_TIMER_MODE = 10
HVM_PARAM_HPET_ENABLED = 11
HVM_PARAM_ACPI_S_STATE = 14
HVM_PARAM_VPT_ALIGN = 16
+HVM_PARAM_NESTEDHVM = 19 # x86
restart_modes = [
"restart",
diff -r 80ef08613ec2 -r ecec3d163efa tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -2585,10 +2585,15 @@ class XendDomainInfo:
xc.hvm_set_param(self.domid, HVM_PARAM_TIMER_MODE,
long(timer_mode))
- # Set Viridian interface configuration of domain
- viridian = self.info["platform"].get("viridian")
- if arch.type == "x86" and hvm and viridian is not None:
- xc.hvm_set_param(self.domid, HVM_PARAM_VIRIDIAN, long(viridian))
+ if arch.type == "x86" and hvm:
+ # Set Viridian interface configuration of domain
+ viridian = self.info["platform"].get("viridian")
+ if viridian is not None:
+ xc.hvm_set_param(self.domid, HVM_PARAM_VIRIDIAN, long(viridian))
+ # Set nestedhvm of domain
+ nestedhvm = self.info["platform"].get("nestedhvm")
+ if nestedhvm is not None:
+ xc.hvm_set_param(self.domid, HVM_PARAM_NESTEDHVM, long(nestedhvm))
# If nomigrate is set, disable migration
nomigrate = self.info["platform"].get("nomigrate")
diff -r 80ef08613ec2 -r ecec3d163efa tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -633,6 +633,11 @@ gopts.var('hap', val='HAP',
use="""Hap status (0=hap is disabled;
1=hap is enabled.""")
+gopts.var('nestedhvm', val='NESTEDHVM',
+ fn=set_int, default=0,
+ use="""Nested HVM status (0=Nested HVM is disabled;
+ 1=Nested HVM is enabled.""")
+
gopts.var('s3_integrity', val='TBOOT_MEMORY_PROTECT',
fn=set_int, default=1,
use="""Should domain memory integrity be verified during S3?
@@ -1083,7 +1088,7 @@ def configure_hvm(config_image, vals):
'isa',
'keymap',
'localtime',
- 'nographic',
+ 'nestedhvm', 'nographic',
'opengl', 'oos',
'pae', 'pci', 'pci_msitranslate', 'pci_power_mgmt',
'rtc_timeoffset',
diff -r 80ef08613ec2 -r ecec3d163efa xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -113,6 +113,9 @@
#define HVM_PARAM_CONSOLE_PFN 17
#define HVM_PARAM_CONSOLE_EVTCHN 18
-#define HVM_NR_PARAMS 19
+/* Boolean: Enable nestedhvm */
+#define HVM_PARAM_NESTEDHVM 19
+
+#define HVM_NR_PARAMS 20
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 01/13] Nested Virtualization: tools
2010-09-01 14:54 Christoph Egger
@ 2010-09-03 7:54 ` Dong, Eddie
0 siblings, 0 replies; 9+ messages in thread
From: Dong, Eddie @ 2010-09-03 7:54 UTC (permalink / raw)
To: Christoph Egger, xen-devel@lists.xensource.com; +Cc: Dong, Eddie, Tim Deegan
Dong, Eddie wrote:
> # HG changeset patch
> # User cegger
> # Date 1283345869 -7200
> tools: Add nestedhvm guest config option
>
> diff -r 80ef08613ec2 -r ecec3d163efa tools/libxc/xc_cpuid_x86.c
> --- a/tools/libxc/xc_cpuid_x86.c
> +++ b/tools/libxc/xc_cpuid_x86.c
> @@ -30,7 +30,7 @@
> #define set_bit(idx, dst) ((dst) |= (1u << ((idx) & 31)))
>
> #define DEF_MAX_BASE 0x0000000du
> -#define DEF_MAX_EXT 0x80000008u
> +#define DEF_MAX_EXT 0x8000000au
How can this make Intel CPU happy?
You may refer to my previous comments in V2.
>
> static int hypervisor_is_64bit(xc_interface *xch)
> {
> @@ -78,7 +78,7 @@ static void xc_cpuid_brand_get(char *str
> static void amd_xc_cpuid_policy(
> xc_interface *xch, domid_t domid,
> const unsigned int *input, unsigned int *regs,
> - int is_pae)
> + int is_pae, int is_nestedhvm)
> {
> switch ( input[0] )
> {
> @@ -97,6 +97,7 @@ static void amd_xc_cpuid_policy(
> /* Filter all other features according to a whitelist. */
> regs[2] &= ((is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
> bitmaskof(X86_FEATURE_CMP_LEGACY) |
> + (is_nestedhvm ? bitmaskof(X86_FEATURE_SVME) : 0)
> | bitmaskof(X86_FEATURE_ALTMOVCR) |
> bitmaskof(X86_FEATURE_ABM) |
> bitmaskof(X86_FEATURE_SSE4A) |
> @@ -121,13 +122,43 @@ static void amd_xc_cpuid_policy(
> */
> regs[2] = ((regs[2] & 0xf000u) + 1) | ((regs[2] & 0xffu) <<
> 1) | 1u; break;
> +
> + case 0x8000000a: {
> + uint32_t edx;
> +
> + if (!is_nestedhvm) {
> + regs[0] = regs[1] = regs[2] = regs[3] = 0;
> + break;
> + }
> +
> +#define SVM_FEATURE_NPT 0x00000001
> +#define SVM_FEATURE_LBRV 0x00000002
> +#define SVM_FEATURE_SVML 0x00000004
> +#define SVM_FEATURE_NRIPS 0x00000008
> +#define SVM_FEATURE_PAUSEFILTER 0x00000400
> +
> + /* Only passthrough SVM features which are implemented */
> + edx = 0;
> + if (regs[3] & SVM_FEATURE_NPT)
> + edx |= SVM_FEATURE_NPT;
> + if (regs[3] & SVM_FEATURE_LBRV)
> + edx |= SVM_FEATURE_LBRV;
> + if (regs[3] & SVM_FEATURE_NRIPS)
> + edx |= SVM_FEATURE_NRIPS;
> + if (regs[3] & SVM_FEATURE_PAUSEFILTER)
> + edx |= SVM_FEATURE_PAUSEFILTER;
> +
> + regs[3] = edx;
> + break;
> + }
> +
> }
> }
>
> static void intel_xc_cpuid_policy(
> xc_interface *xch, domid_t domid,
> const unsigned int *input, unsigned int *regs,
> - int is_pae)
> + int is_pae, int is_nestedhvm)
> {
> switch ( input[0] )
> {
> @@ -161,6 +192,11 @@ static void intel_xc_cpuid_policy(
> /* Mask AMD Number of Cores information. */
> regs[2] = 0;
> break;
> +
> + case 0x8000000a:
> + /* Clear AMD SVM feature bits */
> + regs[0] = regs[1] = regs[2] = regs[3] = 0;
> + break;
ditto.
> }
> }
>
> @@ -169,12 +205,17 @@ static void xc_cpuid_hvm_policy(
> const unsigned int *input, unsigned int *regs)
> {
> char brand[13];
> + unsigned long nestedhvm;
> unsigned long pae;
> int is_pae;
> + int is_nestedhvm;
>
> xc_get_hvm_param(xch, domid, HVM_PARAM_PAE_ENABLED, &pae);
> is_pae = !!pae;
>
> + xc_get_hvm_param(xch, domid, HVM_PARAM_NESTEDHVM, &nestedhvm);
> + is_nestedhvm = !!nestedhvm;
> +
> switch ( input[0] )
> {
> case 0x00000000:
> @@ -260,6 +301,7 @@ static void xc_cpuid_hvm_policy(
> case 0x80000004: /* ... continued */
> case 0x80000005: /* AMD L1 cache/TLB info (dumped by Intel
> policy) */ case 0x80000006: /* AMD L2/3 cache/TLB info ; Intel
> L2 cache features */
> + case 0x8000000a: /* AMD SVM feature bits */
Should this be in amd_xc_cpuid_policy?
> break;
>
> default:
> @@ -269,9 +311,9 @@ static void xc_cpuid_hvm_policy(
>
> xc_cpuid_brand_get(brand);
> if ( strstr(brand, "AMD") )
> - amd_xc_cpuid_policy(xch, domid, input, regs, is_pae);
> + amd_xc_cpuid_policy(xch, domid, input, regs, is_pae,
> is_nestedhvm); else
> - intel_xc_cpuid_policy(xch, domid, input, regs, is_pae);
> + intel_xc_cpuid_policy(xch, domid, input, regs, is_pae,
> is_nestedhvm);
>
> }
>
Thx, Eddie
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 01/13] Nested Virtualization: tools
@ 2010-10-15 13:10 Christoph Egger
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Egger @ 2010-10-15 13:10 UTC (permalink / raw)
To: xen-devel@lists.xensource.com; +Cc: Dong, Eddie, Tim Deegan
[-- Attachment #1: Type: text/plain, Size: 264 bytes --]
--
---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_nh01_tools.diff --]
[-- Type: text/x-diff, Size: 11479 bytes --]
# HG changeset patch
# User cegger
# Date 1286361417 -7200
tools: Add nestedhvm guest config option
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -30,7 +30,8 @@
#define set_bit(idx, dst) ((dst) |= (1u << ((idx) & 31)))
#define DEF_MAX_BASE 0x0000000du
-#define DEF_MAX_EXT 0x80000008u
+#define DEF_MAX_INTELEXT 0x80000008u
+#define DEF_MAX_AMDEXT 0x8000000au
static int hypervisor_is_64bit(xc_interface *xch)
{
@@ -78,7 +79,7 @@ static void xc_cpuid_brand_get(char *str
static void amd_xc_cpuid_policy(
xc_interface *xch, domid_t domid,
const unsigned int *input, unsigned int *regs,
- int is_pae)
+ int is_pae, int is_nestedhvm)
{
switch ( input[0] )
{
@@ -87,6 +88,11 @@ static void amd_xc_cpuid_policy(
regs[0] = regs[1] = regs[2] = 0;
break;
+ case 0x80000000:
+ if ( regs[0] > DEF_MAX_AMDEXT )
+ regs[0] = DEF_MAX_AMDEXT;
+ break;
+
case 0x80000001: {
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
@@ -97,6 +103,7 @@ static void amd_xc_cpuid_policy(
/* Filter all other features according to a whitelist. */
regs[2] &= ((is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
bitmaskof(X86_FEATURE_CMP_LEGACY) |
+ (is_nestedhvm ? bitmaskof(X86_FEATURE_SVME) : 0) |
bitmaskof(X86_FEATURE_ALTMOVCR) |
bitmaskof(X86_FEATURE_ABM) |
bitmaskof(X86_FEATURE_SSE4A) |
@@ -121,16 +128,52 @@ static void amd_xc_cpuid_policy(
*/
regs[2] = ((regs[2] & 0xf000u) + 1) | ((regs[2] & 0xffu) << 1) | 1u;
break;
+
+ case 0x8000000a: {
+ uint32_t edx;
+
+ if (!is_nestedhvm) {
+ regs[0] = regs[1] = regs[2] = regs[3] = 0;
+ break;
+ }
+
+#define SVM_FEATURE_NPT 0x00000001
+#define SVM_FEATURE_LBRV 0x00000002
+#define SVM_FEATURE_SVML 0x00000004
+#define SVM_FEATURE_NRIPS 0x00000008
+#define SVM_FEATURE_PAUSEFILTER 0x00000400
+
+ /* Only passthrough SVM features which are implemented */
+ edx = 0;
+ if (regs[3] & SVM_FEATURE_NPT)
+ edx |= SVM_FEATURE_NPT;
+ if (regs[3] & SVM_FEATURE_LBRV)
+ edx |= SVM_FEATURE_LBRV;
+ if (regs[3] & SVM_FEATURE_NRIPS)
+ edx |= SVM_FEATURE_NRIPS;
+ if (regs[3] & SVM_FEATURE_PAUSEFILTER)
+ edx |= SVM_FEATURE_PAUSEFILTER;
+
+ regs[3] = edx;
+ break;
+ }
+
}
}
static void intel_xc_cpuid_policy(
xc_interface *xch, domid_t domid,
const unsigned int *input, unsigned int *regs,
- int is_pae)
+ int is_pae, int is_nestedhvm)
{
switch ( input[0] )
{
+ case 0x00000001:
+ /* ECX[5] is availability of VMX */
+ if (is_nestedhvm)
+ set_bit(X86_FEATURE_VMXE, regs[2]);
+ break;
+
case 0x00000004:
/*
* EAX[31:26] is Maximum Cores Per Package (minus one).
@@ -141,6 +184,11 @@ static void intel_xc_cpuid_policy(
regs[3] &= 0x3ffu;
break;
+ case 0x80000000:
+ if ( regs[0] > DEF_MAX_INTELEXT )
+ regs[0] = DEF_MAX_INTELEXT;
+ break;
+
case 0x80000001: {
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
@@ -169,12 +217,17 @@ static void xc_cpuid_hvm_policy(
const unsigned int *input, unsigned int *regs)
{
char brand[13];
+ unsigned long nestedhvm;
unsigned long pae;
int is_pae;
+ int is_nestedhvm;
xc_get_hvm_param(xch, domid, HVM_PARAM_PAE_ENABLED, &pae);
is_pae = !!pae;
+ xc_get_hvm_param(xch, domid, HVM_PARAM_NESTEDHVM, &nestedhvm);
+ is_nestedhvm = !!nestedhvm;
+
switch ( input[0] )
{
case 0x00000000:
@@ -230,8 +283,7 @@ static void xc_cpuid_hvm_policy(
break;
case 0x80000000:
- if ( regs[0] > DEF_MAX_EXT )
- regs[0] = DEF_MAX_EXT;
+ /* Passthrough to cpu vendor specific functions */
break;
case 0x80000001:
@@ -260,6 +312,7 @@ static void xc_cpuid_hvm_policy(
case 0x80000004: /* ... continued */
case 0x80000005: /* AMD L1 cache/TLB info (dumped by Intel policy) */
case 0x80000006: /* AMD L2/3 cache/TLB info ; Intel L2 cache features */
+ case 0x8000000a: /* AMD SVM feature bits */
break;
default:
@@ -269,9 +322,9 @@ static void xc_cpuid_hvm_policy(
xc_cpuid_brand_get(brand);
if ( strstr(brand, "AMD") )
- amd_xc_cpuid_policy(xch, domid, input, regs, is_pae);
+ amd_xc_cpuid_policy(xch, domid, input, regs, is_pae, is_nestedhvm);
else
- intel_xc_cpuid_policy(xch, domid, input, regs, is_pae);
+ intel_xc_cpuid_policy(xch, domid, input, regs, is_pae, is_nestedhvm);
}
@@ -415,13 +468,20 @@ int xc_cpuid_apply_policy(xc_interface *
{
unsigned int input[2] = { 0, 0 }, regs[4];
unsigned int base_max, ext_max;
+ char brand[13];
int rc;
+
cpuid(input, regs);
base_max = (regs[0] <= DEF_MAX_BASE) ? regs[0] : DEF_MAX_BASE;
input[0] = 0x80000000;
cpuid(input, regs);
- ext_max = (regs[0] <= DEF_MAX_EXT) ? regs[0] : DEF_MAX_EXT;
+
+ xc_cpuid_brand_get(brand);
+ if ( strstr(brand, "AMD") )
+ ext_max = (regs[0] <= DEF_MAX_AMDEXT) ? regs[0] : DEF_MAX_AMDEXT;
+ else
+ ext_max = (regs[0] <= DEF_MAX_INTELEXT) ? regs[0] : DEF_MAX_INTELEXT;
input[0] = 0;
input[1] = XEN_CPUID_INPUT_UNUSED;
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl
+++ b/tools/libxl/libxl.idl
@@ -105,6 +105,7 @@ libxl_domain_build_info = Struct("domain
("hpet", bool),
("vpt_align", bool),
("timer_mode", integer),
+ ("nested_hvm", bool),
])),
("pv", "!%s", Struct(None,
[("slack_memkb", uint32),
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -259,6 +259,7 @@ static int hvm_build_set_params(xc_inter
#endif
xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode);
xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm);
xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
return 0;
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -345,6 +345,7 @@ static void init_build_info(libxl_domain
b_info->u.hvm.hpet = 1;
b_info->u.hvm.vpt_align = 1;
b_info->u.hvm.timer_mode = 1;
+ b_info->u.hvm.nested_hvm = 0;
} else {
b_info->u.pv.slack_memkb = 8 * 1024;
}
@@ -529,6 +530,7 @@ static void printf_info(int domid,
printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
+ printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
printf("\t\t\t(device_model %s)\n", dm_info->device_model);
printf("\t\t\t(videoram %d)\n", dm_info->videoram);
@@ -786,6 +788,8 @@ static void parse_config_data(const char
b_info->u.hvm.vpt_align = l;
if (!xlu_cfg_get_long (config, "timer_mode", &l))
b_info->u.hvm.timer_mode = l;
+ if (!xlu_cfg_get_long (config, "nestedhvm", &l))
+ b_info->u.hvm.nested_hvm = l;
} else {
char *cmdline = NULL;
const char *root = NULL, *extra = "";
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -185,6 +185,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
'vhpt': int,
'guest_os_type': str,
'hap': int,
+ 'nestedhvm' : int,
'xen_extended_power_mgmt': int,
'pci_msitranslate': int,
'pci_power_mgmt': int,
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py
+++ b/tools/python/xen/xend/XendConstants.py
@@ -52,6 +52,7 @@ HVM_PARAM_TIMER_MODE = 10
HVM_PARAM_HPET_ENABLED = 11
HVM_PARAM_ACPI_S_STATE = 14
HVM_PARAM_VPT_ALIGN = 16
+HVM_PARAM_NESTEDHVM = 19 # x86
restart_modes = [
"restart",
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -2585,10 +2585,15 @@ class XendDomainInfo:
xc.hvm_set_param(self.domid, HVM_PARAM_TIMER_MODE,
long(timer_mode))
- # Set Viridian interface configuration of domain
- viridian = self.info["platform"].get("viridian")
- if arch.type == "x86" and hvm and viridian is not None:
- xc.hvm_set_param(self.domid, HVM_PARAM_VIRIDIAN, long(viridian))
+ if arch.type == "x86" and hvm:
+ # Set Viridian interface configuration of domain
+ viridian = self.info["platform"].get("viridian")
+ if viridian is not None:
+ xc.hvm_set_param(self.domid, HVM_PARAM_VIRIDIAN, long(viridian))
+ # Set nestedhvm of domain
+ nestedhvm = self.info["platform"].get("nestedhvm")
+ if nestedhvm is not None:
+ xc.hvm_set_param(self.domid, HVM_PARAM_NESTEDHVM, long(nestedhvm))
# If nomigrate is set, disable migration
nomigrate = self.info["platform"].get("nomigrate")
diff -r 506f684ca740 -r 0f5ddfbc1afe tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -633,6 +633,11 @@ gopts.var('hap', val='HAP',
use="""Hap status (0=hap is disabled;
1=hap is enabled.""")
+gopts.var('nestedhvm', val='NESTEDHVM',
+ fn=set_int, default=0,
+ use="""Nested HVM status (0=Nested HVM is disabled;
+ 1=Nested HVM is enabled.""")
+
gopts.var('s3_integrity', val='TBOOT_MEMORY_PROTECT',
fn=set_int, default=1,
use="""Should domain memory integrity be verified during S3?
@@ -1083,7 +1088,7 @@ def configure_hvm(config_image, vals):
'isa',
'keymap',
'localtime',
- 'nographic',
+ 'nestedhvm', 'nographic',
'opengl', 'oos',
'pae', 'pci', 'pci_msitranslate', 'pci_power_mgmt',
'rtc_timeoffset',
diff -r 506f684ca740 -r 0f5ddfbc1afe xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -113,6 +113,9 @@
#define HVM_PARAM_CONSOLE_PFN 17
#define HVM_PARAM_CONSOLE_EVTCHN 18
-#define HVM_NR_PARAMS 19
+/* Boolean: Enable nestedhvm (hvm only) */
+#define HVM_PARAM_NESTEDHVM 19
+
+#define HVM_NR_PARAMS 20
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 01/13] Nested Virtualization: tools
@ 2010-11-12 18:40 Christoph Egger
2010-11-16 11:37 ` Tim Deegan
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Egger @ 2010-11-12 18:40 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 264 bytes --]
--
---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_nh01_tools.diff --]
[-- Type: text/x-diff, Size: 11454 bytes --]
# HG changeset patch
# User cegger
# Date 1288975013 -3600
tools: Add nestedhvm guest config option
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -30,7 +30,8 @@
#define set_bit(idx, dst) ((dst) |= (1u << ((idx) & 31)))
#define DEF_MAX_BASE 0x0000000du
-#define DEF_MAX_EXT 0x80000008u
+#define DEF_MAX_INTELEXT 0x80000008u
+#define DEF_MAX_AMDEXT 0x8000000au
static int hypervisor_is_64bit(xc_interface *xch)
{
@@ -78,7 +79,7 @@ static void xc_cpuid_brand_get(char *str
static void amd_xc_cpuid_policy(
xc_interface *xch, domid_t domid,
const unsigned int *input, unsigned int *regs,
- int is_pae)
+ int is_pae, int is_nestedhvm)
{
switch ( input[0] )
{
@@ -87,6 +88,11 @@ static void amd_xc_cpuid_policy(
regs[0] = regs[1] = regs[2] = 0;
break;
+ case 0x80000000:
+ if ( regs[0] > DEF_MAX_AMDEXT )
+ regs[0] = DEF_MAX_AMDEXT;
+ break;
+
case 0x80000001: {
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
@@ -97,6 +103,7 @@ static void amd_xc_cpuid_policy(
/* Filter all other features according to a whitelist. */
regs[2] &= ((is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
bitmaskof(X86_FEATURE_CMP_LEGACY) |
+ (is_nestedhvm ? bitmaskof(X86_FEATURE_SVME) : 0) |
bitmaskof(X86_FEATURE_ALTMOVCR) |
bitmaskof(X86_FEATURE_ABM) |
bitmaskof(X86_FEATURE_SSE4A) |
@@ -121,16 +128,52 @@ static void amd_xc_cpuid_policy(
*/
regs[2] = ((regs[2] & 0xf000u) + 1) | ((regs[2] & 0xffu) << 1) | 1u;
break;
+
+ case 0x8000000a: {
+ uint32_t edx;
+
+ if (!is_nestedhvm) {
+ regs[0] = regs[1] = regs[2] = regs[3] = 0;
+ break;
+ }
+
+#define SVM_FEATURE_NPT 0x00000001
+#define SVM_FEATURE_LBRV 0x00000002
+#define SVM_FEATURE_SVML 0x00000004
+#define SVM_FEATURE_NRIPS 0x00000008
+#define SVM_FEATURE_PAUSEFILTER 0x00000400
+
+ /* Only passthrough SVM features which are implemented */
+ edx = 0;
+ if (regs[3] & SVM_FEATURE_NPT)
+ edx |= SVM_FEATURE_NPT;
+ if (regs[3] & SVM_FEATURE_LBRV)
+ edx |= SVM_FEATURE_LBRV;
+ if (regs[3] & SVM_FEATURE_NRIPS)
+ edx |= SVM_FEATURE_NRIPS;
+ if (regs[3] & SVM_FEATURE_PAUSEFILTER)
+ edx |= SVM_FEATURE_PAUSEFILTER;
+
+ regs[3] = edx;
+ break;
+ }
+
}
}
static void intel_xc_cpuid_policy(
xc_interface *xch, domid_t domid,
const unsigned int *input, unsigned int *regs,
- int is_pae)
+ int is_pae, int is_nestedhvm)
{
switch ( input[0] )
{
+ case 0x00000001:
+ /* ECX[5] is availability of VMX */
+ if (is_nestedhvm)
+ set_bit(X86_FEATURE_VMXE, regs[2]);
+ break;
+
case 0x00000004:
/*
* EAX[31:26] is Maximum Cores Per Package (minus one).
@@ -141,6 +184,11 @@ static void intel_xc_cpuid_policy(
regs[3] &= 0x3ffu;
break;
+ case 0x80000000:
+ if ( regs[0] > DEF_MAX_INTELEXT )
+ regs[0] = DEF_MAX_INTELEXT;
+ break;
+
case 0x80000001: {
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
@@ -169,12 +217,17 @@ static void xc_cpuid_hvm_policy(
const unsigned int *input, unsigned int *regs)
{
char brand[13];
+ unsigned long nestedhvm;
unsigned long pae;
int is_pae;
+ int is_nestedhvm;
xc_get_hvm_param(xch, domid, HVM_PARAM_PAE_ENABLED, &pae);
is_pae = !!pae;
+ xc_get_hvm_param(xch, domid, HVM_PARAM_NESTEDHVM, &nestedhvm);
+ is_nestedhvm = !!nestedhvm;
+
switch ( input[0] )
{
case 0x00000000:
@@ -230,8 +283,7 @@ static void xc_cpuid_hvm_policy(
break;
case 0x80000000:
- if ( regs[0] > DEF_MAX_EXT )
- regs[0] = DEF_MAX_EXT;
+ /* Passthrough to cpu vendor specific functions */
break;
case 0x80000001:
@@ -260,6 +312,7 @@ static void xc_cpuid_hvm_policy(
case 0x80000004: /* ... continued */
case 0x80000005: /* AMD L1 cache/TLB info (dumped by Intel policy) */
case 0x80000006: /* AMD L2/3 cache/TLB info ; Intel L2 cache features */
+ case 0x8000000a: /* AMD SVM feature bits */
break;
default:
@@ -269,9 +322,9 @@ static void xc_cpuid_hvm_policy(
xc_cpuid_brand_get(brand);
if ( strstr(brand, "AMD") )
- amd_xc_cpuid_policy(xch, domid, input, regs, is_pae);
+ amd_xc_cpuid_policy(xch, domid, input, regs, is_pae, is_nestedhvm);
else
- intel_xc_cpuid_policy(xch, domid, input, regs, is_pae);
+ intel_xc_cpuid_policy(xch, domid, input, regs, is_pae, is_nestedhvm);
}
@@ -415,13 +468,20 @@ int xc_cpuid_apply_policy(xc_interface *
{
unsigned int input[2] = { 0, 0 }, regs[4];
unsigned int base_max, ext_max;
+ char brand[13];
int rc;
+
cpuid(input, regs);
base_max = (regs[0] <= DEF_MAX_BASE) ? regs[0] : DEF_MAX_BASE;
input[0] = 0x80000000;
cpuid(input, regs);
- ext_max = (regs[0] <= DEF_MAX_EXT) ? regs[0] : DEF_MAX_EXT;
+
+ xc_cpuid_brand_get(brand);
+ if ( strstr(brand, "AMD") )
+ ext_max = (regs[0] <= DEF_MAX_AMDEXT) ? regs[0] : DEF_MAX_AMDEXT;
+ else
+ ext_max = (regs[0] <= DEF_MAX_INTELEXT) ? regs[0] : DEF_MAX_INTELEXT;
input[0] = 0;
input[1] = XEN_CPUID_INPUT_UNUSED;
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl
+++ b/tools/libxl/libxl.idl
@@ -107,6 +107,7 @@ libxl_domain_build_info = Struct("domain
("hpet", bool),
("vpt_align", bool),
("timer_mode", integer),
+ ("nested_hvm", bool),
])),
("pv", "!%s", Struct(None,
[("slack_memkb", uint32),
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -260,6 +260,7 @@ static int hvm_build_set_params(xc_inter
#endif
xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode);
xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm);
xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
return 0;
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -345,6 +345,7 @@ static void init_build_info(libxl_domain
b_info->u.hvm.hpet = 1;
b_info->u.hvm.vpt_align = 1;
b_info->u.hvm.timer_mode = 1;
+ b_info->u.hvm.nested_hvm = 0;
} else {
b_info->u.pv.slack_memkb = 8 * 1024;
}
@@ -532,6 +533,7 @@ static void printf_info(int domid,
printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
+ printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
printf("\t\t\t(device_model %s)\n", dm_info->device_model);
printf("\t\t\t(videoram %d)\n", dm_info->videoram);
@@ -789,6 +791,8 @@ static void parse_config_data(const char
b_info->u.hvm.vpt_align = l;
if (!xlu_cfg_get_long (config, "timer_mode", &l))
b_info->u.hvm.timer_mode = l;
+ if (!xlu_cfg_get_long (config, "nestedhvm", &l))
+ b_info->u.hvm.nested_hvm = l;
} else {
char *cmdline = NULL;
const char *root = NULL, *extra = "";
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -185,6 +185,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
'vhpt': int,
'guest_os_type': str,
'hap': int,
+ 'nestedhvm' : int,
'xen_extended_power_mgmt': int,
'pci_msitranslate': int,
'pci_power_mgmt': int,
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py
+++ b/tools/python/xen/xend/XendConstants.py
@@ -52,6 +52,7 @@ HVM_PARAM_TIMER_MODE = 10
HVM_PARAM_HPET_ENABLED = 11
HVM_PARAM_ACPI_S_STATE = 14
HVM_PARAM_VPT_ALIGN = 16
+HVM_PARAM_NESTEDHVM = 20 # x86
restart_modes = [
"restart",
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -2585,10 +2585,15 @@ class XendDomainInfo:
xc.hvm_set_param(self.domid, HVM_PARAM_TIMER_MODE,
long(timer_mode))
- # Set Viridian interface configuration of domain
- viridian = self.info["platform"].get("viridian")
- if arch.type == "x86" and hvm and viridian is not None:
- xc.hvm_set_param(self.domid, HVM_PARAM_VIRIDIAN, long(viridian))
+ if arch.type == "x86" and hvm:
+ # Set Viridian interface configuration of domain
+ viridian = self.info["platform"].get("viridian")
+ if viridian is not None:
+ xc.hvm_set_param(self.domid, HVM_PARAM_VIRIDIAN, long(viridian))
+ # Set nestedhvm of domain
+ nestedhvm = self.info["platform"].get("nestedhvm")
+ if nestedhvm is not None:
+ xc.hvm_set_param(self.domid, HVM_PARAM_NESTEDHVM, long(nestedhvm))
# If nomigrate is set, disable migration
nomigrate = self.info["platform"].get("nomigrate")
diff -r 88d14c41e8e2 -r de4c5c587cb9 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -633,6 +633,11 @@ gopts.var('hap', val='HAP',
use="""Hap status (0=hap is disabled;
1=hap is enabled.""")
+gopts.var('nestedhvm', val='NESTEDHVM',
+ fn=set_int, default=0,
+ use="""Nested HVM status (0=Nested HVM is disabled;
+ 1=Nested HVM is enabled.""")
+
gopts.var('s3_integrity', val='TBOOT_MEMORY_PROTECT',
fn=set_int, default=1,
use="""Should domain memory integrity be verified during S3?
@@ -1083,7 +1088,7 @@ def configure_hvm(config_image, vals):
'isa',
'keymap',
'localtime',
- 'nographic',
+ 'nestedhvm', 'nographic',
'opengl', 'oos',
'pae', 'pci', 'pci_msitranslate', 'pci_power_mgmt',
'rtc_timeoffset',
diff -r 88d14c41e8e2 -r de4c5c587cb9 xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -124,6 +124,9 @@
*/
#define HVM_PARAM_ACPI_IOPORTS_LOCATION 19
-#define HVM_NR_PARAMS 20
+/* Boolean: Enable nestedhvm (hvm only) */
+#define HVM_PARAM_NESTEDHVM 20
+
+#define HVM_NR_PARAMS 21
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] Nested Virtualization: tools
2010-11-12 18:40 [PATCH 01/13] Nested Virtualization: tools Christoph Egger
@ 2010-11-16 11:37 ` Tim Deegan
2010-11-16 11:52 ` Christoph Egger
0 siblings, 1 reply; 9+ messages in thread
From: Tim Deegan @ 2010-11-16 11:37 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel@lists.xensource.com
Hi,
At 18:40 +0000 on 12 Nov (1289587225), Christoph Egger wrote:
> +#define SVM_FEATURE_NPT 0x00000001
> +#define SVM_FEATURE_LBRV 0x00000002
> +#define SVM_FEATURE_SVML 0x00000004
> +#define SVM_FEATURE_NRIPS 0x00000008
> +#define SVM_FEATURE_PAUSEFILTER 0x00000400
> +
> + /* Only passthrough SVM features which are implemented */
> + edx = 0;
> + if (regs[3] & SVM_FEATURE_NPT)
> + edx |= SVM_FEATURE_NPT;
> + if (regs[3] & SVM_FEATURE_LBRV)
> + edx |= SVM_FEATURE_LBRV;
> + if (regs[3] & SVM_FEATURE_NRIPS)
> + edx |= SVM_FEATURE_NRIPS;
> + if (regs[3] & SVM_FEATURE_PAUSEFILTER)
> + edx |= SVM_FEATURE_PAUSEFILTER;
> +
> + regs[3] = edx;
Minor niggle - why isn't this just a single &= operation?
Tim.
--
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] Nested Virtualization: tools
2010-11-16 11:37 ` Tim Deegan
@ 2010-11-16 11:52 ` Christoph Egger
2010-11-16 12:52 ` George Dunlap
2010-11-16 13:03 ` Tim Deegan
0 siblings, 2 replies; 9+ messages in thread
From: Christoph Egger @ 2010-11-16 11:52 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel@lists.xensource.com
On Tuesday 16 November 2010 12:37:06 Tim Deegan wrote:
> Hi,
>
> At 18:40 +0000 on 12 Nov (1289587225), Christoph Egger wrote:
> > +#define SVM_FEATURE_NPT 0x00000001
> > +#define SVM_FEATURE_LBRV 0x00000002
> > +#define SVM_FEATURE_SVML 0x00000004
> > +#define SVM_FEATURE_NRIPS 0x00000008
> > +#define SVM_FEATURE_PAUSEFILTER 0x00000400
> > +
> > + /* Only passthrough SVM features which are implemented */
> > + edx = 0;
> > + if (regs[3] & SVM_FEATURE_NPT)
> > + edx |= SVM_FEATURE_NPT;
> > + if (regs[3] & SVM_FEATURE_LBRV)
> > + edx |= SVM_FEATURE_LBRV;
> > + if (regs[3] & SVM_FEATURE_NRIPS)
> > + edx |= SVM_FEATURE_NRIPS;
> > + if (regs[3] & SVM_FEATURE_PAUSEFILTER)
> > + edx |= SVM_FEATURE_PAUSEFILTER;
> > +
> > + regs[3] = edx;
>
> Minor niggle - why isn't this just a single &= operation?
The l1 guest shouldn't see upcoming svm features yet.
They will be added here when support for them is implemented.
Christoph
--
---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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] Nested Virtualization: tools
2010-11-16 11:52 ` Christoph Egger
@ 2010-11-16 12:52 ` George Dunlap
2010-11-16 13:03 ` Tim Deegan
1 sibling, 0 replies; 9+ messages in thread
From: George Dunlap @ 2010-11-16 12:52 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel@lists.xensource.com, Tim Deegan
On Tue, Nov 16, 2010 at 11:52 AM, Christoph Egger
<Christoph.Egger@amd.com> wrote:
> On Tuesday 16 November 2010 12:37:06 Tim Deegan wrote:
>> Hi,
>>
>> At 18:40 +0000 on 12 Nov (1289587225), Christoph Egger wrote:
>> > +#define SVM_FEATURE_NPT 0x00000001
>> > +#define SVM_FEATURE_LBRV 0x00000002
>> > +#define SVM_FEATURE_SVML 0x00000004
>> > +#define SVM_FEATURE_NRIPS 0x00000008
>> > +#define SVM_FEATURE_PAUSEFILTER 0x00000400
>> > +
>> > + /* Only passthrough SVM features which are implemented */
>> > + edx = 0;
>> > + if (regs[3] & SVM_FEATURE_NPT)
>> > + edx |= SVM_FEATURE_NPT;
>> > + if (regs[3] & SVM_FEATURE_LBRV)
>> > + edx |= SVM_FEATURE_LBRV;
>> > + if (regs[3] & SVM_FEATURE_NRIPS)
>> > + edx |= SVM_FEATURE_NRIPS;
>> > + if (regs[3] & SVM_FEATURE_PAUSEFILTER)
>> > + edx |= SVM_FEATURE_PAUSEFILTER;
>> > +
>> > + regs[3] = edx;
>>
>> Minor niggle - why isn't this just a single &= operation?
>
> The l1 guest shouldn't see upcoming svm features yet.
> They will be added here when support for them is implemented.
I think Tim is suggesting this:
regs[3] &= SVM_FEATURE_NPT|SVM_FEATURE_LBRV|...
Which will have the same effect.
-George
>
> Christoph
>
>
> --
> ---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
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] Nested Virtualization: tools
2010-11-16 11:52 ` Christoph Egger
2010-11-16 12:52 ` George Dunlap
@ 2010-11-16 13:03 ` Tim Deegan
2010-11-16 13:10 ` Christoph Egger
1 sibling, 1 reply; 9+ messages in thread
From: Tim Deegan @ 2010-11-16 13:03 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel@lists.xensource.com
At 11:52 +0000 on 16 Nov (1289908371), Christoph Egger wrote:
> On Tuesday 16 November 2010 12:37:06 Tim Deegan wrote:
> > Hi,
> >
> > At 18:40 +0000 on 12 Nov (1289587225), Christoph Egger wrote:
> > > +#define SVM_FEATURE_NPT 0x00000001
> > > +#define SVM_FEATURE_LBRV 0x00000002
> > > +#define SVM_FEATURE_SVML 0x00000004
> > > +#define SVM_FEATURE_NRIPS 0x00000008
> > > +#define SVM_FEATURE_PAUSEFILTER 0x00000400
> > > +
> > > + /* Only passthrough SVM features which are implemented */
> > > + edx = 0;
> > > + if (regs[3] & SVM_FEATURE_NPT)
> > > + edx |= SVM_FEATURE_NPT;
> > > + if (regs[3] & SVM_FEATURE_LBRV)
> > > + edx |= SVM_FEATURE_LBRV;
> > > + if (regs[3] & SVM_FEATURE_NRIPS)
> > > + edx |= SVM_FEATURE_NRIPS;
> > > + if (regs[3] & SVM_FEATURE_PAUSEFILTER)
> > > + edx |= SVM_FEATURE_PAUSEFILTER;
> > > +
> > > + regs[3] = edx;
> >
> > Minor niggle - why isn't this just a single &= operation?
>
> The l1 guest shouldn't see upcoming svm features yet.
> They will be added here when support for them is implemented.
I meant: why don't you or together the feature flags you support
(which should probably be defined in a header file with the other CPUID
bits, btw) and just 'regs[3] &= SVM_FEAURE_FOO|SVM_FEATURE_BAR|...'
instead of using ten lines of code?
It's just a coding style niggle, not a logic error.
Tim.
--
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 01/13] Nested Virtualization: tools
2010-11-16 13:03 ` Tim Deegan
@ 2010-11-16 13:10 ` Christoph Egger
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Egger @ 2010-11-16 13:10 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel@lists.xensource.com
On Tuesday 16 November 2010 14:03:40 Tim Deegan wrote:
> At 11:52 +0000 on 16 Nov (1289908371), Christoph Egger wrote:
> > On Tuesday 16 November 2010 12:37:06 Tim Deegan wrote:
> > > Hi,
> > >
> > > At 18:40 +0000 on 12 Nov (1289587225), Christoph Egger wrote:
> > > > +#define SVM_FEATURE_NPT 0x00000001
> > > > +#define SVM_FEATURE_LBRV 0x00000002
> > > > +#define SVM_FEATURE_SVML 0x00000004
> > > > +#define SVM_FEATURE_NRIPS 0x00000008
> > > > +#define SVM_FEATURE_PAUSEFILTER 0x00000400
> > > > +
> > > > + /* Only passthrough SVM features which are implemented */
> > > > + edx = 0;
> > > > + if (regs[3] & SVM_FEATURE_NPT)
> > > > + edx |= SVM_FEATURE_NPT;
> > > > + if (regs[3] & SVM_FEATURE_LBRV)
> > > > + edx |= SVM_FEATURE_LBRV;
> > > > + if (regs[3] & SVM_FEATURE_NRIPS)
> > > > + edx |= SVM_FEATURE_NRIPS;
> > > > + if (regs[3] & SVM_FEATURE_PAUSEFILTER)
> > > > + edx |= SVM_FEATURE_PAUSEFILTER;
> > > > +
> > > > + regs[3] = edx;
> > >
> > > Minor niggle - why isn't this just a single &= operation?
> >
> > The l1 guest shouldn't see upcoming svm features yet.
> > They will be added here when support for them is implemented.
>
> I meant: why don't you or together the feature flags you support
> (which should probably be defined in a header file with the other CPUID
> bits, btw) and just 'regs[3] &= SVM_FEAURE_FOO|SVM_FEATURE_BAR|...'
> instead of using ten lines of code?
Thanks for clarification (and the other people who guessed right).
I changed that in my local tree.
Christoph
--
---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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-11-16 13:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12 18:40 [PATCH 01/13] Nested Virtualization: tools Christoph Egger
2010-11-16 11:37 ` Tim Deegan
2010-11-16 11:52 ` Christoph Egger
2010-11-16 12:52 ` George Dunlap
2010-11-16 13:03 ` Tim Deegan
2010-11-16 13:10 ` Christoph Egger
-- strict thread matches above, loose matches on Subject: below --
2010-10-15 13:10 Christoph Egger
2010-09-01 14:54 Christoph Egger
2010-09-03 7:54 ` Dong, Eddie
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.