From nobody Wed Apr 1 08:43:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1488982283495270.49217899230587; Wed, 8 Mar 2017 06:11:23 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v28E7qVa016660; Wed, 8 Mar 2017 09:07:52 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v28E7o9Q001244 for ; Wed, 8 Mar 2017 09:07:50 -0500 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v28E7nJ0007553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 8 Mar 2017 09:07:50 -0500 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 025E64DD4B for ; Wed, 8 Mar 2017 14:07:48 +0000 (UTC) Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v28E7kCv029766 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Mar 2017 14:07:46 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v28E7j4c029914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 8 Mar 2017 14:07:46 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v28E7hLk003836; Wed, 8 Mar 2017 14:07:44 GMT Received: from nina.dynamic.ziggo.nl (/10.175.175.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Mar 2017 06:07:43 -0800 From: Wim Ten Have To: Libvirt Development List Date: Wed, 8 Mar 2017 15:07:14 +0100 Message-Id: <20170308140715.5837-3-wim.ten.have@oracle.com> In-Reply-To: <20170308140715.5837-1-wim.ten.have@oracle.com> References: <20170308140715.5837-1-wim.ten.have@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] 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, 08 Mar 2017 14:07:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 08 Mar 2017 14:07:49 +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.402 (BAYES_50, DCC_REPUT_00_12, RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, 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.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-loop: libvir-list@redhat.com Cc: Joao Martins , Wim ten Have Subject: [libvirt] [PATCH v1 2/3] xenconfig: add conversion of domxml nestedhvm 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Joao Martins In other words, on configurations containing (within its CPU element) one of the following for a host-passthrough mode: It will then generate (or parse) for nestedhvm=3D1 in/from xl format. Signed-off-by: Joao Martins Signed-off-by: Wim ten Have --- src/xenconfig/xen_xl.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 74f68b3..738dcd0 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -106,6 +106,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; =20 if (xenConfigGetString(conf, "bios", &bios, NULL) < 0) return -1; @@ -164,6 +165,35 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vir= CapsPtr caps) } def->os.nBootDevs++; } + + if (xenConfigGetBool(conf, "nestedhvm", &val, 0) < 0) { + return -1; + } else if (val) { + virCPUDefPtr cpu =3D NULL; + + if (VIR_ALLOC(cpu) < 0) + return -1; + + if (VIR_ALLOC_N(cpu->features, 1) < 0) + goto cleanup; + + cpu->features[0].policy =3D VIR_CPU_FEATURE_REQUIRE; + if (VIR_STRDUP(cpu->features[0].name, "vmx") < 0) + goto cleanup; + + 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; + cpu =3D NULL; + + cleanup: + if (cpu) { + VIR_FREE(cpu->features); + VIR_FREE(cpu); + return -1; + } + } } else { if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader= ) < 0) return -1; @@ -897,6 +927,17 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def) if (xenConfigSetString(conf, "boot", boot) < 0) return -1; =20 + if (def->cpu && def->cpu->nfeatures) { + for (i =3D 0; i < def->cpu->nfeatures; i++) { + if (def->cpu->features[i].policy =3D=3D VIR_CPU_FEATURE_RE= QUIRE && + (STREQ(def->cpu->features[i].name, "vmx") || + STREQ(def->cpu->features[i].name, "svm"))) + if (xenConfigSetInt(conf, "nestedhvm", 1) < 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