From nobody Sat Jul 12 10:29:04 2025 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.zohomail.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 1537319008173848.3535574937619; Tue, 18 Sep 2018 18:03:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B87D030015FC; Wed, 19 Sep 2018 01:03:25 +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 85C1B3091327; Wed, 19 Sep 2018 01:03:25 +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 42BDD18005DF; Wed, 19 Sep 2018 01:03:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8J130jH016348 for ; Tue, 18 Sep 2018 21:03:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 569357E4D0; Wed, 19 Sep 2018 01:03:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AC5C7DEF0 for ; Wed, 19 Sep 2018 01:02:57 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BBF386674 for ; Wed, 19 Sep 2018 01:02:56 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id CB5AF21F3C; Tue, 18 Sep 2018 21:02:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 18 Sep 2018 21:02:54 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 16554E405A; Tue, 18 Sep 2018 21:02:53 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=UaDPQximLLozO2NQAK9ISNnuhlel0vvUogIRtyYQ+ dU=; b=VhWFtGDw51yk8UAvGVgfhbyOM/TI8clhQbqIg/RMp19k+r7aocql/btZ9 q5bgGJXwX6b2Zz3nKhcJ8nMHowRxuw3yic48QSeSWVCmCOpK3wueTuQr8PSWF3ZG xb5nNFtvYvVHC3aLbaOTm0dP7zxUEYYBMf5WGF1MNcwSQoRLjPLm4tSIB2h9Loid IUyeEph8DsrU2XsAk1WYt0vm+wknO6cZV9GvD103aVod0hxItuBkBs/kELb1vgl1 TAM5sqIwLPLufaeFykfN8oklRqn8ZvI4vHeKGv0OWSgmL/TZeDgCl3yuwcW/K429 8N7/2NF5nsYGBKUrIlNbieyKn/P1g== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 19 Sep 2018 02:50:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 19 Sep 2018 01:02:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 19 Sep 2018 01:02:56 +0000 (UTC) for IP:'66.111.4.25' DOMAIN:'out1-smtp.messagingengine.com' HELO:'out1-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.25 out1-smtp.messagingengine.com 66.111.4.25 out1-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 5/8] libxl: add support for PVH 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 19 Sep 2018 01:03:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Since this is something between PV and HVM, it makes sense to put the setting in place where domain type is specified. To enable it, use .... It is also included in capabilities.xml, for every supported HVM guest type - it doesn't seems to be any other requirement (besides new enough Xen). Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes in v2 proposed by Jim: - use new_arch_added var instead of i =3D=3D nr_guest_archs for clarity - improve comment - adjust for now required Xen >=3D 4.6 (remove part for Xen < 4.5) --- docs/formatcaps.html.in | 4 ++-- docs/schemas/domaincommon.rng | 1 + src/libxl/libxl_capabilities.c | 33 ++++++++++++++++++++++++++++++--- src/libxl/libxl_conf.c | 32 +++++++++++++++++++++++++++----- src/libxl/libxl_driver.c | 6 ++++-- 5 files changed, 64 insertions(+), 12 deletions(-) diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in index 0d9c53d..b8102fd 100644 --- a/docs/formatcaps.html.in +++ b/docs/formatcaps.html.in @@ -104,8 +104,8 @@
machine
Machine type, for use in machine= attribute of os/type element in domain XML. For example Xen - supports xenfv for HVM or xenpv for - PV.
+ supports xenfv for HVM, xenpv for + PV, or xenpvh for PVHv2.
domain
The type attribut= e of this element specifies the type of hypervisor required to ru= n the domain. Use in type diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 099a949..820a7c6 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -341,6 +341,7 @@ xenpv xenfv + xenpvh diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 18596c7..446fa4c 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -57,6 +57,7 @@ struct guest_arch { virArch arch; int bits; int hvm; + int pvh; int pae; int nonpae; int ia64_be; @@ -439,6 +440,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) int hvm =3D STRPREFIX(&token[subs[1].rm_so], "hvm"); virArch arch; int pae =3D 0, nonpae =3D 0, ia64_be =3D 0; + bool new_arch_added =3D false; =20 if (STRPREFIX(&token[subs[2].rm_so], "x86_32")) { arch =3D VIR_ARCH_I686; @@ -475,8 +477,10 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) if (i >=3D ARRAY_CARDINALITY(guest_archs)) continue; /* Didn't find a match, so create a new one */ - if (i =3D=3D nr_guest_archs) + if (i =3D=3D nr_guest_archs) { nr_guest_archs++; + new_arch_added =3D true; + } =20 guest_archs[i].arch =3D arch; guest_archs[i].hvm =3D hvm; @@ -491,13 +495,34 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) guest_archs[i].nonpae =3D nonpae; if (ia64_be) guest_archs[i].ia64_be =3D ia64_be; + + /* + * Xen 4.9 introduced support for the PVH guest type, which + * requires hardware virtualization support similar to the + * HVM guest type. Add a PVH guest type for each new HVM + * guest type. + */ + if ((ver_info->xen_version_major > 4 || + (ver_info->xen_version_major =3D=3D 4 && + ver_info->xen_version_minor >=3D 9)) && + hvm && new_arch_added) { + i =3D nr_guest_archs; + /* Ensure we have not exhausted the guest_archs array */ + if (nr_guest_archs >=3D ARRAY_CARDINALITY(guest_archs)) + continue; + guest_archs[nr_guest_archs].arch =3D arch; + guest_archs[nr_guest_archs].pvh =3D 1; + nr_guest_archs++; + } } } regfree(®ex); =20 for (i =3D 0; i < nr_guest_archs; ++i) { virCapsGuestPtr guest; - char const *const xen_machines[] =3D {guest_archs[i].hvm ? "xenfv"= : "xenpv"}; + char const *const xen_machines[] =3D { + guest_archs[i].hvm ? "xenfv" : + (guest_archs[i].pvh ? "xenpvh" : "xenpv")}; virCapsGuestMachinePtr *machines; =20 if ((machines =3D virCapabilitiesAllocMachines(xen_machines, 1)) = =3D=3D NULL) @@ -557,7 +582,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) 1, 0) =3D=3D NULL) return -1; + } =20 + if (guest_archs[i].hvm || guest_archs[i].pvh) { if (virCapabilitiesAddGuestFeature(guest, "hap", 1, @@ -580,7 +607,7 @@ libxlMakeDomainOSCaps(const char *machine, =20 os->supported =3D true; =20 - if (STREQ(machine, "xenpv")) + if (STREQ(machine, "xenpv") || STREQ(machine, "xenpvh")) return 0; =20 capsLoader->supported =3D true; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index f3da0ed..5541a72 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -133,8 +133,11 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx, =20 libxl_domain_create_info_init(c_info); =20 - if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { - c_info->type =3D LIBXL_DOMAIN_TYPE_HVM; + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM || + (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN && + STREQ(def->os.machine, "xenpvh"))) { + c_info->type =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM ? + LIBXL_DOMAIN_TYPE_HVM : LIBXL_DOMAIN_TYPE_PVH; switch ((virTristateSwitch) def->features[VIR_DOMAIN_FEATURE_HAP])= { case VIR_TRISTATE_SWITCH_OFF: libxl_defbool_set(&c_info->hap, false); @@ -276,7 +279,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, virDomainClockDef clock =3D def->clock; libxl_ctx *ctx =3D cfg->ctx; libxl_domain_build_info *b_info =3D &d_config->b_info; - int hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; + bool hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; + bool pvh =3D STREQ(def->os.machine, "xenpvh"); size_t i; size_t nusbdevice =3D 0; =20 @@ -284,6 +288,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, =20 if (hvm) libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_HVM); + else if (pvh) + libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PVH); else libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PV); =20 @@ -375,7 +381,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, def->mem.cur_balloon =3D VIR_ROUND_UP(def->mem.cur_balloon, 1024); b_info->max_memkb =3D virDomainDefGetMemoryInitial(def); b_info->target_memkb =3D def->mem.cur_balloon; - if (hvm) { + if (hvm || pvh) { if (caps && def->cpu && def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROU= GH)) { bool hasHwVirt =3D false; @@ -647,6 +653,22 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, return -1; } #endif + } else if (pvh) { + if (VIR_STRDUP(b_info->cmdline, def->os.cmdline) < 0) + return -1; + if (VIR_STRDUP(b_info->kernel, def->os.kernel) < 0) + return -1; + if (VIR_STRDUP(b_info->ramdisk, def->os.initrd) < 0) + return -1; +#ifdef LIBXL_HAVE_BUILDINFO_BOOTLOADER + if (VIR_STRDUP(b_info->bootloader, def->os.bootloader) < 0) + return -1; + if (def->os.bootloaderArgs) { + if (!(b_info->bootloader_args =3D + virStringSplit(def->os.bootloaderArgs, " \t\n", 0))) + return -1; + } +#endif } else { /* * For compatibility with the legacy xen toolstack, default to pyg= rub @@ -1230,7 +1252,7 @@ libxlMakeNic(virDomainDefPtr def, STRNEQ(l_nic->model, "netfront")) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("only model 'netfront' is supported for " - "Xen PV domains")); + "Xen PV(H) domains")); return -1; } if (VIR_STRDUP(x_nic->model, l_nic->model) < 0) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index efd47a3..6287cef 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6398,9 +6398,11 @@ libxlConnectGetDomainCapabilities(virConnectPtr conn, emulatorbin =3D "/usr/bin/qemu-system-x86_64"; =20 if (machine) { - if (STRNEQ(machine, "xenpv") && STRNEQ(machine, "xenfv")) { + if (STRNEQ(machine, "xenpv") && + STRNEQ(machine, "xenpvh") && + STRNEQ(machine, "xenfv")) { virReportError(VIR_ERR_INVALID_ARG, "%s", - _("Xen only supports 'xenpv' and 'xenfv' machin= es")); + _("Xen only supports 'xenpv', 'xenpvh' and 'xen= fv' machines")); goto cleanup; } } else { --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list