tools: fix ia64 build for 21483:779c0ef9682c
PATCH 1/1 tools: fix ia64 build for 21483:779c0ef9682c
Hi,
This patch fixes ia64 by the following method:
- rename xc_handle xch
- rename guest_xc xch
- add xc_interface *xch to arguments of some functions
- replace xc_dom_printf with macros
Signature · 1 line
KUWAMURA Shin'ya
# HG changeset patch
# User KUWAMURA Shin'ya <[email protected]> # Date 1276758113 -32400
# Node ID 9480d90c4a1a5b0549258859d14f15a0650cb5e8 # Parent a24dbfcbdf695f49867d5881ea20ab40f18aea98
tools: fix ia64 build for 21483:779c0ef9682c
This patch fixes ia64 by the following method:
- rename xc_handle xch
- rename guest_xc xch
- add xc_interface *xch to arguments of some functions
- replace xc_dom_printf with macros
tools/libxc/ia64/xc_dom_ia64_util.c +6 -4
@@ -28,7 +28,7 @@ uint32_tuint32_t xen_ia64_version (struct xc_dom_image *dom) { -return xc_version (dom->guest_xc, XENVER_version,NULL ); +return xc_version (dom->xch, XENVER_version,NULL ); }int
@@ -41,11 +41,12 @@ xen_ia64_fpswa_revision(struct xc_dom_im hypercall.arg[1 ] = (unsigned long )revision;if (lock_pages (revision,sizeof (*revision)) !=0 ) { +xc_interface *xch = dom->xch;PERROR ("Could not lock memory for xen fpswa hypercall" );return -1 ; } - ret =do_xen_hypercall (dom->guest_xc, &hypercall); + ret =do_xen_hypercall (dom->xch, &hypercall);unlock_pages (revision,sizeof (*revision));
@@ -75,7 +76,7 @@ xen_ia64_dom_fw_map(struct xc_dom_imageunsigned long page_size =XC_DOM_PAGE_SIZE (dom);void * ret; - ret =xc_map_foreign_range (dom->guest_xc, dom->guest_domid, + ret =xc_map_foreign_range (dom->xch, dom->guest_domid, page_size,PROT_READ |PROT_WRITE , mpaddr / page_size);if (ret !=NULL )
@@ -98,8 +99,9 @@ xen_ia64_is_vcpu_allocated(struct xc_domint rc;xc_vcpuinfo_t info; +xc_interface *xch = dom->xch; - rc =xc_vcpu_getinfo (dom->guest_xc, dom->guest_domid, + rc =xc_vcpu_getinfo (xch, dom->guest_domid, vcpu, &info);if (rc ==0 )return 1 ;
tools/libxc/ia64/xc_ia64_dom_fwloader.c +1 -1
@@ -72,7 +72,7 @@ static int vcpu_ia64(struct xc_dom_image {vcpu_guest_context_ia64_t *ctxt = ptr; -xc_dom_printf ("%s: called\n" , __FUNCTION__); +DOMPRINTF_CALLED (dom->xch);/* clear everything */ memset (ctxt,0 ,sizeof (*ctxt));
tools/libxc/ia64/xc_ia64_hvm_build.c +58 -57
420 lines not on this page · raw message
tools/libxc/ia64/xc_ia64_linux_restore.c +54 -53
387 lines not on this page · raw message
tools/libxc/ia64/xc_ia64_linux_save.c +43 -43
321 lines not on this page · raw message
tools/libxc/ia64/xc_ia64_stubs.c +18 -18
@@ -19,7 +19,7 @@ xc_ia64_fpsr_default(void) }static int -xc_ia64_get_pfn_list (xc_interface *xc_handle,uint32_t domid,xen_pfn_t *pfn_buf, +xc_ia64_get_pfn_list (xc_interface *xch,uint32_t domid,xen_pfn_t *pfn_buf,unsigned int start_page,unsigned int nr_pages) {DECLARE_DOMCTL ;
@@ -36,34 +36,34 @@ xc_ia64_get_pfn_list(xc_interface *xc_haPERROR ("Could not lock pfn list buffer" );return -1 ; } - ret =do_domctl (xc_handle, &domctl); + ret =do_domctl (xch, &domctl);unlock_pages (pfn_buf, nr_pages *sizeof (xen_pfn_t));return ret <0 ?-1 : nr_pages; }int -xc_get_pfn_list (xc_interface *xc_handle,uint32_t domid,uint64_t *pfn_buf, +xc_get_pfn_list (xc_interface *xch,uint32_t domid,uint64_t *pfn_buf,unsigned long max_pfns) { -return xc_ia64_get_pfn_list (xc_handle, domid, (xen_pfn_t *)pfn_buf, +return xc_ia64_get_pfn_list (xch, domid, (xen_pfn_t *)pfn_buf,0 , max_pfns); }long -xc_get_max_pages (xc_interface *xc_handle,uint32_t domid) +xc_get_max_pages (xc_interface *xch,uint32_t domid) {struct xen_domctl domctl; domctl.cmd = XEN_DOMCTL_getdomaininfo; domctl.domain = (domid_t )domid; -return ((do_domctl (xc_handle, &domctl) <0 ) +return ((do_domctl (xch, &domctl) <0 ) ?-1 : domctl.u.getdomaininfo.max_pages); }/* It is possible to get memmap_info and memmap by foreign domain page mapping. But it's racy. Use hypercall to avoid race. */ static int -xc_ia64_get_memmap (xc_interface *xc_handle, +xc_ia64_get_memmap (xc_interface *xch,uint32_t domid,char *buf,unsigned long bufsize) {privcmd_hypercall_t hypercall;
@@ -78,13 +78,13 @@ xc_ia64_get_memmap(xc_interface *xc_handif (lock_pages (buf, bufsize) !=0 )return -1 ; - ret =do_xen_hypercall (xc_handle, &hypercall); + ret =do_xen_hypercall (xch, &hypercall);unlock_pages (buf, bufsize);return ret; }int -xc_ia64_copy_memmap (xc_interface *xc_handle,uint32_t domid,shared_info_t *live_shinfo, +xc_ia64_copy_memmap (xc_interface *xch,uint32_t domid,shared_info_t *live_shinfo,xen_ia64_memmap_info_t **memmap_info_p,unsigned long *memmap_info_num_pages_p) {
@@ -98,7 +98,7 @@ xc_ia64_copy_memmap(xc_interface *xc_hanint ret; - gpfn_max_prev =xc_memory_op (xc_handle, XENMEM_maximum_gpfn, &domid); + gpfn_max_prev =xc_memory_op (xch, XENMEM_maximum_gpfn, &domid);if (gpfn_max_prev <0 )return -1 ;
@@ -113,7 +113,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han memmap_info =malloc (memmap_size);if (memmap_info ==NULL )return -1 ; - ret =xc_ia64_get_memmap (xc_handle, + ret =xc_ia64_get_memmap (xch, domid, (char *)memmap_info, memmap_size);if (ret !=0 ) {free (memmap_info);
@@ -127,7 +127,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han goto again; } - gpfn_max_post =xc_memory_op (xc_handle, XENMEM_maximum_gpfn, &domid); + gpfn_max_post =xc_memory_op (xch, XENMEM_maximum_gpfn, &domid);if (gpfn_max_prev <0 ) {free (memmap_info);return -1 ;
@@ -163,7 +163,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han#define PTRS_PER_PTE (1UL << (PAGE_SHIFT - 3))static void * -xc_ia64_map_foreign_p2m (xc_interface *xc_handle,uint32_t dom, +xc_ia64_map_foreign_p2m (xc_interface *xch,uint32_t dom,struct xen_ia64_memmap_info *memmap_info,unsigned long flags,unsigned long *p2m_size_p) {
@@ -174,12 +174,12 @@ xc_ia64_map_foreign_p2m(xc_interface *xcint ret;int saved_errno; - gpfn_max =xc_memory_op (xc_handle, XENMEM_maximum_gpfn, &dom); + gpfn_max =xc_memory_op (xch, XENMEM_maximum_gpfn, &dom);if (gpfn_max <0 )return NULL ; p2m_size = (((gpfn_max +1 ) +PTRS_PER_PTE -1 ) /PTRS_PER_PTE ) <<PAGE_SHIFT ; - addr =mmap (NULL , p2m_size,PROT_READ ,MAP_SHARED , xc_handle,0 ); + addr =mmap (NULL , p2m_size,PROT_READ ,MAP_SHARED , xch->fd,0 );if (addr ==MAP_FAILED )return NULL ;
@@ -197,7 +197,7 @@ xc_ia64_map_foreign_p2m(xc_interface *xc errno = saved_errno;return NULL ; } - ret =do_xen_hypercall (xc_handle, &hypercall); + ret =do_xen_hypercall (xch, &hypercall); saved_errno = errno;unlock_pages (memmap_info,sizeof (*memmap_info) + memmap_info->efi_memmap_size);
@@ -219,11 +219,11 @@ xc_ia64_p2m_init(struct xen_ia64_p2m_tab }int -xc_ia64_p2m_map (struct xen_ia64_p2m_table *p2m_table,xc_interface *xc_handle, +xc_ia64_p2m_map (struct xen_ia64_p2m_table *p2m_table,xc_interface *xch,uint32_t domid,struct xen_ia64_memmap_info *memmap_info,unsigned long flag) { - p2m_table->p2m =xc_ia64_map_foreign_p2m (xc_handle, domid, memmap_info, + p2m_table->p2m =xc_ia64_map_foreign_p2m (xch, domid, memmap_info, flag, &p2m_table->size);if (p2m_table->p2m ==NULL ) {PERROR ("Could not map foreign p2m. falling back to old method" );
tools/libxc/xc_core.c +2 -2
@@ -642,7 +642,7 @@ xc_domain_dumpcore_via_callback(xc_inter offset += filesz;/* arch context */ - sts =xc_core_arch_context_get_shdr (&arch_ctxt, sheaders, strtab, + sts =xc_core_arch_context_get_shdr (xch, &arch_ctxt, sheaders, strtab, &filesz, offset);if ( sts !=0 ) goto out;
@@ -773,7 +773,7 @@ xc_domain_dumpcore_via_callback(xc_inter }/* arch specific context */ - sts =xc_core_arch_context_dump (&arch_ctxt, args, dump_rtn); + sts =xc_core_arch_context_dump (xch, &arch_ctxt, args, dump_rtn);if ( sts !=0 ) goto out;
tools/libxc/xc_core_ia64.c +11 -6
@@ -48,10 +48,12 @@ xc_memory_map_cmp(const void *lhs__, conreturn 1 ;/* memory map overlap isn't allowed. complain */ -DPRINTF ("duplicated addresses are detected " +#ifdef DEBUG +fprintf (stderr,"duplicated addresses are detected " "(0x%" PRIx64", 0x%" PRIx64"), " "(0x%" PRIx64", 0x%" PRIx64")\n" , lhs->addr, lhs->size, rhs->addr, rhs->size); +#endif return 0 ; }
@@ -316,7 +318,8 @@ xc_core_arch_context_get(struct xc_core_ }int -xc_core_arch_context_get_shdr (struct xc_core_arch_context *arch_ctxt, +xc_core_arch_context_get_shdr (xc_interface *xch, +struct xc_core_arch_context *arch_ctxt,struct xc_core_section_headers *sheaders,struct xc_core_strtab *strtab,uint64_t *filesz,uint64_t offset)
@@ -332,14 +335,15 @@ xc_core_arch_context_get_shdr(struct xc_ }/* mmapped priv regs */ - shdr =xc_core_shdr_get (sheaders); + shdr =xc_core_shdr_get (xch, sheaders);if ( shdr ==NULL ) {PERROR ("Could not get section header for .xen_ia64_mapped_regs" );return sts; } *filesz = arch_ctxt->mapped_regs_size * arch_ctxt->nr_vcpus; - sts =xc_core_shdr_set (shdr, strtab,XEN_DUMPCORE_SEC_IA64_MAPPED_REGS , + sts =xc_core_shdr_set (xch, shdr, strtab, +XEN_DUMPCORE_SEC_IA64_MAPPED_REGS ,SHT_PROGBITS , offset, *filesz, __alignof__(*arch_ctxt->mapped_regs[0]), arch_ctxt->mapped_regs_size);
@@ -347,7 +351,8 @@ xc_core_arch_context_get_shdr(struct xc_ }int -xc_core_arch_context_dump (struct xc_core_arch_context * arch_ctxt, +xc_core_arch_context_dump (xc_interface *xch, +struct xc_core_arch_context * arch_ctxt,void * args,dumpcore_rtn_t dump_rtn) {int sts =0 ;
@@ -356,7 +361,7 @@ xc_core_arch_context_dump(struct xc_core/* ia64 mapped_regs: .xen_ia64_mapped_regs */ for ( i =0 ; i < arch_ctxt->nr_vcpus; i++ ) { - sts =dump_rtn (args, (char *)arch_ctxt->mapped_regs[i], + sts =dump_rtn (xch, args, (char *)arch_ctxt->mapped_regs[i], arch_ctxt->mapped_regs_size);if ( sts !=0 )break ;
tools/libxc/xc_core_ia64.h +4 -2
@@ -43,12 +43,14 @@ xc_core_arch_context_get(struct xc_core_ vcpu_guest_context_any_t* ctxt, xc_interface *xch, uint32_t domid);int -xc_core_arch_context_get_shdr (struct xc_core_arch_context * arch_ctxt, +xc_core_arch_context_get_shdr (xc_interface *xch, +struct xc_core_arch_context * arch_ctxt,struct xc_core_section_headers *sheaders,struct xc_core_strtab *strtab,uint64_t *filesz,uint64_t offset);int -xc_core_arch_context_dump (struct xc_core_arch_context * arch_ctxt, +xc_core_arch_context_dump (xc_interface *xch, +struct xc_core_arch_context * arch_ctxt,void * args,dumpcore_rtn_t dump_rtn);int
tools/libxc/xc_dom_ia64.c +7 -7
@@ -172,7 +172,7 @@ int arch_setup_meminit(struct xc_dom_ima dom->p2m_host[pfn] = start + pfn;/* allocate guest memory */ - rc =xc_domain_memory_populate_physmap (dom->guest_xc, dom->guest_domid, + rc =xc_domain_memory_populate_physmap (dom->xch, dom->guest_domid, nbr,0 ,0 , dom->p2m_host);return rc;
@@ -195,7 +195,7 @@ static int ia64_setup_memmap(struct xc_d memmap_info_pfn = dom->start_info_pfn -1 ;DOMPRINTF ("%s: memmap: mfn 0x%" PRIpfn" pages 0x%lx" , __FUNCTION__, memmap_info_pfn, memmap_info_num_pages); - memmap_info =xc_map_foreign_range (dom->guest_xc, dom->guest_domid, + memmap_info =xc_map_foreign_range (dom->xch, dom->guest_domid, page_size * memmap_info_num_pages,PROT_READ |PROT_WRITE , memmap_info_pfn);
@@ -225,7 +225,7 @@ static int ia64_setup_memmap(struct xc_d* we use xen_ia64_boot_param::efi_memmap::{efi_memmap, efi_memmap_size} * for this purpose */ - start_info =xc_map_foreign_range (dom->guest_xc, dom->guest_domid, + start_info =xc_map_foreign_range (dom->xch, dom->guest_domid, page_size,PROT_READ |PROT_WRITE , dom->start_info_pfn);
@@ -254,7 +254,7 @@ int arch_setup_bootearly(struct xc_dom_i domctl.u.arch_setup.maxmem =0 ; domctl.cmd = XEN_DOMCTL_arch_setup; domctl.domain = dom->guest_domid; - rc =xc_domctl (dom->guest_xc, &domctl); + rc =xc_domctl (dom->xch, &domctl);DOMPRINTF ("%s: hvm-3.0-ia64-sioemu: %d" , __FUNCTION__, rc);return rc; }
@@ -267,7 +267,7 @@ int arch_setup_bootearly(struct xc_dom_i domctl.cmd = XEN_DOMCTL_arch_setup; domctl.domain = dom->guest_domid; domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query; - rc =do_domctl (dom->guest_xc, &domctl); + rc =do_domctl (dom->xch, &domctl);if (rc)return rc; rc = xen_ia64_dom_fw_setup(dom, domctl.u.arch_setup.hypercall_imm,
@@ -286,7 +286,7 @@ int arch_setup_bootearly(struct xc_dom_i +sizeof (start_info_t); domctl.u.arch_setup.maxmem = dom->total_pages <<PAGE_SHIFT ; domctl.u.arch_setup.vhpt_size_log2 = dom->vhpt_size_log2; - rc =do_domctl (dom->guest_xc, &domctl); + rc =do_domctl (dom->xch, &domctl);return rc; }
@@ -298,7 +298,7 @@ int arch_setup_bootlate(struct xc_dom_im/* setup shared_info page */ DOMPRINTF ("%s: shared_info: mfn 0x%" PRIpfn"" , __FUNCTION__, dom->shared_info_mfn); - shared_info =xc_map_foreign_range (dom->guest_xc, dom->guest_domid, + shared_info =xc_map_foreign_range (dom->xch, dom->guest_domid, page_size,PROT_READ |PROT_WRITE , dom->shared_info_mfn);
xen/arch/ia64/xen/dom_fw_common.c +12 -0
@@ -318,7 +318,11 @@ dom_fw_pal_hypercall_patch(uint64_t brki } static inline void +#ifdef __XEN__ print_md(efi_memory_desc_t *md) +#else +print_md(xc_interface *xch, efi_memory_desc_t *md) +#endif {uint64_t size;
@@ -581,7 +585,11 @@ dom_fw_init(domain_t *d,if (xen_ia64_is_dom0 (d)) {efi_systable_init_dom0 (tables); }else { +#ifdef __XEN__efi_systable_init_domu (tables); +#else +efi_systable_init_domu (d->xch, tables); +#endif }/* fill in the SAL system table: */
@@ -675,7 +683,11 @@ dom_fw_init(domain_t *d,/* Display memmap. */ for (i = 0 ; i < tables->num_mds; i++) +#ifdef __XEN__print_md (&tables->efi_memmap[i]); +#else +print_md (d->xch, &tables->efi_memmap[i]); +#endif /* Fill boot_param */ bp->efi_systab =FW_FIELD_MPA (efi_systab);
xen/arch/ia64/xen/dom_fw_domu.c +7 -0
@@ -47,7 +47,11 @@#include <asm/dom_fw.h> #include <asm/dom_fw_domu.h> +#ifdef __XEN__ void efi_systable_init_domu(struct fw_tables *tables) +#else +void efi_systable_init_domu(xc_interface *xch, struct fw_tables *tables) +#endif {int i =1 ;
@@ -77,6 +81,9 @@ complete_domu_memmap(domain_t * d,void *p;void *memmap_start;void *memmap_end; +#ifndef __XEN__ +xc_interface *xch = d->xch; +#endif if (memmap_info_pfn ==0 || memmap_info_num_pages ==0 ) {/* old domain builder which doesn't setup
xen/include/asm-ia64/dom_fw_common.h +1 -1
@@ -35,7 +35,7 @@ typedef struct xc_dom_image domain_t;#define XENLOG_INFO "info:"#define XENLOG_WARNING "Warning:"#define XENLOG_GUEST "" -#define printk(fmt, args ...) xc_dom_printf(fmt, ## args) +#define printk(fmt, args ...) IPRINTF(fmt, ## args)#define BUG_ON (p) assert(!(p))#define BUILD_BUG_ON (condition) ((void)sizeof(struct { int:-!!(condition); }))
xen/include/asm-ia64/dom_fw_domu.h +4 -0
@@ -23,7 +23,11 @@#include <asm/dom_fw_common.h> +#ifdef __XEN__void efi_systable_init_domu (struct fw_tables *tables); +#else +void efi_systable_init_domu (xc_interface *xch,struct fw_tables *tables); +#endif int complete_domu_memmap(domain_t *d,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
KUWAMURA Shin'ya writes ("[Xen-devel] [PATCH] tools: fix ia64 build for 21483:779c0ef9682c"):
Quoted 5 lines
This patch fixes ia64 by the following method:
- renamexc_handlexch
- renameguest_xcxch
- addxc_interface*xch to arguments of some functions
- replacexc_dom_printfwith macros
Thanks. It looks reasonable to me, although I'm not quite sure about this part:
xen/arch/ia64/xen/dom_fw_domu.c +4 -0
@@ -47,7 +47,11 @@#include <asm/dom_fw.h> #include <asm/dom_fw_domu.h> +#ifdef __XEN__ void efi_systable_init_domu(struct fw_tables *tables) +#else +void efi_systable_init_domu(xc_interface *xch, struct fw_tables *tables) +#endif
Keir, do you have an opinion ? If you're happy with this I'll apply the whole patch to the tools tree, even though it contains some changes in xen/include/*64*. Alternatively, please do apply the whole patch to your tree right away.
Or, in other words:
Ian.
Quoted 4 lines · Ian Jackson
Keir, do you have an opinion ? If you're happy with this I'll apply the whole patch to the tools tree, even though it contains some changes in xen/include/*64*. Alternatively, please do apply the whole patch to your tree right away.
It's fine by me. Please apply it to your tree.
-- Keir