libxl: fix compilation errors for ia64
PATCH 1/1 libxl: fix compilation errors for ia64
Hi,
This patch fixes compilation errors for ia64:
libxl.c:112: error: 'XEN_CPUID_INPUT_UNUSED' undeclared (first use in this function)
# cpuid is supported only on x86.
Signature · 1 line
KUWAMURA Shin'ya
# HG changeset patch
# User KUWAMURA Shin'ya <[email protected]> # Date 1288242858 -32400
# Node ID ff992de935b8ffe6630715789ed3bf74653f071a # Parent 0b66bc83e438eae4fe5183f001228c20aa2a5f22
libxl: fix compilation errors for ia64
cpuid is supported only on x86.
tools/libxl/libxl.c +6 -0
@@ -102,6 +102,7 @@ void libxl_key_value_list_destroy(libxl_free (kvl); } +#if defined(__i386__) || defined(__x86_64__)void libxl_cpuid_destroy (libxl_cpuid_policy_list *p_cpuid_list) {int i, j;
@@ -116,6 +117,9 @@ void libxl_cpuid_destroy(libxl_cpuid_pol }return ; } +#else /* !(defined(__i386__) || defined(__x86_64__)) */ +void libxl_cpuid_destroy (libxl_cpuid_policy_list *p_cpuid_list) {} +#endif /******************************************************************************/
@@ -3542,6 +3546,7 @@ struct cpuid_flags {int length; }; +#if defined(__i386__) || defined(__x86_64__)/* go through the dynamic array finding the entry for a specified leaf. * if no entry exists, allocate one and return that. */
@@ -3799,6 +3804,7 @@ int libxl_cpuid_parse_config_xend(libxl_ }return 0 ; } +#endif /* defined(__i386__) || defined(__x86_64__) */ char *libxl_tmem_list (libxl_ctx *ctx,uint32_t domid,int use_long) {
tools/libxl/libxl.h +2 -0
@@ -418,9 +418,11 @@ int libxl_device_pci_shutdown(libxl_ctxint libxl_device_pci_list_assigned (libxl_ctx *ctx,libxl_device_pci **list,uint32_t domid,int *num);int libxl_device_pci_list_assignable (libxl_ctx *ctx,libxl_device_pci **list,int *num);int libxl_device_pci_parse_bdf (libxl_ctx *ctx,libxl_device_pci *pcidev,const char *str); +#if defined(__i386__) || defined(__x86_64__)int libxl_cpuid_parse_config (libxl_cpuid_policy_list *cpuid,const char * str);int libxl_cpuid_parse_config_xend (libxl_cpuid_policy_list *cpuid,const char * str); +#endif /* * Functions for allowing users of libxl to store private data
tools/libxl/libxl_dom.c +2 -0
@@ -95,7 +95,9 @@ int libxl__build_post(libxl_ctx *ctx, uixs_transaction_t t;char **ents;int i; +#if defined(__i386__) || defined(__x86_64__)char *cpuid_res[4 ]; +#endif #if defined(__i386__) || defined(__x86_64__)xc_cpuid_apply_policy (ctx->xch, domid);
tools/libxl/xl_cmdimpl.c +6 -1
@@ -650,7 +650,10 @@ static void parse_config_data(const charconst char *buf;long l;XLU_Config *config; -XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *net2s, *cpuids; +XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *net2s; +#if defined(__i386__) || defined(__x86_64__) +XLU_ConfigList *cpuids; +#endif int pci_power_mgmt =0 ;int pci_msitranslate =1 ;int e;
@@ -1096,6 +1099,7 @@ skip_vfb: } } +#if defined(__i386__) || defined(__x86_64__)switch (xlu_cfg_get_list (config,"cpuid" , &cpuids,0 ,1 )) {case 0 : {
@@ -1173,6 +1177,7 @@ skip_vfb:default : break; } +#endif /* defined(__i386__) || defined(__x86_64__) */ if (c_info->hvm ==1 ) {/* init dm from c and b */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
KUWAMURA Shin'ya writes ("[Xen-devel] [PATCH] libxl: fix compilation errors for ia64"):
Quoted 4 lines
This patch fixes compilation errors for ia64:
libxl.c:112: error: 'XEN_CPUID_INPUT_UNUSED' undeclared (first use in this function)# cpuid is supported only on x86.
Instead of #ifdefs throughout the files, can we please have a separate ia64 file where the functions are stubbed out ?
Thanks,
Ian.
Hi Ian,
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Wed, 3 Nov 2010 12:15:24 +0000
[email protected](Ian Jackson) said:KUWAMURA Shin'ya writes ("[Xen-devel] [PATCH] libxl: fix compilation errors for ia64"):
Quoted 4 lines
This patch fixes compilation errors for ia64:
libxl.c:112: error: 'XEN_CPUID_INPUT_UNUSED' undeclared (first use in this function)# cpuid is supported only on x86.Instead of #ifdefs throughout the files, can we please have a separate ia64 file where the functions are stubbed out ?
I moved the following functions from libxl.c to libxl_{,no}cpuid.c:
- libxl_cpuid_destroy
- libxl_cpuid_parse_config
- libxl_cpuid_parse_config_xend
Because they use XEN_CPUID_INPUT_UNUSED that is defined only on i386 and x86_64.
Any comments?
Best regards,
Signature · 1 line
KUWAMURA Shin'ya
tools/libxl/Makefile +2 -0
@@ -26,6 +26,8 @@ else LIBXL_OBJS-y += libxl_noblktap2.o endif +LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o +LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o
tools/libxl/libxl.c +0 -294
306 lines not on this page · raw message
tools/libxl/libxl_cpuid.c new file +311 -0
311 lines not on this page · raw message
tools/libxl/libxl_dom.c +1 -1
@@ -95,11 +95,11 @@xs_transaction_t t;char **ents;int i; -char *cpuid_res[4 ];#if defined(__i386__) || defined(__x86_64__)xc_cpuid_apply_policy (ctx->xch, domid);if (info->cpuid !=NULL ) { +char *cpuid_res[4 ];for (i =0 ; info->cpuid[i].input[0 ] !=XEN_CPUID_INPUT_UNUSED ; i++)xc_cpuid_set (ctx->xch, domid, info->cpuid[i].input, (const char **)(info->cpuid[i].policy), cpuid_res);
tools/libxl/libxl_nocpuid.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation; version 2.1 only. with the special +* exception on linking described in file LICENSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +*/ + +#include "libxl.h" + +void libxl_cpuid_destroy (libxl_cpuid_policy_list *p_cpuid_list) +{ +} + +int libxl_cpuid_parse_config (libxl_cpuid_policy_list *cpuid,const char * str) +{ +return 0 ; +} + +int libxl_cpuid_parse_config_xend (libxl_cpuid_policy_list *cpuid, +const char * str) +{ +return 0 ; +}
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
KUWAMURA Shin'ya writes ("Re: [Xen-devel] [PATCH] libxl: fix compilation errors for ia64"):
Quoted 4 lines
I moved the following functions from
libxl.cto libxl_{,no}cpuid.c:
-libxl_cpuid_destroy
-libxl_cpuid_parse_config
-libxl_cpuid_parse_config_xend
That's great.
Quoted 4 lines
Because they use
XEN_CPUID_INPUT_UNUSEDthat is defined only on i386 andx86_64.Any comments?
This patch is very nearly perfect but I have one small quibble:
Quoted 6 lines
diff -r
0dc0bc411035tools/libxl/libxl_dom.ctools/libxl/libxl_dom.c +0
-0@@ -95,11 +95,11 @@xs_transaction_t t;char **ents;
tools/libxl/libxl_dom.c line 105
Quoted 10 lines
tools/libxl/libxl_dom.c +1
-1int i; -char *cpuid_res[4 ];#if defined(__i386__) || defined(__x86_64__)xc_cpuid_apply_policy (ctx->xch, domid);if (info->cpuid !=NULL ) { +char *cpuid_res[4 ];for (i =0 ; info->cpuid[i].input[0 ] !=XEN_CPUID_INPUT_UNUSED ; i++)xc_cpuid_set (ctx->xch, domid, info->cpuid[i].input, (const char **)(info->cpuid[i].policy), cpuid_res);
I think that the right fix here is to take the whole of that #ifdef section and move it into a small function so that it can go into libxl_{no,}cpuid.c.
I would have applied the patch apart from that hunk except that you didn't provide a Signed-Off-By. Could you please resubmit which fixes up that last bit, and which is properly signed off ?
Thanks,
Ian.
Quoted 1 line
From
Documentation/SubmittingPatches:
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
--
Hi Ian,
Quoted 14 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
On Mon, 8 Nov 2010 16:17:03 +0000
[email protected](Ian Jackson) said:This patch is very nearly perfect but I have one small quibble:
Quoted 9 lines
diff -r
0dc0bc411035tools/libxl/libxl_dom.ctools/libxl/libxl_dom.c +0
-1@@ -95,11 +95,11 @@xs_transaction_t t;char **ents;int i; -char *cpuid_res[4 ];
Quoted 11 lines
tools/libxl/libxl_dom.c line 105
Quoted 7 lines
tools/libxl/libxl_dom.c +1
-0#if defined(__i386__) || defined(__x86_64__)xc_cpuid_apply_policy (ctx->xch, domid);if (info->cpuid !=NULL ) { +char *cpuid_res[4 ];for (i =0 ; info->cpuid[i].input[0 ] !=XEN_CPUID_INPUT_UNUSED ; i++)xc_cpuid_set (ctx->xch, domid, info->cpuid[i].input, (const char **)(info->cpuid[i].policy), cpuid_res);I think that the right fix here is to take the whole of that #ifdef section and move it into a small function so that it can go into libxl_{no,}cpuid.c.
Ok. I added more two functions:
- libxl_cpuid_apply_policy
- libxl_cpuid_set
I confirmed this patch can be built on both x86_64 and ia64.
Quoted 3 lines
I would have applied the patch apart from that hunk except that you didn't provide a Signed-Off-By. Could you please resubmit which fixes up that last bit, and which is properly signed off ?
Best regards,
Signature · 1 line
KUWAMURA Shin'ya
tools/libxl/Makefile +2 -0
@@ -26,6 +26,8 @@ LIBXL_OBJS-y += libxl_blktap2.o else LIBXL_OBJS-y += libxl_noblktap2.o endif +LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o +LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o
tools/libxl/libxl.c +0 -294
306 lines not on this page · raw message
tools/libxl/libxl.h +3 -0
@@ -421,6 +421,9 @@ int libxl_device_pci_parse_bdf(libxl_ctxint libxl_cpuid_parse_config (libxl_cpuid_policy_list *cpuid,const char * str);int libxl_cpuid_parse_config_xend (libxl_cpuid_policy_list *cpuid,const char * str); +void libxl_cpuid_apply_policy (libxl_ctx *ctx,uint32_t domid); +void libxl_cpuid_set (libxl_ctx *ctx,uint32_t domid, +libxl_cpuid_policy_list cpuid);/* * Functions for allowing users of libxl to store private data
tools/libxl/libxl_cpuid.c new file +327 -0
327 lines not on this page · raw message
tools/libxl/libxl_dom.c +3 -9
@@ -95,16 +95,10 @@ int libxl__build_post(libxl_ctx *ctx, uixs_transaction_t t;char **ents;int i; -char *cpuid_res[4 ]; -#if defined(__i386__) || defined(__x86_64__) -xc_cpuid_apply_policy (ctx->xch, domid); -if (info->cpuid !=NULL ) { -for (i =0 ; info->cpuid[i].input[0 ] !=XEN_CPUID_INPUT_UNUSED ; i++) -xc_cpuid_set (ctx->xch, domid, info->cpuid[i].input, - (const char **)(info->cpuid[i].policy), cpuid_res); - } -#endif +libxl_cpuid_apply_policy (ctx, domid); +if (info->cpuid !=NULL ) +libxl_cpuid_set (ctx, domid, info->cpuid); ents =libxl__calloc (&gc,12 + (info->max_vcpus *2 ) +2 ,sizeof (char *)); ents[0 ] ="memory/static-max" ;
tools/libxl/libxl_nocpuid.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation; version 2.1 only. with the special +* exception on linking described in file LICENSE. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +*/ + +#include "libxl.h" + +void libxl_cpuid_destroy (libxl_cpuid_policy_list *p_cpuid_list) +{ +} + +int libxl_cpuid_parse_config (libxl_cpuid_policy_list *cpuid,const char * str) +{ +return 0 ; +} + +int libxl_cpuid_parse_config_xend (libxl_cpuid_policy_list *cpuid, +const char * str) +{ +return 0 ; +} + +void libxl_cpuid_apply_policy (libxl_ctx *ctx,uint32_t domid) +{ +} + +void libxl_cpuid_set (libxl_ctx *ctx,uint32_t domid, +libxl_cpuid_policy_list cpuid) +{ +}
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
KUWAMURA Shin'ya writes ("Re: [Xen-devel] [PATCH] libxl: fix compilation errors for ia64"):
Quoted 5 lines
Ok. I added more two functions:
-libxl_cpuid_apply_policy
-libxl_cpuid_setI confirmed this patch can be built on both
x86_64and ia64.
Great, thanks, I have applied your patch.
Ian.