From patchwork Wed Aug 22 15:00:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 144835 Delivered-To: patch@linaro.org Received: by 2002:a2e:164a:0:0:0:0:0 with SMTP id 10-v6csp137030ljw; Wed, 22 Aug 2018 08:03:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ9eTsGBlAUrAKtIZgTkpEmZXwhRUjmdNRl/DCcZwzD6Kdj9RyebF9+QK2dfkVhIHgV3o1Q X-Received: by 2002:a24:e4ca:: with SMTP id o193-v6mr3255733ith.132.1534950202624; Wed, 22 Aug 2018 08:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534950202; cv=none; d=google.com; s=arc-20160816; b=pd4mIWCMJdJmqWXCmN30lHhPUnhPIiW2uozm+ZHyjikBLfZfSy+SAq9sGbMKF1Sk1t YfayZtoa3erK3kVYzyFt9V/pOZwpe+sphNyOktT32viyrOpuqfaeeDkDwXWfopyT4hiN 1dmd2I5Y/Hsw8q2hQQ0l2D4oh+brdchtU0K9UVL/z1Zzjp6q3t3XdS5dDDFE8MCc4qlF d8uhXOvQtPKps2h6CrkdW3sEq+F1TJYaHCDO4FxYo9ZDGaYgjPXp8z2x2/a+cNlFwCbH L7gcm4XoToGTzCg5NQJgMUB2DkS9SIQEBezzkWxnuYEgQRQXtwZcyRIQ941DMZraDnjt seEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=/b7w3+7O0UXVf4pcoT1wK0RDptJLp+cw6tf+RaRUaP4=; b=BxfM3SlSvhwEjtdw1w0XNfDIm379HgcoRohXZ2JuboTUpjkmrWrUyxdG/H3vDkIsRI BYtQhdjxHt1J5vngOOvxe5GKmTdVEDDZrQXMIW9CntRLx0qjBG2gyGovFLUq4lU/c8oq Yr4QmGmso6y+SVlqjnnuDGwmYaIFdxaNNgqSSgWpf9mQYCu45ElxK+GD6UNt0jL/Wozh XxGKXK+JZMaTk0kcBgryBxfpNTSHVytmBnxUERTJyL49MxgyQxrsKhWX2CYVWVhfFDsb JcroG4YuPLkb215Ob95JfFGvMEQ+fnMJftu5dK1W5mCacwDtSEaiPtd9xsqKXfbv/E3r UFrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p8-v6si1401875iog.26.2018.08.22.08.03.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Aug 2018 08:03:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fsUcy-0002H5-MW; Wed, 22 Aug 2018 15:00:56 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fsUcx-0002Gs-LC for xen-devel@lists.xenproject.org; Wed, 22 Aug 2018 15:00:55 +0000 X-Inumbo-ID: fc7e1acc-a61b-11e8-a8a5-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id fc7e1acc-a61b-11e8-a8a5-bc764e045a96; Wed, 22 Aug 2018 16:59:36 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DC55315A2; Wed, 22 Aug 2018 08:00:53 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.emea.arm.com [10.4.12.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AB2873F2EA; Wed, 22 Aug 2018 08:00:52 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 22 Aug 2018 16:00:44 +0100 Message-Id: <20180822150045.22864-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180822150045.22864-1-julien.grall@arm.com> References: <20180822150045.22864-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 1/2] tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault to... X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, Julien Grall , sstabellini@kernel.org, ian.jackson@eu.citrix.com, roger.pau@citrix.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" libxl__arch_domain_build_info_setdefault A follow-up will require to modify default of multiple fields of build_info. So rename the function accordingly. Signed-off-by: Julien Grall Reviewed-by: Roger Pau Monné Acked-by: Wei Liu --- tools/libxl/libxl_arch.h | 3 +-- tools/libxl/libxl_arm.c | 4 ++-- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_x86.c | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index c8ccaaf14c..5ab0c95974 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -65,8 +65,7 @@ _hidden int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq); _hidden -void libxl__arch_domain_build_info_acpi_setdefault( - libxl_domain_build_info *b_info); +void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info); _hidden int libxl__arch_extra_memory(libxl__gc *gc, diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 3ee37d2d12..18c41f4ee9 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -1135,9 +1135,9 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq); } -void libxl__arch_domain_build_info_acpi_setdefault( - libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info) { + /* ACPI is disabled by default */ libxl_defbool_setdefault(&b_info->acpi, false); } diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index b7b44e280b..d4fa06daea 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (!b_info->event_channels) b_info->event_channels = 1023; - libxl__arch_domain_build_info_acpi_setdefault(b_info); + libxl__arch_domain_build_info_setdefault(b_info); libxl_defbool_setdefault(&b_info->dm_restrict, false); switch (b_info->type) { diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 6f670b03b5..81523a568f 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -613,8 +613,7 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, return rc; } -void libxl__arch_domain_build_info_acpi_setdefault( - libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info) { libxl_defbool_setdefault(&b_info->acpi, true); } From patchwork Wed Aug 22 15:00:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 144837 Delivered-To: patch@linaro.org Received: by 2002:a2e:164a:0:0:0:0:0 with SMTP id 10-v6csp137082ljw; Wed, 22 Aug 2018 08:03:26 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda0rLajiabTFCmu8wJoSyoLQBdlwC5ZqcWHKzkGgJHM02SBl/UZGYIO9nVBpiFLFjm/Emtq X-Received: by 2002:a24:8782:: with SMTP id f124-v6mr3415376ite.87.1534950205790; Wed, 22 Aug 2018 08:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534950205; cv=none; d=google.com; s=arc-20160816; b=a9zwMs8WL4KdqFNXcdlrM9FzHX+viHOAteLAXm6ggWfI5sDOsORYWt0nW1e4+IsKYG cGtQ8dRKhKA/AthbYL00Y8voLLI0Jnh4R7Cp5E51aazHd5Vt6nn3C1xcKgq/obsndzb5 eWr9K3ZPsNm5tryFWr7JpxhJ4IYiJAnghdaNKNVJz1kCd1Phbxj/w57uCHHsX6bhONdP SqKmCoZoYpUAiOyPvx28TVWI07kbho4hA2ncAc3HYf6EsBLz2luXhF+vDsDUpbULQk/K KAlr8iGHpE9WLsx5eIoiUytW9J809jOjZhdMSKh52G1KWa9lv7ENaAQymeOwPlJkp8h9 3vtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=F9LQNoZJgIANlgEqLGQe59OYcFMKa8EojaEmJ9w5j00=; b=BqWFqm2us24lohMd2zRKZw6bEOOeGkLsktbIb+a+Oj7/vYa1/RY+Fs8Aa4TjLtWoI2 KnAE9Xhi6cd8YDKwZEXjXuoKCX4ai9XTyXsZCMhc+g2T0rT3HzJuZ+5Psxqn2gilA3Er hzLEFM8f4y/sBAAzibNBDQFHwg5UBog+5kR4UyubYPqXe5ftP1ISp9SxZbphVtmvTHQt luzXKU9h4QvoFD06OaaXaYmSANesQStxWg138b+hG5a7wGG0KAC7yuM38nK7x400Ja1B USUbdK4UYLh6CzZrJeA+LM4kZ0LxYcp6HvwNUVxCEmN5g1Qn5wbu4i2byRaKIynumNFV d2Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u16-v6si1201323iob.221.2018.08.22.08.03.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Aug 2018 08:03:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fsUcz-0002HB-Vt; Wed, 22 Aug 2018 15:00:57 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fsUcy-0002H0-54 for xen-devel@lists.xenproject.org; Wed, 22 Aug 2018 15:00:56 +0000 X-Inumbo-ID: fd5c0593-a61b-11e8-a8a5-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id fd5c0593-a61b-11e8-a8a5-bc764e045a96; Wed, 22 Aug 2018 16:59:38 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59152ED1; Wed, 22 Aug 2018 08:00:55 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.emea.arm.com [10.4.12.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 267BD3F2EA; Wed, 22 Aug 2018 08:00:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 22 Aug 2018 16:00:45 +0100 Message-Id: <20180822150045.22864-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180822150045.22864-1-julien.grall@arm.com> References: <20180822150045.22864-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 2/2] tools/libxl: Switch Arm guest type to PVH X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, Julien Grall , sstabellini@kernel.org, ian.jackson@eu.citrix.com, roger.pau@citrix.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH. To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH. Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user. Signed-off-by: Julien Grall --- This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with XEN_DOMCTL_CDF_hap unset. I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH. Changes in v2: - Rather than denying PV guest, convert them to PVH. --- docs/man/xl.cfg.pod.5.in | 3 ++- tools/libxl/libxl_arch.h | 3 ++- tools/libxl/libxl_arm.c | 39 +++++++++++++++++++++++++++++++++++++-- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_x86.c | 3 ++- tools/xl/xl_parse.c | 4 ++++ 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in index b72718151b..a0568e397d 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -86,7 +86,8 @@ guest operating systems. This is the default. Specifies that this is to be an PVH domain. That is a lightweight HVM-like guest without a device model and without many of the emulated devices -available to HVM guests. Note that this mode requires a PVH aware kernel. +available to HVM guests. Note that this mode requires a PVH aware kernel on +x86. =item B diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index 5ab0c95974..930570ef1e 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -65,7 +65,8 @@ _hidden int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq); _hidden -void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info); +void libxl__arch_domain_build_info_setdefault(libxl__gc *gc, + libxl_domain_build_info *b_info); _hidden int libxl__arch_extra_memory(libxl__gc *gc, diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 18c41f4ee9..0cf92d7af4 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -978,7 +978,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc, int rc; uint64_t val; - assert(info->type == LIBXL_DOMAIN_TYPE_PV); + if (info->type != LIBXL_DOMAIN_TYPE_PVH) { + LOG(ERROR, "Unsupported Arm guest type %s", + libxl_domain_type_to_string(info->type)); + return ERROR_FAIL; + } /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */ val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI, @@ -1135,10 +1139,41 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq); } -void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault(libxl__gc *gc, + libxl_domain_build_info *b_info) { /* ACPI is disabled by default */ libxl_defbool_setdefault(&b_info->acpi, false); + + /* + * Arm guest are now considered as PVH by the toolstack. To allow + * compatibility with previous toolstack, PV guest are automatically + * converted to PVH. + */ + if (b_info->type != LIBXL_DOMAIN_TYPE_PV) + return; + + LOG(WARN, "Converting PV guest to PVH"); + LOG(WARN, "ARM guest are now PVH. Please update your toolstack."); + + b_info->type = LIBXL_DOMAIN_TYPE_PVH; + + /* + * They only field in u.pv that matters on Arm are: kernel, cmdline, + * ramdisk. + */ + + if (!b_info->kernel && b_info->u.pv.kernel) + b_info->kernel = b_info->u.pv.kernel; + + if (!b_info->ramdisk && b_info->u.pv.ramdisk) + b_info->ramdisk = b_info->u.pv.ramdisk; + + if (!b_info->cmdline && b_info->u.pv.cmdline) + b_info->cmdline = b_info->u.pv.cmdline; + + /* Reset b_info->u.pvh to default values */ + memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh)); } /* diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index d4fa06daea..a6431c5d3f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (!b_info->event_channels) b_info->event_channels = 1023; - libxl__arch_domain_build_info_setdefault(b_info); + libxl__arch_domain_build_info_setdefault(gc, b_info); libxl_defbool_setdefault(&b_info->dm_restrict, false); switch (b_info->type) { diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 81523a568f..8b6759c089 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc, return rc; } -void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault(libxl__gc *gc, + libxl_domain_build_info *b_info) { libxl_defbool_setdefault(&b_info->acpi, true); } diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 971ec1bc56..0bda28152b 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source, } if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID) +#if defined(__arm__) || defined(__aarch64__) + c_info->type = LIBXL_DOMAIN_TYPE_PVH; +#else c_info->type = LIBXL_DOMAIN_TYPE_PV; +#endif xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0);