From patchwork Tue Apr 10 11:24:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 133067 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1192109ljb; Tue, 10 Apr 2018 04:27:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx488qtNhoWdXCRPkxGGrBUQ4rb4rbTUSvzJ1SGjxGXaMYBOupEN2k+zImonDeV2N+tpOX52s X-Received: by 2002:a24:3d4f:: with SMTP id n76-v6mr1741341itn.147.1523359673737; Tue, 10 Apr 2018 04:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523359673; cv=none; d=google.com; s=arc-20160816; b=jALQYh9r9+4O+tMJlWp5TEx+exuo+H5ySvvPXUYcWWIj+ekpx+e143Ua7/RZubFZ2s EMJO3Z8RzlLEU/CbMi5X6kR8jUSJsfvXplHtlRaQXWiwR15LbhNnKL5rjkxPpAuaYDBv f03tIziy5OfzVzSkMMjsS7EeppYyEdnFzj1TIhzEyXtsx7AeyAVjOudwjJ0VVX8yChDV v2slyI/DASbIpBxMABFut8bAOYusCllOYV4HQdNiABuGZQFBgL9dHh52TssYgvR6/h8B qzfPLI/s1blgEWPEM5ZF+uDm7q5gdJJcbc9Cxe0vKHYaIZRXXmBRnqfuN+aCeadlOihF g95w== 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:message-id:date:to:from :arc-authentication-results; bh=GHfNn6tqbl2BSTkzSxY3E1oOAxVXVT/iBUqazUENYGc=; b=YTM6fMKeqYFIwLFbqxvbTp5DRwiJalrERicBZ4wHuTI+t+bxNXL1g/BHGZ9ukgkUBI fH/t3p3mJAF8+pmxq+0QMRIr7QBRvckfhpW41RdBm7Rd+hNXyklLAfqeWcpmTjtFvKv0 Ui0MsaiAi5he3X7G7XcD864kcLXoN5v6pjdox8aGEWHcI6VQRWX1afPYd4F7ph34mqZT DNMtDigkry7WG0U8vsj83lmWDNKRiyag5u+3GVQ+wbZ7x8wtXiAyl+9To7esLxtZA0ZQ lAjpbWgejFoLK+RGByyscEX+dTCwE1o7CWZqrjLCJv9MDDRxg/RyEb9BG/72jdPvqzhY eshA== 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 x139-v6si1173747itb.131.2018.04.10.04.27.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Apr 2018 04:27:53 -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 1f5rOZ-00010o-Sa; Tue, 10 Apr 2018 11:25:03 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1f5rOZ-00010j-Cw for xen-devel@lists.xen.org; Tue, 10 Apr 2018 11:25:03 +0000 X-Inumbo-ID: 05d5a3c8-3cb2-11e8-8249-2fda3a446a53 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 05d5a3c8-3cb2-11e8-8249-2fda3a446a53; Tue, 10 Apr 2018 11:26:33 +0000 (UTC) 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 8E60F80D; Tue, 10 Apr 2018 04:25:00 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3A67D3F24A; Tue, 10 Apr 2018 04:24:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 10 Apr 2018 12:24:53 +0100 Message-Id: <20180410112453.16252-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [for-4.11][PATCH] libxl: arm: Fix build after c/s 74fd984ae 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: jgross@suse.com, sstabellini@kernel.org, wei.liu2@citrix.com, Andrew.Cooper3@citrix.com, ian.jackson@eu.citrix.com, Julien Grall MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" c/s 74fd984ae "tools/libxl: Drop xc_domain_configuration_t from libxl__domain_build_state" removed state->config completely but missed some conversion libxl_arm.c. Furthermore, not all the fields of xc_domain_configuration_t have a corresponding field in libxl_domain_build_info. This is the case of clock_frequency. As the field should not be exposed to the user, add a corresponding field in libxl__domain_build_state. This require some modification in the prototype of libxl__domain_make in order to have the state. For all the other fields, use the up-to-date version in libxl_domain_build-info. Signed-off-by: Julien Grall Acked-by: Wei Liu --- tools/libxl/libxl_arch.h | 1 + tools/libxl/libxl_arm.c | 25 +++++++++++++------------ tools/libxl/libxl_create.c | 5 +++-- tools/libxl/libxl_dm.c | 3 ++- tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_x86.c | 1 + 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index e3b6f5f41a..318c111bb4 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -25,6 +25,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, _hidden int libxl__arch_domain_save_config(libxl__gc *gc, libxl_domain_config *d_config, + libxl__domain_build_state *state, const xc_domain_configuration_t *xc_config); /* arch specific internal domain creation function */ diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index fbe8786a8e..8af9f6f992 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -25,12 +25,12 @@ #define DT_IRQ_TYPE_LEVEL_HIGH 0x00000004 #define DT_IRQ_TYPE_LEVEL_LOW 0x00000008 -static const char *gicv_to_string(uint8_t gic_version) +static const char *gicv_to_string(libxl_gic_version gic_version) { switch (gic_version) { - case XEN_DOMCTL_CONFIG_GIC_V2: + case LIBXL_GIC_VERSION_V2: return "V2"; - case XEN_DOMCTL_CONFIG_GIC_V3: + case LIBXL_GIC_VERSION_V3: return "V3"; default: return "unknown"; @@ -110,6 +110,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, int libxl__arch_domain_save_config(libxl__gc *gc, libxl_domain_config *d_config, + libxl__domain_build_state *state, const xc_domain_configuration_t *xc_config) { switch (xc_config->gic_version) { @@ -124,6 +125,8 @@ int libxl__arch_domain_save_config(libxl__gc *gc, return ERROR_FAIL; } + state->clock_frequency = xc_config->clock_frequency; + return 0; } @@ -846,9 +849,6 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_build_info *info, const libxl_version_info *vers; const struct arch_info *ainfo; - /* convenience aliases */ - xc_domain_configuration_t *xc_config = &state->config; - vers = libxl_get_version_info(CTX); if (vers == NULL) return ERROR_FAIL; @@ -857,7 +857,8 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_build_info *info, LOG(DEBUG, "constructing DTB for Xen version %d.%d guest", vers->xen_version_major, vers->xen_version_minor); - LOG(DEBUG, " - vGIC version: %s", gicv_to_string(xc_config->gic_version)); + LOG(DEBUG, " - vGIC version: %s", + gicv_to_string(info->arch_arm.gic_version)); if (info->device_tree) { LOG(DEBUG, " - Partial device tree provided: %s", info->device_tree); @@ -922,23 +923,23 @@ next_resize: FDT( make_memory_nodes(gc, fdt, dom) ); - switch (xc_config->gic_version) { - case XEN_DOMCTL_CONFIG_GIC_V2: + switch (info->arch_arm.gic_version) { + case LIBXL_GIC_VERSION_V2: FDT( make_gicv2_node(gc, fdt, GUEST_GICD_BASE, GUEST_GICD_SIZE, GUEST_GICC_BASE, GUEST_GICC_SIZE) ); break; - case XEN_DOMCTL_CONFIG_GIC_V3: + case LIBXL_GIC_VERSION_V3: FDT( make_gicv3_node(gc, fdt) ); break; default: LOG(ERROR, "Unknown GIC version %s", - gicv_to_string(xc_config->gic_version)); + gicv_to_string(info->arch_arm.gic_version)); rc = ERROR_FAIL; goto out; } - FDT( make_timer_node(gc, fdt, ainfo, xc_config->clock_frequency) ); + FDT( make_timer_node(gc, fdt, ainfo, state->clock_frequency) ); FDT( make_hypervisor_node(gc, fdt, vers) ); if (info->arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 692461a5a1..b5e27a7766 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -538,6 +538,7 @@ out: } int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, + libxl__domain_build_state *state, uint32_t *domid) { libxl_ctx *ctx = libxl__gc_owner(gc); @@ -590,7 +591,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, goto out; } - rc = libxl__arch_domain_save_config(gc, d_config, &xc_config); + rc = libxl__arch_domain_save_config(gc, d_config, state, &xc_config); if (rc < 0) goto out; } @@ -958,7 +959,7 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } - ret = libxl__domain_make(gc, d_config, &domid); + ret = libxl__domain_make(gc, d_config, &dcs->build_state, &domid); if (ret) { LOGD(ERROR, domid, "cannot make domain: %d", ret); dcs->guest_domid = domid; diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 7f795a4ffd..b662395b2e 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1960,7 +1960,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) stubdom_state->pv_ramdisk.path = ""; /* fixme: this function can leak the stubdom if it fails */ - ret = libxl__domain_make(gc, dm_config, &sdss->pvqemu.guest_domid); + ret = libxl__domain_make(gc, dm_config, stubdom_state, + &sdss->pvqemu.guest_domid); if (ret) goto out; uint32_t dm_domid = sdss->pvqemu.guest_domid; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 584410d705..6352380644 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1147,6 +1147,9 @@ typedef struct { xen_pfn_t vuart_gfn; evtchn_port_t vuart_port; + + /* ARM only to deal with broken firmware */ + uint32_t clock_frequency; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, @@ -1655,6 +1658,7 @@ _hidden void libxl__exec(libxl__gc *gc, int stdinfd, int stdoutfd, * on exit (even error exit), domid may be valid and refer to a domain */ _hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, + libxl__domain_build_state *state, uint32_t *domid); _hidden int libxl__domain_build(libxl__gc *gc, diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 78affdd37a..4573d6764d 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -26,6 +26,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, int libxl__arch_domain_save_config(libxl__gc *gc, libxl_domain_config *d_config, + libxl__domain_build_state *state, const xc_domain_configuration_t *xc_config) { return 0;