From nobody Thu May 2 03:02:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492604287010771.0929309071314; Wed, 19 Apr 2017 05:18:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9DB38048F; Wed, 19 Apr 2017 12:18:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B0A374ADD; Wed, 19 Apr 2017 12:18:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3177A5ED64; Wed, 19 Apr 2017 12:18:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3JCHjPq004848 for ; Wed, 19 Apr 2017 08:17:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 61CE3189BB; Wed, 19 Apr 2017 12:17:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B9F1C90D3 for ; Wed, 19 Apr 2017 12:17:43 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 195AE31F406 for ; Wed, 19 Apr 2017 12:17:42 +0000 (UTC) Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3JCHfZO000872 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Apr 2017 12:17:41 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v3JCHfPb023152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Apr 2017 12:17:41 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v3JCHex4022523; Wed, 19 Apr 2017 12:17:40 GMT Received: from nina.dynamic.ziggo.nl (/10.175.165.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Apr 2017 05:17:40 -0700 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A9DB38048F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A9DB38048F DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 195AE31F406 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=wim.ten.have@oracle.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 195AE31F406 From: Wim Ten Have To: Libvirt Development List Date: Wed, 19 Apr 2017 14:17:15 +0200 Message-Id: <20170419121717.22223-2-wim.ten.have@oracle.com> In-Reply-To: <20170419121717.22223-1-wim.ten.have@oracle.com> References: <20170419121717.22223-1-wim.ten.have@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 19 Apr 2017 12:17:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 19 Apr 2017 12:17:42 +0000 (UTC) for IP:'141.146.126.69' DOMAIN:'aserp1040.oracle.com' HELO:'aserp1040.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -104.401 (BAYES_50, DCC_REPUT_13_19, RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 141.146.126.69 aserp1040.oracle.com 141.146.126.69 aserp1040.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Joao Martins , Wim ten Have Subject: [libvirt] [PATCH v3 1/3] libxl: set nestedhvm for mode host-passthrough X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 19 Apr 2017 12:18:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Wim ten Have Xen feature nestedhvm is the option on Xen 4.4+ which enables nested virtualization when mode host-passthrough is applied. nested HVM is enabled by adding below on the target domain; Virtualization on target domain can be disabled by specifying such under feature policy rule on target name; [On Intel (VT-x) architecture] or: [On AMD (AMD-V) architecture] Signed-off-by: Joao Martins Signed-off-by: Wim ten Have --- src/libxl/libxl_conf.c | 46 +++++++++++++++++++++++++++++++++++++++++---= -- src/libxl/libxl_conf.h | 2 +- src/libxl/libxl_domain.c | 2 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index f5b788b..31508d6 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -47,6 +47,7 @@ #include "libxl_utils.h" #include "virstoragefile.h" #include "secret_util.h" +#include "cpu/cpu.h" =20 =20 #define VIR_FROM_THIS VIR_FROM_LIBXL @@ -292,7 +293,7 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf) =20 static int libxlMakeDomBuildInfo(virDomainDefPtr def, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, libxl_domain_config *d_config) { libxl_domain_build_info *b_info =3D &d_config->b_info; @@ -308,7 +309,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PV); =20 b_info->max_vcpus =3D virDomainDefGetVcpusMax(def); - if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, b_info->max_vcpu= s)) + if (libxl_cpu_bitmap_alloc(cfg->ctx, &b_info->avail_vcpus, b_info->max= _vcpus)) return -1; libxl_bitmap_set_none(&b_info->avail_vcpus); for (i =3D 0; i < virDomainDefGetVcpus(def); i++) @@ -374,6 +375,41 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D VIR_TRISTATE_SWITCH_ON); =20 + if (cfg && def->cpu && + def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROUGH)) { + bool hasHwVirt =3D false; + bool svm =3D false, vmx =3D false; + virCapsPtr caps =3D cfg->caps; + + if (caps && ARCH_IS_X86(def->os.arch)) { + vmx =3D virCPUCheckFeature(caps->host.arch, caps->host.cpu= , "vmx"); + svm =3D virCPUCheckFeature(caps->host.arch, caps->host.cpu= , "svm"); + hasHwVirt =3D vmx | svm; + } + + if (def->cpu->nfeatures) { + for (i =3D 0; i < def->cpu->nfeatures; i++) { + + switch (def->cpu->features[i].policy) { + + case VIR_CPU_FEATURE_DISABLE: + case VIR_CPU_FEATURE_FORBID: + if ((vmx && STREQ(def->cpu->features[i].name, = "vmx")) || + (svm && STREQ(def->cpu->features[i].name, = "svm"))) + hasHwVirt =3D false; + break; + + case VIR_CPU_FEATURE_FORCE: + case VIR_CPU_FEATURE_REQUIRE: + case VIR_CPU_FEATURE_OPTIONAL: + case VIR_CPU_FEATURE_LAST: + break; + } + } + } + libxl_defbool_set(&b_info->u.hvm.nested_hvm, hasHwVirt); + } + if (def->nsounds > 0) { /* * Use first sound device. man xl.cfg(5) describes soundhw as @@ -2087,15 +2123,15 @@ int libxlBuildDomainConfig(virPortAllocatorPtr graphicsports, virDomainDefPtr def, const char *channelDir LIBXL_ATTR_UNUSED, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, libxl_domain_config *d_config) { libxl_domain_config_init(d_config); =20 - if (libxlMakeDomCreateInfo(ctx, def, &d_config->c_info) < 0) + if (libxlMakeDomCreateInfo(cfg->ctx, def, &d_config->c_info) < 0) return -1; =20 - if (libxlMakeDomBuildInfo(def, ctx, d_config) < 0) + if (libxlMakeDomBuildInfo(def, cfg, d_config) < 0) return -1; =20 if (libxlMakeDiskList(def, d_config) < 0) diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index c653c9f..7a83669 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -216,7 +216,7 @@ int libxlBuildDomainConfig(virPortAllocatorPtr graphicsports, virDomainDefPtr def, const char *channelDir LIBXL_ATTR_UNUSED, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, libxl_domain_config *d_config); =20 static inline void diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 57ec661..562bc67 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -1256,7 +1256,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, goto cleanup_dom; =20 if (libxlBuildDomainConfig(driver->reservedGraphicsPorts, vm->def, - cfg->channelDir, cfg->ctx, &d_config) < 0) + cfg->channelDir, cfg, &d_config) < 0) goto cleanup_dom; =20 if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0) --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:02:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492604290865333.17029251724625; Wed, 19 Apr 2017 05:18:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D89443B72D; Wed, 19 Apr 2017 12:18:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE78F7DB69; Wed, 19 Apr 2017 12:18:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 61CBE5ED65; Wed, 19 Apr 2017 12:18:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3JCHkIv004856 for ; Wed, 19 Apr 2017 08:17:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 287427DB75; Wed, 19 Apr 2017 12:17:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 20C557DB74 for ; Wed, 19 Apr 2017 12:17:44 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3D86C3D97E for ; Wed, 19 Apr 2017 12:17:43 +0000 (UTC) Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3JCHgcV025157 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Apr 2017 12:17:42 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v3JCHgqo016260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Apr 2017 12:17:42 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v3JCHgla014346; Wed, 19 Apr 2017 12:17:42 GMT Received: from nina.dynamic.ziggo.nl (/10.175.165.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Apr 2017 05:17:41 -0700 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D89443B72D Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D89443B72D DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3D86C3D97E Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=wim.ten.have@oracle.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3D86C3D97E From: Wim Ten Have To: Libvirt Development List Date: Wed, 19 Apr 2017 14:17:16 +0200 Message-Id: <20170419121717.22223-3-wim.ten.have@oracle.com> In-Reply-To: <20170419121717.22223-1-wim.ten.have@oracle.com> References: <20170419121717.22223-1-wim.ten.have@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Apr 2017 12:17:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Apr 2017 12:17:43 +0000 (UTC) for IP:'156.151.31.81' DOMAIN:'userp1040.oracle.com' HELO:'userp1040.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -101.621 (BAYES_50, DCC_REPUT_13_19, RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.81 userp1040.oracle.com 156.151.31.81 userp1040.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Joao Martins , Wim ten Have Subject: [libvirt] [PATCH v3 2/3] xenconfig: add conversions for xen-xl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Apr 2017 12:18:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Wim ten Have Per xen-xl conversions from and to native under host-passthrough mode we take care for Xen (nestedhvm =3D mode) applied and inherited settings generating or processing correct feature policy: [On Intel (VT-x) architectures] or [On AMD (AMD-V) architectures] It will then generate (or parse) for nestedhvm=3D1 in/from xl format. Signed-off-by: Joao Martins Signed-off-by: Wim ten Have --- cfg.mk | 2 +- src/xenconfig/xen_xl.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/cfg.mk b/cfg.mk index 69e3f3a..32c3725 100644 --- a/cfg.mk +++ b/cfg.mk @@ -777,7 +777,7 @@ sc_prohibit_cross_inclusion: locking/) safe=3D"($$dir|util|conf|rpc)";; \ cpu/| network/| node_device/| rpc/| security/| storage/) \ safe=3D"($$dir|util|conf|storage)";; \ - xenapi/ | xenconfig/ ) safe=3D"($$dir|util|conf|xen)";; \ + xenapi/ | xenconfig/ ) safe=3D"($$dir|util|conf|xen|cpu)";; \ *) safe=3D"($$dir|$(mid_dirs)|util)";; \ esac; \ in_vc_files=3D"^src/$$dir" \ diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 74f68b3..62af8b8 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -34,6 +34,7 @@ #include "virstoragefile.h" #include "xen_xl.h" #include "libxl_capabilities.h" +#include "cpu/cpu.h" =20 #define VIR_FROM_THIS VIR_FROM_XENXL =20 @@ -106,6 +107,7 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virC= apsPtr caps) if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { const char *bios; const char *boot; + int val =3D 0; =20 if (xenConfigGetString(conf, "bios", &bios, NULL) < 0) return -1; @@ -164,6 +166,40 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vir= CapsPtr caps) } def->os.nBootDevs++; } + + if (xenConfigGetBool(conf, "nestedhvm", &val, -1) < 0) + return -1; + + if (val !=3D -1) { + virCPUDefPtr cpu =3D NULL; + + if (VIR_ALLOC(cpu) < 0) + return -1; + + if (val =3D=3D 0) { + bool isVTx =3D true; + + if (VIR_ALLOC(cpu->features) < 0) { + VIR_FREE(cpu); + return -1; + } + + if (caps && caps->host.cpu && ARCH_IS_X86(def->os.arch)) + isVTx =3D virCPUCheckFeature(caps->host.arch, caps->ho= st.cpu, "vmx"); + + if (VIR_STRDUP(cpu->features->name, isVTx ? "vmx" : "svm")= < 0) { + VIR_FREE(cpu->features); + VIR_FREE(cpu); + return -1; + } + cpu->features->policy =3D VIR_CPU_FEATURE_DISABLE; + cpu->nfeatures =3D cpu->nfeatures_max =3D 1; + } + cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; + cpu->type =3D VIR_CPU_TYPE_GUEST; + def->cpu =3D cpu; + } + } else { if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader= ) < 0) return -1; @@ -897,6 +933,34 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def) if (xenConfigSetString(conf, "boot", boot) < 0) return -1; =20 + if (def->cpu && + def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { + bool hasHwVirt =3D true; + + if (def->cpu->nfeatures) { + for (i =3D 0; i < def->cpu->nfeatures; i++) { + + switch (def->cpu->features[i].policy) { + case VIR_CPU_FEATURE_DISABLE: + case VIR_CPU_FEATURE_FORBID: + if (STREQ(def->cpu->features[i].name, "vmx") || + STREQ(def->cpu->features[i].name, "svm")) + hasHwVirt =3D false; + break; + + case VIR_CPU_FEATURE_FORCE: + case VIR_CPU_FEATURE_REQUIRE: + case VIR_CPU_FEATURE_OPTIONAL: + case VIR_CPU_FEATURE_LAST: + break; + } + } + } + + if (xenConfigSetInt(conf, "nestedhvm", hasHwVirt) < 0) + return -1; + } + /* XXX floppy disks */ } else { if (def->os.bootloader && --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:02:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 14926042745961003.6214423574679; Wed, 19 Apr 2017 05:17:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84A772E6064; Wed, 19 Apr 2017 12:17:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41B7C74ADC; Wed, 19 Apr 2017 12:17:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0D09A18523C7; Wed, 19 Apr 2017 12:17:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3JCHld4004861 for ; Wed, 19 Apr 2017 08:17:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id DCE6F8F7D4; Wed, 19 Apr 2017 12:17:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5A678F7F6 for ; Wed, 19 Apr 2017 12:17:45 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B606D63E2B for ; Wed, 19 Apr 2017 12:17:44 +0000 (UTC) Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3JCHhRA000910 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Apr 2017 12:17:44 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v3JCHhMc007109 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Apr 2017 12:17:43 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v3JCHhj7014355; Wed, 19 Apr 2017 12:17:43 GMT Received: from nina.dynamic.ziggo.nl (/10.175.165.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Apr 2017 05:17:42 -0700 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 84A772E6064 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 84A772E6064 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B606D63E2B Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=wim.ten.have@oracle.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B606D63E2B From: Wim Ten Have To: Libvirt Development List Date: Wed, 19 Apr 2017 14:17:17 +0200 Message-Id: <20170419121717.22223-4-wim.ten.have@oracle.com> In-Reply-To: <20170419121717.22223-1-wim.ten.have@oracle.com> References: <20170419121717.22223-1-wim.ten.have@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 19 Apr 2017 12:17:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 19 Apr 2017 12:17:45 +0000 (UTC) for IP:'141.146.126.69' DOMAIN:'aserp1040.oracle.com' HELO:'aserp1040.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -104.401 (BAYES_50, DCC_REPUT_13_19, RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 141.146.126.69 aserp1040.oracle.com 141.146.126.69 aserp1040.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [PATCH v3 3/3] xlconfigtest: add tests for 'nestedhvm' support X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 19 Apr 2017 12:17:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Wim ten Have Testing various configuration schemas targeting postive and negative nestedhvm under libvirt configuration. Mode "host-passthrough" generates nestedhvm=3D1 in/from xl format where Intel virtualization (VT-x): or AMD virtualization (AMD-V): disables virtualization mode under guest domains. Signed-off-by: Wim ten Have --- .../test-fullvirt-nestedhvm-disabled.cfg | 26 +++++++++ .../test-fullvirt-nestedhvm-disabled.xml | 61 ++++++++++++++++++= ++++ tests/xlconfigdata/test-fullvirt-nestedhvm.cfg | 26 +++++++++ tests/xlconfigdata/test-fullvirt-nestedhvm.xml | 59 ++++++++++++++++++= +++ tests/xlconfigtest.c | 2 + 5 files changed, 174 insertions(+) create mode 100644 tests/xlconfigdata/test-fullvirt-nestedhvm-disabled.cfg create mode 100644 tests/xlconfigdata/test-fullvirt-nestedhvm-disabled.xml create mode 100644 tests/xlconfigdata/test-fullvirt-nestedhvm.cfg create mode 100644 tests/xlconfigdata/test-fullvirt-nestedhvm.xml diff --git a/tests/xlconfigdata/test-fullvirt-nestedhvm-disabled.cfg b/test= s/xlconfigdata/test-fullvirt-nestedhvm-disabled.cfg new file mode 100644 index 0000000..d4b9f45 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-nestedhvm-disabled.cfg @@ -0,0 +1,26 @@ +name =3D "XenGuest2" +uuid =3D "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem =3D 579 +memory =3D 394 +vcpus =3D 1 +pae =3D 1 +acpi =3D 1 +apic =3D 1 +viridian =3D 0 +rtc_timeoffset =3D 0 +localtime =3D 0 +on_poweroff =3D "destroy" +on_reboot =3D "restart" +on_crash =3D "restart" +device_model =3D "/usr/lib/xen/bin/qemu-system-i386" +sdl =3D 0 +vnc =3D 1 +vncunused =3D 1 +vnclisten =3D "127.0.0.1" +vif =3D [ "mac=3D00:16:3e:66:92:9c,bridge=3Dxenbr1,script=3Dvif-bridge,mod= el=3De1000" ] +parallel =3D "none" +serial =3D "none" +builder =3D "hvm" +boot =3D "d" +nestedhvm =3D 0 +disk =3D [ "format=3Draw,vdev=3Dhda,access=3Drw,backendtype=3Dphy,target= =3D/dev/HostVG/XenGuest2", "format=3Dqcow2,vdev=3Dhdb,access=3Drw,backendty= pe=3Dqdisk,target=3D/var/lib/libvirt/images/XenGuest2-home", "format=3Draw,= vdev=3Dhdc,access=3Dro,backendtype=3Dqdisk,devtype=3Dcdrom,target=3D/root/b= oot.iso" ] diff --git a/tests/xlconfigdata/test-fullvirt-nestedhvm-disabled.xml b/test= s/xlconfigdata/test-fullvirt-nestedhvm-disabled.xml new file mode 100644 index 0000000..58b6338 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-nestedhvm-disabled.xml @@ -0,0 +1,61 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + + hvm + /usr/lib/xen/boot/hvmloader + + + + + + + + + + + + destroy + restart + restart + + /usr/lib/xen/bin/qemu-system-i386 + + + + +
+ + + + + +
+ + + + + + +
+ + + + + +