Fix xc_domain_config usage
cover Fix xc_domain_config usage
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.
PATCH 1/2 x86/libxc: add an arch domain config parameter to xc_domain_create
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.
--- 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(-)
tools/libxc/include/xenctrl.h +3 -11
@@ -502,17 +502,9 @@ typedef uniontypedef 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
tools/libxc/xc_domain.c +21 -30
67 lines not on this page · raw message
tools/libxl/libxl_create.c +2 -3
@@ -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 ;
tools/ocaml/libs/xc/xenctrl_stubs.c +1 -1
@@ -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 )
tools/python/xen/lowlevel/xc/xc.c +1 -1
@@ -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 )
tools/xenstore/init-xenstore-domain.c +1 -1
@@ -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;
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create
Quoted 11 lines · 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_createthat 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é <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Ian Campbell
Acked-byRe: [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · 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_createthat contains a pointer to an arch
domain config. If the pointer is null, create a default arch domain config
based on guest type.
Quoted 7 lines
Quoted 5 lines
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é <[email protected]>Reviewed-by Andrew Cooper <[email protected]>
I went to apply but of course it broke without the corresponding qemu change already being in the qemu-xen.git tree.
According to <[email protected]> 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
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH XEN 1/2] x86/libxc: add an arch domain config parameter to xc_domain_create
Quoted 26 lines · Ian Campbell
Quoted 12 lines · Andrew Cooper
Quoted 11 lines · 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_createthat contains a pointer to an arch
domain config. If the pointer is null, create a default arch domain config
based on guest type.Quoted 7 lines
Quoted 5 lines
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é <[email protected]>Reviewed-by Andrew Cooper <[email protected]>Acked-by Ian Campbell <[email protected]>I went to apply but of course it broke without the corresponding qemu change already being in the qemu-xen.git tree.
Quoted 6 lines
According to <[email protected]> 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
[email protected]
http://lists.xen.org/xen-devel
PATCH 2/2 xen: fix usage of xc_domain_create in domain builder
In reply to Roger Pau MonneDue 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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
--- hw/xenpv/xen_domainbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xenpv/xen_domainbuild.c +1 -1
@@ -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;
Signature · 1 line
1.9.5 (Apple Git-50.3)
Re: [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder
Quoted 5 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain config, which can be NULL in order to mimic previous behaviour.Signed-off-by Roger Pau Monné <[email protected]>
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.
Quoted 20 lines
Cc Stefano Stabellini <[email protected]>--- hw/xenpv/xen_domainbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/xenpv/xen_domainbuild.c +1
-2@@ -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; --
Quoted 2 lines
1.9.5 (Apple Git-50.3)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH QEMU 2/2] xen: fix usage of xc_domain_create in domain builder
In reply to Roger Pau MonneQuoted 5 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain config, which can be NULL in order to mimic previous behaviour.Signed-off-by Roger Pau Monné <[email protected]>
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.
Quoted 22 lines
Cc Stefano Stabellini <[email protected]>--- hw/xenpv/xen_domainbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/xenpv/xen_domainbuild.c +1
-1@@ -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;Signature · 1 line
1.9.5 (Apple Git-50.3)
PATCH v2 2/2 xen: fix usage of xc_domain_create in domain builder
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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
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(-)
configure +17 -0
@@ -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>
hw/xenpv/xen_domainbuild.c +1 -1
@@ -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;
include/hw/xen/xen_common.h +12 -0
@@ -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 */
Signature · 1 line
1.9.5 (Apple Git-50.3)
Re: [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder
Quoted 8 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain config, which can be NULL in order to mimic previous behaviour.Add a small stub called
xen_domain_createthat encapsulates the correct call toxc_domain_createdepending on the libxc version detected.Signed-off-by Roger Pau Monné <[email protected]>
FYI this is going to conflict with Ian's series:
Is the corresponding libxc change already in Xen?
Quoted 64 lines
Cc Stefano Stabellini <[email protected]>---
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(-)configure +17
-0@@ -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>hw/xenpv/xen_domainbuild.c +1
-1@@ -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;include/hw/xen/xen_common.h +3
-0@@ -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,
include/hw/xen/xen_common.h static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, · line 432
Quoted 10 lines
include/hw/xen/xen_common.h +9
-0+ 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
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain config, which can be NULL in order to mimic previous behaviour.Add a small stub called
xen_domain_createthat encapsulates the correct call toxc_domain_createdepending on the libxc version detected.Signed-off-by Roger Pau Monné <[email protected]>
FYI this is going to conflict with Ian's series:
Is the corresponding libxc change already in Xen?
Quoted 64 lines
Cc Stefano Stabellini <[email protected]>---
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(-)configure +17
-0@@ -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>hw/xenpv/xen_domainbuild.c +1
-1@@ -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;include/hw/xen/xen_common.h +3
-0@@ -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,
include/hw/xen/xen_common.h static inline int xen_set_ioreq_server_state(XenXC xc, domid_t dom, · line 432
Quoted 10 lines
include/hw/xen/xen_common.h +9
-0+ 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
Re: [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder
Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain
config, which can be NULL in order to mimic previous behaviour.Add a small stub called
xen_domain_createthat encapsulates the correct call
toxc_domain_createdepending on the libxc version detected.
Quoted 5 lines
Quoted 1 line
Signed-off-by Roger Pau Monné <[email protected]>FYI this is going to conflict with Ian's series:
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.
Quoted 9 lines
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
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH QEMU v2 2/2] xen: fix usage of xc_domain_create in domain builder
In reply to Stefano StabelliniQuoted 11 lines · Stefano Stabellini
Quoted 10 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain
config, which can be NULL in order to mimic previous behaviour.Add a small stub called
xen_domain_createthat encapsulates the correct call
toxc_domain_createdepending on the libxc version detected.
Quoted 5 lines
Quoted 1 line
Signed-off-by Roger Pau Monné <[email protected]>FYI this is going to conflict with Ian's series:
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.
Quoted 9 lines
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.
PATCH v3 2/2 xen: fix usage of xc_domain_create in domain builder
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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
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(-)
configure +17 -0
@@ -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>
hw/xenpv/xen_domainbuild.c +1 -1
@@ -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;
include/hw/xen/xen_common.h +16 -0
@@ -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 */
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v3 2/2 xen: fix usage of xc_domain_create in domain builder
In reply to Ian CampbellDue 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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
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(-)
configure +17 -0
@@ -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>
hw/xenpv/xen_domainbuild.c +1 -1
@@ -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;
include/hw/xen/xen_common.h +16 -0
@@ -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 */
Signature · 1 line
1.9.5 (Apple Git-50.3)
Re: [PATCH QEMU v3 2/2] xen: fix usage of xc_domain_create in domain builder
Quoted 8 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain config, which can be NULL in order to mimic previous behaviour.Add a small stub called
xen_domain_createthat encapsulates the correct call toxc_domain_createdepending on the libxc version detected.Signed-off-by Roger Pau Monné <[email protected]>
I'll apply it to my tree
Quoted 85 lines
Cc Stefano Stabellini <[email protected]>---
Changes since v2:
- Drop the last parameter toxen_create_domainsince 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(-)configure +17
-0@@ -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>hw/xenpv/xen_domainbuild.c +1
-1@@ -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;include/hw/xen/xen_common.h +16
-1@@ -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 */ --
Quoted 2 lines
1.9.5 (Apple Git-50.3)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH QEMU v3 2/2] xen: fix usage of xc_domain_create in domain builder
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
Due to the addition of HVMlite and the requirement to always provide a valid
xc_domain_configuration_t,xc_domain_createnow always takes an arch domain config, which can be NULL in order to mimic previous behaviour.Add a small stub called
xen_domain_createthat encapsulates the correct call toxc_domain_createdepending on the libxc version detected.Signed-off-by Roger Pau Monné <[email protected]>
I'll apply it to my tree
Quoted 87 lines
Cc Stefano Stabellini <[email protected]>---
Changes since v2:
- Drop the last parameter toxen_create_domainsince 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(-)configure +17
-0@@ -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>hw/xenpv/xen_domainbuild.c +1
-1@@ -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;include/hw/xen/xen_common.h +16
-0@@ -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 */ Signature · 1 line
1.9.5 (Apple Git-50.3)
PATCH v2 2/2 xen: fix usage of xc_domain_create in domain builder
In reply to Stefano StabelliniDue 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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
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(-)
configure +17 -0
@@ -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>
hw/xenpv/xen_domainbuild.c +1 -1
@@ -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;
include/hw/xen/xen_common.h +12 -0
@@ -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 */
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 2/2 xen: fix usage of xc_domain_create in domain builder
In reply to Roger Pau MonneDue 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.
---
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
--- hw/xenpv/xen_domainbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xenpv/xen_domainbuild.c +1 -1
@@ -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;
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel