* [PATCH 0/2] Fix xc_domain_config usage
@ 2015-11-13 11:05 Roger Pau Monne
2015-11-13 11:05 ` [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create Roger Pau Monne
` (2 more replies)
0 siblings, 3 replies; 19+ messages in thread
From: Roger Pau Monne @ 2015-11-13 11:05 UTC (permalink / raw)
To: xen-devel
Hello,
Due to the HVMlite patches now x86 always requires a valid arch domain
config. This is currently causing problems to out-of-tree toolstacks that
are based on the Ocaml or the python bindings, since those bindings have lost
the ability to create HVM guests because a zeroed arch domain config is
always used regardless of the guest type.
In order to fix this add a new parameter to xc_domain_create that's a
pointer to a arch domain config that can be null (the function itself will
set a sensible default based on the guest type). Since
xc_domain_create_config is meaningless now just remove it.
The in-tree callers are fixed in the first patch, while Qemu is fixed in the
second patch. I'm not sure how this is going to work with the push gate,
since both patches should be applied and tested together, or else Qemu build
is going to fail.
Thanks, Roger.
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create 2015-11-13 11:05 [PATCH 0/2] Fix xc_domain_config usage Roger Pau Monne @ 2015-11-13 11:05 ` Roger Pau Monne 2015-11-13 12:41 ` Andrew Cooper 2015-11-13 11:05 ` [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder Roger Pau Monne 2015-11-13 11:05 ` [Qemu-devel] " Roger Pau Monne 2 siblings, 1 reply; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 11:05 UTC (permalink / raw) To: xen-devel; +Cc: Roger Pau Monne With the addition of HVMlite the hypervisor now always requires a non-null arch domain config, which is different between HVM and PV guests. Add a new parameter to xc_domain_create that contains a pointer to an arch domain config. If the pointer is null, create a default arch domain config based on guest type. Fix all the in-tree callers to provide a null arch domain config in order to mimic previous behaviour. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- tools/libxc/include/xenctrl.h | 14 +++------- tools/libxc/xc_domain.c | 51 +++++++++++++++-------------------- tools/libxl/libxl_create.c | 5 ++-- tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +- tools/python/xen/lowlevel/xc/xc.c | 2 +- tools/xenstore/init-xenstore-domain.c | 2 +- 6 files changed, 29 insertions(+), 47 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 2fec1fb..01a6dda 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -502,17 +502,9 @@ typedef union typedef struct xen_arch_domainconfig xc_domain_configuration_t; -int xc_domain_create_config(xc_interface *xch, - uint32_t ssidref, - xen_domain_handle_t handle, - uint32_t flags, - uint32_t *pdomid, - xc_domain_configuration_t *config); -int xc_domain_create(xc_interface *xch, - uint32_t ssidref, - xen_domain_handle_t handle, - uint32_t flags, - uint32_t *pdomid); +int xc_domain_create(xc_interface *xch, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid, xc_domain_configuration_t *config); /* Functions to produce a dump of a given domain diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index e7278dd..0839e03 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -26,16 +26,31 @@ #include <xen/memory.h> #include <xen/hvm/hvm_op.h> -int xc_domain_create_config(xc_interface *xch, - uint32_t ssidref, - xen_domain_handle_t handle, - uint32_t flags, - uint32_t *pdomid, - xc_domain_configuration_t *config) +int xc_domain_create(xc_interface *xch, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid, xc_domain_configuration_t *config) { + xc_domain_configuration_t lconfig; int err; DECLARE_DOMCTL; + if ( config == NULL ) + { + memset(&lconfig, 0, sizeof(lconfig)); + +#if defined (__i386) || defined(__x86_64__) + if ( flags & XEN_DOMCTL_CDF_hvm_guest ) + lconfig.emulation_flags = XEN_X86_EMU_ALL; +#elif defined (__arm__) || defined(__aarch64__) + lconfig.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE; + lconfig.nr_spis = 0; +#else +#error Architecture not supported +#endif + + config = &lconfig; + } + domctl.cmd = XEN_DOMCTL_createdomain; domctl.domain = (domid_t)*pdomid; domctl.u.createdomain.ssidref = ssidref; @@ -52,30 +67,6 @@ int xc_domain_create_config(xc_interface *xch, return 0; } -int xc_domain_create(xc_interface *xch, - uint32_t ssidref, - xen_domain_handle_t handle, - uint32_t flags, - uint32_t *pdomid) -{ - xc_domain_configuration_t config; - - memset(&config, 0, sizeof(config)); - -#if defined (__i386) || defined(__x86_64__) - /* No arch-specific configuration for now */ -#elif defined (__arm__) || defined(__aarch64__) - config.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE; - config.nr_spis = 0; -#else - errno = ENOSYS; - return -1; -#endif - - return xc_domain_create_config(xch, ssidref, handle, - flags, pdomid, &config); -} - int xc_domain_cacheflush(xc_interface *xch, uint32_t domid, xen_pfn_t start_pfn, xen_pfn_t nr_pfns) { diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f0fee00..4fbe7ac 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -528,9 +528,8 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, /* Valid domid here means we're soft resetting. */ if (!libxl_domid_valid_guest(*domid)) { - ret = xc_domain_create_config(ctx->xch, info->ssidref, - handle, flags, domid, - xc_config); + ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid, + xc_config); if (ret < 0) { LOGE(ERROR, "domain creation fail"); rc = ERROR_FAIL; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index b7de615..393156c 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -175,7 +175,7 @@ CAMLprim value stub_xc_domain_create(value xch, value ssidref, } caml_enter_blocking_section(); - result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid); + result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid, NULL); caml_leave_blocking_section(); if (result < 0) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 26290a3..5a0ea33 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -136,7 +136,7 @@ static PyObject *pyxc_domain_create(XcObject *self, } if ( (ret = xc_domain_create(self->xc_handle, ssidref, - handle, flags, &dom)) < 0 ) + handle, flags, &dom, NULL)) < 0 ) return pyxc_error_to_exception(self->xc_handle); if ( target ) diff --git a/tools/xenstore/init-xenstore-domain.c b/tools/xenstore/init-xenstore-domain.c index 0d12169..297afe5 100644 --- a/tools/xenstore/init-xenstore-domain.c +++ b/tools/xenstore/init-xenstore-domain.c @@ -28,7 +28,7 @@ static int build(xc_interface *xch, int argc, char** argv) rv = xc_flask_context_to_sid(xch, argv[3], strlen(argv[3]), &ssid); if (rv) goto err; - rv = xc_domain_create(xch, ssid, handle, 0, &domid); + rv = xc_domain_create(xch, ssid, handle, 0, &domid, NULL); if (rv) goto err; rv = xc_domain_max_vcpus(xch, domid, 1); if (rv) goto err; -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create 2015-11-13 11:05 ` [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create Roger Pau Monne @ 2015-11-13 12:41 ` Andrew Cooper 2015-11-16 11:37 ` Ian Campbell 0 siblings, 1 reply; 19+ messages in thread From: Andrew Cooper @ 2015-11-13 12:41 UTC (permalink / raw) To: Roger Pau Monne, xen-devel On 13/11/15 11:05, Roger Pau Monne wrote: > With the addition of HVMlite the hypervisor now always requires a non-null > arch domain config, which is different between HVM and PV guests. > > Add a new parameter to xc_domain_create that contains a pointer to an arch > domain config. If the pointer is null, create a default arch domain config > based on guest type. > > Fix all the in-tree callers to provide a null arch domain config in order to > mimic previous behaviour. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create 2015-11-13 12:41 ` Andrew Cooper @ 2015-11-16 11:37 ` Ian Campbell 2015-12-03 15:27 ` Ian Campbell 0 siblings, 1 reply; 19+ messages in thread From: Ian Campbell @ 2015-11-16 11:37 UTC (permalink / raw) To: Andrew Cooper, Roger Pau Monne, xen-devel; +Cc: Stefano Stabellini On Fri, 2015-11-13 at 12:41 +0000, Andrew Cooper wrote: > On 13/11/15 11:05, Roger Pau Monne wrote: > > With the addition of HVMlite the hypervisor now always requires a non- > > null > > arch domain config, which is different between HVM and PV guests. > > > > Add a new parameter to xc_domain_create that contains a pointer to an > > arch > > domain config. If the pointer is null, create a default arch domain > > config > > based on guest type. > > > > Fix all the in-tree callers to provide a null arch domain config in > > order to > > mimic previous behaviour. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> I went to apply but of course it broke without the corresponding qemu change already being in the qemu-xen.git tree. According to <alpine.DEB.2.02.1511131735060.2653@kaball.uk.xensource.com> S tefano has applied to his tree, but I think it hasn't been sent upstream. Please someone let me know when this change is in our qemu-xen.git#master (i.e. applied to staging and passed through the push gate) and I'll pick up this one then. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create 2015-11-16 11:37 ` Ian Campbell @ 2015-12-03 15:27 ` Ian Campbell 0 siblings, 0 replies; 19+ messages in thread From: Ian Campbell @ 2015-12-03 15:27 UTC (permalink / raw) To: Andrew Cooper, Roger Pau Monne, xen-devel; +Cc: Stefano Stabellini On Mon, 2015-11-16 at 11:37 +0000, Ian Campbell wrote: > On Fri, 2015-11-13 at 12:41 +0000, Andrew Cooper wrote: > > On 13/11/15 11:05, Roger Pau Monne wrote: > > > With the addition of HVMlite the hypervisor now always requires a > > > non- > > > null > > > arch domain config, which is different between HVM and PV guests. > > > > > > Add a new parameter to xc_domain_create that contains a pointer to an > > > arch > > > domain config. If the pointer is null, create a default arch domain > > > config > > > based on guest type. > > > > > > Fix all the in-tree callers to provide a null arch domain config in > > > order to > > > mimic previous behaviour. > > > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > > > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> > > Acked-by: Ian Campbell <ian.campbell@citrix.com> > > I went to apply but of course it broke without the corresponding qemu > change already being in the qemu-xen.git tree. > > According to <alpine.DEB.2.02.1511131735060.2653@kaball.uk.xensource.com> S > tefano has applied to his tree, but I think it hasn't been sent upstream. > > Please someone let me know when this change is in our qemu-xen.git#master > (i.e. applied to staging and passed through the push gate) and I'll pick up > this one then. I spotted the qemu fix coming through this afternoon => applied. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 11:05 [PATCH 0/2] Fix xc_domain_config usage Roger Pau Monne 2015-11-13 11:05 ` [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create Roger Pau Monne @ 2015-11-13 11:05 ` Roger Pau Monne 2015-11-13 11:05 ` [Qemu-devel] " Roger Pau Monne 2 siblings, 0 replies; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 11:05 UTC (permalink / raw) To: xen-devel; +Cc: Stefano Stabellini, qemu-devel, Roger Pau Monne Due to the addition of HVMlite and the requirement to always provide a valid xc_domain_configuration_t, xc_domain_create now always takes an arch domain config, which can be NULL in order to mimic previous behaviour. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: qemu-devel@nongnu.org --- hw/xenpv/xen_domainbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index c0ab753..a737908 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, int rc; memcpy(uuid, qemu_uuid, sizeof(uuid)); - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); + rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); if (rc < 0) { fprintf(stderr, "xen: xc_domain_create() failed\n"); goto err; -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 11:05 [PATCH 0/2] Fix xc_domain_config usage Roger Pau Monne 2015-11-13 11:05 ` [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create Roger Pau Monne 2015-11-13 11:05 ` [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder Roger Pau Monne @ 2015-11-13 11:05 ` Roger Pau Monne 2015-11-13 11:09 ` Stefano Stabellini 2015-11-13 11:09 ` [PATCH QEMU " Stefano Stabellini 2 siblings, 2 replies; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 11:05 UTC (permalink / raw) To: xen-devel; +Cc: Stefano Stabellini, qemu-devel, Roger Pau Monne Due to the addition of HVMlite and the requirement to always provide a valid xc_domain_configuration_t, xc_domain_create now always takes an arch domain config, which can be NULL in order to mimic previous behaviour. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: qemu-devel@nongnu.org --- hw/xenpv/xen_domainbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index c0ab753..a737908 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, int rc; memcpy(uuid, qemu_uuid, sizeof(uuid)); - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); + rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); if (rc < 0) { fprintf(stderr, "xen: xc_domain_create() failed\n"); goto err; -- 1.9.5 (Apple Git-50.3) ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 11:05 ` [Qemu-devel] " Roger Pau Monne @ 2015-11-13 11:09 ` Stefano Stabellini 2015-11-13 12:18 ` [Qemu-devel] [PATCH QEMU v2 " Roger Pau Monne 2015-11-13 12:18 ` Roger Pau Monne 2015-11-13 11:09 ` [PATCH QEMU " Stefano Stabellini 1 sibling, 2 replies; 19+ messages in thread From: Stefano Stabellini @ 2015-11-13 11:09 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, qemu-devel, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 1288 bytes --] On Fri, 13 Nov 2015, Roger Pau Monne wrote: > Due to the addition of HVMlite and the requirement to always provide a valid > xc_domain_configuration_t, xc_domain_create now always takes an arch domain > config, which can be NULL in order to mimic previous behaviour. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Give a look at include/hw/xen/xen_common.h and add a compatibility shim there. Keep in mind that QEMU needs to build against any version of Xen from 4.0 onward. > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: qemu-devel@nongnu.org > --- > hw/xenpv/xen_domainbuild.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c > index c0ab753..a737908 100644 > --- a/hw/xenpv/xen_domainbuild.c > +++ b/hw/xenpv/xen_domainbuild.c > @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, > int rc; > > memcpy(uuid, qemu_uuid, sizeof(uuid)); > - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > + rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); > if (rc < 0) { > fprintf(stderr, "xen: xc_domain_create() failed\n"); > goto err; > -- > 1.9.5 (Apple Git-50.3) > ^ permalink raw reply [flat|nested] 19+ messages in thread
* [Qemu-devel] [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 11:09 ` Stefano Stabellini @ 2015-11-13 12:18 ` Roger Pau Monne 2015-11-13 13:46 ` Stefano Stabellini 2015-11-13 13:46 ` Stefano Stabellini 2015-11-13 12:18 ` Roger Pau Monne 1 sibling, 2 replies; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 12:18 UTC (permalink / raw) To: xen-devel; +Cc: Stefano Stabellini, qemu-devel, Roger Pau Monne Due to the addition of HVMlite and the requirement to always provide a valid xc_domain_configuration_t, xc_domain_create now always takes an arch domain config, which can be NULL in order to mimic previous behaviour. Add a small stub called xen_domain_create that encapsulates the correct call to xc_domain_create depending on the libxc version detected. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: qemu-devel@nongnu.org --- Changes since v1: - Add a compat layer to support previous libxc versions. - Add machinery to detect current Xen unstable (4.7). --- configure | 17 +++++++++++++++++ hw/xenpv/xen_domainbuild.c | 2 +- include/hw/xen/xen_common.h | 12 ++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 779623a..001982f 100755 --- a/configure +++ b/configure @@ -1863,6 +1863,23 @@ EOF elif cat > $TMPC <<EOF && #include <xenctrl.h> +#include <stdint.h> +int main(void) { + xc_interface *xc = NULL; + xen_domain_handle_t handle; + xc_domain_create(xc, 0, handle, 0, NULL, NULL); + return 0; +} +EOF + compile_prog "" "$xen_libs" + then + xen_ctrl_version=470 + xen=yes + + # Xen 4.6 + elif + cat > $TMPC <<EOF && +#include <xenctrl.h> #include <xenstore.h> #include <stdint.h> #include <xen/hvm/hvm_info_table.h> diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index c0ab753..07814f6 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, int rc; memcpy(uuid, qemu_uuid, sizeof(uuid)); - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); if (rc < 0) { fprintf(stderr, "xen: xc_domain_create() failed\n"); goto err; diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 5923290..e5ba732 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -417,4 +417,16 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, #endif +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid, + xc_domain_configuration_t *config) +{ +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 + return xc_domain_create(xc, ssidref, handle, flags, pdomid); +#else + return xc_domain_create(xc, ssidref, handle, flags, pdomid, config); +#endif +} + #endif /* QEMU_HW_XEN_COMMON_H */ -- 1.9.5 (Apple Git-50.3) ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 12:18 ` [Qemu-devel] [PATCH QEMU v2 " Roger Pau Monne @ 2015-11-13 13:46 ` Stefano Stabellini 2015-11-13 13:54 ` Ian Campbell 2015-11-13 13:54 ` [PATCH QEMU v2 " Ian Campbell 2015-11-13 13:46 ` Stefano Stabellini 1 sibling, 2 replies; 19+ messages in thread From: Stefano Stabellini @ 2015-11-13 13:46 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, Ian Campbell, qemu-devel, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 3604 bytes --] On Fri, 13 Nov 2015, Roger Pau Monne wrote: > Due to the addition of HVMlite and the requirement to always provide a valid > xc_domain_configuration_t, xc_domain_create now always takes an arch domain > config, which can be NULL in order to mimic previous behaviour. > > Add a small stub called xen_domain_create that encapsulates the correct call > to xc_domain_create depending on the libxc version detected. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> FYI this is going to conflict with Ian's series: 1447070487-31229-1-git-send-email-ian.campbell@citrix.com Is the corresponding libxc change already in Xen? > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: qemu-devel@nongnu.org > --- > Changes since v1: > - Add a compat layer to support previous libxc versions. > - Add machinery to detect current Xen unstable (4.7). > --- > configure | 17 +++++++++++++++++ > hw/xenpv/xen_domainbuild.c | 2 +- > include/hw/xen/xen_common.h | 12 ++++++++++++ > 3 files changed, 30 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 779623a..001982f 100755 > --- a/configure > +++ b/configure > @@ -1863,6 +1863,23 @@ EOF > elif > cat > $TMPC <<EOF && > #include <xenctrl.h> > +#include <stdint.h> > +int main(void) { > + xc_interface *xc = NULL; > + xen_domain_handle_t handle; > + xc_domain_create(xc, 0, handle, 0, NULL, NULL); > + return 0; > +} > +EOF > + compile_prog "" "$xen_libs" > + then > + xen_ctrl_version=470 > + xen=yes > + > + # Xen 4.6 > + elif > + cat > $TMPC <<EOF && > +#include <xenctrl.h> > #include <xenstore.h> > #include <stdint.h> > #include <xen/hvm/hvm_info_table.h> > diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c > index c0ab753..07814f6 100644 > --- a/hw/xenpv/xen_domainbuild.c > +++ b/hw/xenpv/xen_domainbuild.c > @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, > int rc; > > memcpy(uuid, qemu_uuid, sizeof(uuid)); > - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); > if (rc < 0) { > fprintf(stderr, "xen: xc_domain_create() failed\n"); > goto err; > diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h > index 5923290..e5ba732 100644 > --- a/include/hw/xen/xen_common.h > +++ b/include/hw/xen/xen_common.h > @@ -417,4 +417,16 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, > > #endif > > +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, > + xen_domain_handle_t handle, uint32_t flags, > + uint32_t *pdomid, > + xc_domain_configuration_t *config) > +{ > +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 > + return xc_domain_create(xc, ssidref, handle, flags, pdomid); > +#else > + return xc_domain_create(xc, ssidref, handle, flags, pdomid, config); > +#endif > +} > + > #endif /* QEMU_HW_XEN_COMMON_H */ Please follow the existing scheme by introducing two xen_domain_create functions. In addition, the patch causes a build failure against most Xen versions: In file included from /local/scratch/sstabellini/qemu/include/hw/xen/xen_backend.h:4:0, from hw/block/xen_disk.c:38: /local/scratch/sstabellini/qemu/include/hw/xen/xen_common.h:445:37: error: unknown type name ‘xc_domain_configuration_t’ CC hw/bt/hci-csr.o make: *** [hw/block/xen_disk.o] Error 1 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 13:46 ` Stefano Stabellini @ 2015-11-13 13:54 ` Ian Campbell 2015-11-13 16:46 ` [Qemu-devel] [PATCH QEMU v3 " Roger Pau Monne 2015-11-13 16:46 ` Roger Pau Monne 2015-11-13 13:54 ` [PATCH QEMU v2 " Ian Campbell 1 sibling, 2 replies; 19+ messages in thread From: Ian Campbell @ 2015-11-13 13:54 UTC (permalink / raw) To: Stefano Stabellini, Roger Pau Monne; +Cc: xen-devel, qemu-devel On Fri, 2015-11-13 at 13:46 +0000, Stefano Stabellini wrote: > On Fri, 13 Nov 2015, Roger Pau Monne wrote: > > Due to the addition of HVMlite and the requirement to always provide a > > valid > > xc_domain_configuration_t, xc_domain_create now always takes an arch > > domain > > config, which can be NULL in order to mimic previous behaviour. > > > > Add a small stub called xen_domain_create that encapsulates the correct > > call > > to xc_domain_create depending on the libxc version detected. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > FYI this is going to conflict with Ian's series: > > 1447070487-31229-1-git-send-email-ian.campbell@citrix.com The bit being patched here is disabled by "xen: make it possible to build without the Xen PV domain builder" in that series. In any case I think Roger's stuff would be better off going in first and I can easily rebase over it. > In addition, the patch causes a build failure against most Xen versions: > > In file included from > /local/scratch/sstabellini/qemu/include/hw/xen/xen_backend.h:4:0, > from hw/block/xen_disk.c:38: > /local/scratch/sstabellini/qemu/include/hw/xen/xen_common.h:445:37: > error: unknown type name ‘xc_domain_configuration_t’ > CC hw/bt/hci-csr.o > make: *** [hw/block/xen_disk.o] Error 1 Given the only caller today passes NULL I'd suggest moving the NULL down into the wrapper, i.e. dropping the argument from xen_domain_create. If someone wants to resurrect the domain build in QEMU _and_ teach it to do pvh, then they will surely be able to refactor this to suit their needs. Ian. ^ permalink raw reply [flat|nested] 19+ messages in thread
* [Qemu-devel] [PATCH QEMU v3 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 13:54 ` Ian Campbell @ 2015-11-13 16:46 ` Roger Pau Monne 2015-11-13 17:35 ` Stefano Stabellini 2015-11-13 17:35 ` Stefano Stabellini 2015-11-13 16:46 ` Roger Pau Monne 1 sibling, 2 replies; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 16:46 UTC (permalink / raw) To: xen-devel; +Cc: Stefano Stabellini, qemu-devel, Roger Pau Monne Due to the addition of HVMlite and the requirement to always provide a valid xc_domain_configuration_t, xc_domain_create now always takes an arch domain config, which can be NULL in order to mimic previous behaviour. Add a small stub called xen_domain_create that encapsulates the correct call to xc_domain_create depending on the libxc version detected. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: qemu-devel@nongnu.org --- Changes since v2: - Drop the last parameter to xen_create_domain since it's always NULL ATM and was causing build problems with older Xen versions. - Create two different inline functions instead of putting ifdefs inside of a single one. Changes since v1: - Add a compat layer to support previous libxc versions. - Add machinery to detect current Xen unstable (4.7). --- configure | 17 +++++++++++++++++ hw/xenpv/xen_domainbuild.c | 2 +- include/hw/xen/xen_common.h | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 779623a..001982f 100755 --- a/configure +++ b/configure @@ -1863,6 +1863,23 @@ EOF elif cat > $TMPC <<EOF && #include <xenctrl.h> +#include <stdint.h> +int main(void) { + xc_interface *xc = NULL; + xen_domain_handle_t handle; + xc_domain_create(xc, 0, handle, 0, NULL, NULL); + return 0; +} +EOF + compile_prog "" "$xen_libs" + then + xen_ctrl_version=470 + xen=yes + + # Xen 4.6 + elif + cat > $TMPC <<EOF && +#include <xenctrl.h> #include <xenstore.h> #include <stdint.h> #include <xen/hvm/hvm_info_table.h> diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index c0ab753..ac0e5ac 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, int rc; memcpy(uuid, qemu_uuid, sizeof(uuid)); - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); if (rc < 0) { fprintf(stderr, "xen: xc_domain_create() failed\n"); goto err; diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 5923290..04bf6da 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -417,4 +417,20 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, #endif +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid) +{ + return xc_domain_create(xc, ssidref, handle, flags, pdomid); +} +#else +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid) +{ + return xc_domain_create(xc, ssidref, handle, flags, pdomid, NULL); +} +#endif + #endif /* QEMU_HW_XEN_COMMON_H */ -- 1.9.5 (Apple Git-50.3) ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PATCH QEMU v3 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 16:46 ` [Qemu-devel] [PATCH QEMU v3 " Roger Pau Monne @ 2015-11-13 17:35 ` Stefano Stabellini 2015-11-13 17:35 ` Stefano Stabellini 1 sibling, 0 replies; 19+ messages in thread From: Stefano Stabellini @ 2015-11-13 17:35 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, qemu-devel, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 3486 bytes --] On Fri, 13 Nov 2015, Roger Pau Monne wrote: > Due to the addition of HVMlite and the requirement to always provide a valid > xc_domain_configuration_t, xc_domain_create now always takes an arch domain > config, which can be NULL in order to mimic previous behaviour. > > Add a small stub called xen_domain_create that encapsulates the correct call > to xc_domain_create depending on the libxc version detected. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> I'll apply it to my tree > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: qemu-devel@nongnu.org > --- > Changes since v2: > - Drop the last parameter to xen_create_domain since it's always NULL ATM > and was causing build problems with older Xen versions. > - Create two different inline functions instead of putting ifdefs inside of > a single one. > > Changes since v1: > - Add a compat layer to support previous libxc versions. > - Add machinery to detect current Xen unstable (4.7). > --- > configure | 17 +++++++++++++++++ > hw/xenpv/xen_domainbuild.c | 2 +- > include/hw/xen/xen_common.h | 16 ++++++++++++++++ > 3 files changed, 34 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 779623a..001982f 100755 > --- a/configure > +++ b/configure > @@ -1863,6 +1863,23 @@ EOF > elif > cat > $TMPC <<EOF && > #include <xenctrl.h> > +#include <stdint.h> > +int main(void) { > + xc_interface *xc = NULL; > + xen_domain_handle_t handle; > + xc_domain_create(xc, 0, handle, 0, NULL, NULL); > + return 0; > +} > +EOF > + compile_prog "" "$xen_libs" > + then > + xen_ctrl_version=470 > + xen=yes > + > + # Xen 4.6 > + elif > + cat > $TMPC <<EOF && > +#include <xenctrl.h> > #include <xenstore.h> > #include <stdint.h> > #include <xen/hvm/hvm_info_table.h> > diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c > index c0ab753..ac0e5ac 100644 > --- a/hw/xenpv/xen_domainbuild.c > +++ b/hw/xenpv/xen_domainbuild.c > @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, > int rc; > > memcpy(uuid, qemu_uuid, sizeof(uuid)); > - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > if (rc < 0) { > fprintf(stderr, "xen: xc_domain_create() failed\n"); > goto err; > diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h > index 5923290..04bf6da 100644 > --- a/include/hw/xen/xen_common.h > +++ b/include/hw/xen/xen_common.h > @@ -417,4 +417,20 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, > > #endif > > +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 > +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, > + xen_domain_handle_t handle, uint32_t flags, > + uint32_t *pdomid) > +{ > + return xc_domain_create(xc, ssidref, handle, flags, pdomid); > +} > +#else > +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, > + xen_domain_handle_t handle, uint32_t flags, > + uint32_t *pdomid) > +{ > + return xc_domain_create(xc, ssidref, handle, flags, pdomid, NULL); > +} > +#endif > + > #endif /* QEMU_HW_XEN_COMMON_H */ > -- > 1.9.5 (Apple Git-50.3) > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH QEMU v3 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 16:46 ` [Qemu-devel] [PATCH QEMU v3 " Roger Pau Monne 2015-11-13 17:35 ` Stefano Stabellini @ 2015-11-13 17:35 ` Stefano Stabellini 1 sibling, 0 replies; 19+ messages in thread From: Stefano Stabellini @ 2015-11-13 17:35 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, qemu-devel, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 3576 bytes --] On Fri, 13 Nov 2015, Roger Pau Monne wrote: > Due to the addition of HVMlite and the requirement to always provide a valid > xc_domain_configuration_t, xc_domain_create now always takes an arch domain > config, which can be NULL in order to mimic previous behaviour. > > Add a small stub called xen_domain_create that encapsulates the correct call > to xc_domain_create depending on the libxc version detected. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> I'll apply it to my tree > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: qemu-devel@nongnu.org > --- > Changes since v2: > - Drop the last parameter to xen_create_domain since it's always NULL ATM > and was causing build problems with older Xen versions. > - Create two different inline functions instead of putting ifdefs inside of > a single one. > > Changes since v1: > - Add a compat layer to support previous libxc versions. > - Add machinery to detect current Xen unstable (4.7). > --- > configure | 17 +++++++++++++++++ > hw/xenpv/xen_domainbuild.c | 2 +- > include/hw/xen/xen_common.h | 16 ++++++++++++++++ > 3 files changed, 34 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 779623a..001982f 100755 > --- a/configure > +++ b/configure > @@ -1863,6 +1863,23 @@ EOF > elif > cat > $TMPC <<EOF && > #include <xenctrl.h> > +#include <stdint.h> > +int main(void) { > + xc_interface *xc = NULL; > + xen_domain_handle_t handle; > + xc_domain_create(xc, 0, handle, 0, NULL, NULL); > + return 0; > +} > +EOF > + compile_prog "" "$xen_libs" > + then > + xen_ctrl_version=470 > + xen=yes > + > + # Xen 4.6 > + elif > + cat > $TMPC <<EOF && > +#include <xenctrl.h> > #include <xenstore.h> > #include <stdint.h> > #include <xen/hvm/hvm_info_table.h> > diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c > index c0ab753..ac0e5ac 100644 > --- a/hw/xenpv/xen_domainbuild.c > +++ b/hw/xenpv/xen_domainbuild.c > @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, > int rc; > > memcpy(uuid, qemu_uuid, sizeof(uuid)); > - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > if (rc < 0) { > fprintf(stderr, "xen: xc_domain_create() failed\n"); > goto err; > diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h > index 5923290..04bf6da 100644 > --- a/include/hw/xen/xen_common.h > +++ b/include/hw/xen/xen_common.h > @@ -417,4 +417,20 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, > > #endif > > +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 > +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, > + xen_domain_handle_t handle, uint32_t flags, > + uint32_t *pdomid) > +{ > + return xc_domain_create(xc, ssidref, handle, flags, pdomid); > +} > +#else > +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, > + xen_domain_handle_t handle, uint32_t flags, > + uint32_t *pdomid) > +{ > + return xc_domain_create(xc, ssidref, handle, flags, pdomid, NULL); > +} > +#endif > + > #endif /* QEMU_HW_XEN_COMMON_H */ > -- > 1.9.5 (Apple Git-50.3) > [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH QEMU v3 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 13:54 ` Ian Campbell 2015-11-13 16:46 ` [Qemu-devel] [PATCH QEMU v3 " Roger Pau Monne @ 2015-11-13 16:46 ` Roger Pau Monne 1 sibling, 0 replies; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 16:46 UTC (permalink / raw) To: xen-devel; +Cc: Stefano Stabellini, qemu-devel, Roger Pau Monne Due to the addition of HVMlite and the requirement to always provide a valid xc_domain_configuration_t, xc_domain_create now always takes an arch domain config, which can be NULL in order to mimic previous behaviour. Add a small stub called xen_domain_create that encapsulates the correct call to xc_domain_create depending on the libxc version detected. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: qemu-devel@nongnu.org --- Changes since v2: - Drop the last parameter to xen_create_domain since it's always NULL ATM and was causing build problems with older Xen versions. - Create two different inline functions instead of putting ifdefs inside of a single one. Changes since v1: - Add a compat layer to support previous libxc versions. - Add machinery to detect current Xen unstable (4.7). --- configure | 17 +++++++++++++++++ hw/xenpv/xen_domainbuild.c | 2 +- include/hw/xen/xen_common.h | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 779623a..001982f 100755 --- a/configure +++ b/configure @@ -1863,6 +1863,23 @@ EOF elif cat > $TMPC <<EOF && #include <xenctrl.h> +#include <stdint.h> +int main(void) { + xc_interface *xc = NULL; + xen_domain_handle_t handle; + xc_domain_create(xc, 0, handle, 0, NULL, NULL); + return 0; +} +EOF + compile_prog "" "$xen_libs" + then + xen_ctrl_version=470 + xen=yes + + # Xen 4.6 + elif + cat > $TMPC <<EOF && +#include <xenctrl.h> #include <xenstore.h> #include <stdint.h> #include <xen/hvm/hvm_info_table.h> diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index c0ab753..ac0e5ac 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, int rc; memcpy(uuid, qemu_uuid, sizeof(uuid)); - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); if (rc < 0) { fprintf(stderr, "xen: xc_domain_create() failed\n"); goto err; diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 5923290..04bf6da 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -417,4 +417,20 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, #endif +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid) +{ + return xc_domain_create(xc, ssidref, handle, flags, pdomid); +} +#else +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid) +{ + return xc_domain_create(xc, ssidref, handle, flags, pdomid, NULL); +} +#endif + #endif /* QEMU_HW_XEN_COMMON_H */ -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 13:46 ` Stefano Stabellini 2015-11-13 13:54 ` Ian Campbell @ 2015-11-13 13:54 ` Ian Campbell 1 sibling, 0 replies; 19+ messages in thread From: Ian Campbell @ 2015-11-13 13:54 UTC (permalink / raw) To: Stefano Stabellini, Roger Pau Monne; +Cc: xen-devel, qemu-devel On Fri, 2015-11-13 at 13:46 +0000, Stefano Stabellini wrote: > On Fri, 13 Nov 2015, Roger Pau Monne wrote: > > Due to the addition of HVMlite and the requirement to always provide a > > valid > > xc_domain_configuration_t, xc_domain_create now always takes an arch > > domain > > config, which can be NULL in order to mimic previous behaviour. > > > > Add a small stub called xen_domain_create that encapsulates the correct > > call > > to xc_domain_create depending on the libxc version detected. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > FYI this is going to conflict with Ian's series: > > 1447070487-31229-1-git-send-email-ian.campbell@citrix.com The bit being patched here is disabled by "xen: make it possible to build without the Xen PV domain builder" in that series. In any case I think Roger's stuff would be better off going in first and I can easily rebase over it. > In addition, the patch causes a build failure against most Xen versions: > > In file included from > /local/scratch/sstabellini/qemu/include/hw/xen/xen_backend.h:4:0, > from hw/block/xen_disk.c:38: > /local/scratch/sstabellini/qemu/include/hw/xen/xen_common.h:445:37: > error: unknown type name ‘xc_domain_configuration_t’ > CC hw/bt/hci-csr.o > make: *** [hw/block/xen_disk.o] Error 1 Given the only caller today passes NULL I'd suggest moving the NULL down into the wrapper, i.e. dropping the argument from xen_domain_create. If someone wants to resurrect the domain build in QEMU _and_ teach it to do pvh, then they will surely be able to refactor this to suit their needs. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 12:18 ` [Qemu-devel] [PATCH QEMU v2 " Roger Pau Monne 2015-11-13 13:46 ` Stefano Stabellini @ 2015-11-13 13:46 ` Stefano Stabellini 1 sibling, 0 replies; 19+ messages in thread From: Stefano Stabellini @ 2015-11-13 13:46 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, Ian Campbell, qemu-devel, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 3696 bytes --] On Fri, 13 Nov 2015, Roger Pau Monne wrote: > Due to the addition of HVMlite and the requirement to always provide a valid > xc_domain_configuration_t, xc_domain_create now always takes an arch domain > config, which can be NULL in order to mimic previous behaviour. > > Add a small stub called xen_domain_create that encapsulates the correct call > to xc_domain_create depending on the libxc version detected. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> FYI this is going to conflict with Ian's series: 1447070487-31229-1-git-send-email-ian.campbell@citrix.com Is the corresponding libxc change already in Xen? > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: qemu-devel@nongnu.org > --- > Changes since v1: > - Add a compat layer to support previous libxc versions. > - Add machinery to detect current Xen unstable (4.7). > --- > configure | 17 +++++++++++++++++ > hw/xenpv/xen_domainbuild.c | 2 +- > include/hw/xen/xen_common.h | 12 ++++++++++++ > 3 files changed, 30 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 779623a..001982f 100755 > --- a/configure > +++ b/configure > @@ -1863,6 +1863,23 @@ EOF > elif > cat > $TMPC <<EOF && > #include <xenctrl.h> > +#include <stdint.h> > +int main(void) { > + xc_interface *xc = NULL; > + xen_domain_handle_t handle; > + xc_domain_create(xc, 0, handle, 0, NULL, NULL); > + return 0; > +} > +EOF > + compile_prog "" "$xen_libs" > + then > + xen_ctrl_version=470 > + xen=yes > + > + # Xen 4.6 > + elif > + cat > $TMPC <<EOF && > +#include <xenctrl.h> > #include <xenstore.h> > #include <stdint.h> > #include <xen/hvm/hvm_info_table.h> > diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c > index c0ab753..07814f6 100644 > --- a/hw/xenpv/xen_domainbuild.c > +++ b/hw/xenpv/xen_domainbuild.c > @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, > int rc; > > memcpy(uuid, qemu_uuid, sizeof(uuid)); > - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); > if (rc < 0) { > fprintf(stderr, "xen: xc_domain_create() failed\n"); > goto err; > diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h > index 5923290..e5ba732 100644 > --- a/include/hw/xen/xen_common.h > +++ b/include/hw/xen/xen_common.h > @@ -417,4 +417,16 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, > > #endif > > +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, > + xen_domain_handle_t handle, uint32_t flags, > + uint32_t *pdomid, > + xc_domain_configuration_t *config) > +{ > +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 > + return xc_domain_create(xc, ssidref, handle, flags, pdomid); > +#else > + return xc_domain_create(xc, ssidref, handle, flags, pdomid, config); > +#endif > +} > + > #endif /* QEMU_HW_XEN_COMMON_H */ Please follow the existing scheme by introducing two xen_domain_create functions. In addition, the patch causes a build failure against most Xen versions: In file included from /local/scratch/sstabellini/qemu/include/hw/xen/xen_backend.h:4:0, from hw/block/xen_disk.c:38: /local/scratch/sstabellini/qemu/include/hw/xen/xen_common.h:445:37: error: unknown type name ‘xc_domain_configuration_t’ CC hw/bt/hci-csr.o make: *** [hw/block/xen_disk.o] Error 1 [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 11:09 ` Stefano Stabellini 2015-11-13 12:18 ` [Qemu-devel] [PATCH QEMU v2 " Roger Pau Monne @ 2015-11-13 12:18 ` Roger Pau Monne 1 sibling, 0 replies; 19+ messages in thread From: Roger Pau Monne @ 2015-11-13 12:18 UTC (permalink / raw) To: xen-devel; +Cc: Stefano Stabellini, qemu-devel, Roger Pau Monne Due to the addition of HVMlite and the requirement to always provide a valid xc_domain_configuration_t, xc_domain_create now always takes an arch domain config, which can be NULL in order to mimic previous behaviour. Add a small stub called xen_domain_create that encapsulates the correct call to xc_domain_create depending on the libxc version detected. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: qemu-devel@nongnu.org --- Changes since v1: - Add a compat layer to support previous libxc versions. - Add machinery to detect current Xen unstable (4.7). --- configure | 17 +++++++++++++++++ hw/xenpv/xen_domainbuild.c | 2 +- include/hw/xen/xen_common.h | 12 ++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 779623a..001982f 100755 --- a/configure +++ b/configure @@ -1863,6 +1863,23 @@ EOF elif cat > $TMPC <<EOF && #include <xenctrl.h> +#include <stdint.h> +int main(void) { + xc_interface *xc = NULL; + xen_domain_handle_t handle; + xc_domain_create(xc, 0, handle, 0, NULL, NULL); + return 0; +} +EOF + compile_prog "" "$xen_libs" + then + xen_ctrl_version=470 + xen=yes + + # Xen 4.6 + elif + cat > $TMPC <<EOF && +#include <xenctrl.h> #include <xenstore.h> #include <stdint.h> #include <xen/hvm/hvm_info_table.h> diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index c0ab753..07814f6 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, int rc; memcpy(uuid, qemu_uuid, sizeof(uuid)); - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); + rc = xen_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); if (rc < 0) { fprintf(stderr, "xen: xc_domain_create() failed\n"); goto err; diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 5923290..e5ba732 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -417,4 +417,16 @@ static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, #endif +static inline int xen_domain_create(XenXC xc, uint32_t ssidref, + xen_domain_handle_t handle, uint32_t flags, + uint32_t *pdomid, + xc_domain_configuration_t *config) +{ +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470 + return xc_domain_create(xc, ssidref, handle, flags, pdomid); +#else + return xc_domain_create(xc, ssidref, handle, flags, pdomid, config); +#endif +} + #endif /* QEMU_HW_XEN_COMMON_H */ -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder 2015-11-13 11:05 ` [Qemu-devel] " Roger Pau Monne 2015-11-13 11:09 ` Stefano Stabellini @ 2015-11-13 11:09 ` Stefano Stabellini 1 sibling, 0 replies; 19+ messages in thread From: Stefano Stabellini @ 2015-11-13 11:09 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, qemu-devel, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 1316 bytes --] On Fri, 13 Nov 2015, Roger Pau Monne wrote: > Due to the addition of HVMlite and the requirement to always provide a valid > xc_domain_configuration_t, xc_domain_create now always takes an arch domain > config, which can be NULL in order to mimic previous behaviour. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Give a look at include/hw/xen/xen_common.h and add a compatibility shim there. Keep in mind that QEMU needs to build against any version of Xen from 4.0 onward. > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: qemu-devel@nongnu.org > --- > hw/xenpv/xen_domainbuild.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c > index c0ab753..a737908 100644 > --- a/hw/xenpv/xen_domainbuild.c > +++ b/hw/xenpv/xen_domainbuild.c > @@ -234,7 +234,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, > int rc; > > memcpy(uuid, qemu_uuid, sizeof(uuid)); > - rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); > + rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid, NULL); > if (rc < 0) { > fprintf(stderr, "xen: xc_domain_create() failed\n"); > goto err; > -- > 1.9.5 (Apple Git-50.3) > [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2015-12-03 15:28 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-11-13 11:05 [PATCH 0/2] Fix xc_domain_config usage Roger Pau Monne 2015-11-13 11:05 ` [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create Roger Pau Monne 2015-11-13 12:41 ` Andrew Cooper 2015-11-16 11:37 ` Ian Campbell 2015-12-03 15:27 ` Ian Campbell 2015-11-13 11:05 ` [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder Roger Pau Monne 2015-11-13 11:05 ` [Qemu-devel] " Roger Pau Monne 2015-11-13 11:09 ` Stefano Stabellini 2015-11-13 12:18 ` [Qemu-devel] [PATCH QEMU v2 " Roger Pau Monne 2015-11-13 13:46 ` Stefano Stabellini 2015-11-13 13:54 ` Ian Campbell 2015-11-13 16:46 ` [Qemu-devel] [PATCH QEMU v3 " Roger Pau Monne 2015-11-13 17:35 ` Stefano Stabellini 2015-11-13 17:35 ` Stefano Stabellini 2015-11-13 16:46 ` Roger Pau Monne 2015-11-13 13:54 ` [PATCH QEMU v2 " Ian Campbell 2015-11-13 13:46 ` Stefano Stabellini 2015-11-13 12:18 ` Roger Pau Monne 2015-11-13 11:09 ` [PATCH QEMU " Stefano Stabellini
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.