ia64 libxc patch
Hi,
Here is our latest patch to enable the Xen tools to build and work with IA64 Xen.
It should apply to the current xen-unstable tree - please apply or provide feedback.
Thanks,
Matt
Signed-off-by Matt Chapman <[email protected]>
Acked-by Dan Magenheimer <[email protected]>
tools/libxc/Makefile +8 -4
@@ -19,18 +19,22 @@ SRCS += xc_domain.c SRCS += xc_evtchn.c SRCS += xc_gnttab.c -SRCS += xc_load_aout9.c SRCS += xc_load_bin.c SRCS += xc_load_elf.c SRCS += xc_linux_build.c -SRCS += xc_linux_restore.c -SRCS += xc_linux_save.c SRCS += xc_misc.c SRCS += xc_physdev.c SRCS += xc_private.c +ifeq ($(XEN_TARGET_ARCH),ia64) +SRCS += xc_ia64_stubs.c +else +SRCS += xc_load_aout9.c +SRCS += xc_linux_restore.c +SRCS += xc_linux_save.c +SRCS += xc_vmx_build.c SRCS += xc_ptrace.c SRCS += xc_ptrace_core.c -SRCS += xc_vmx_build.c +endif CFLAGS += -Wall CFLAGS += -Werror
tools/libxc/xc.h +16 -0
@@ -27,6 +27,14 @@#include <xen/sched_ctl.h> #include <xen/acm.h> +#ifdef __ia64__ +#define XC_PAGE_SHIFT 14 +#else +#define XC_PAGE_SHIFT 12 +#endif +#define XC_PAGE_SIZE (1UL << XC_PAGE_SHIFT) +#define XC_PAGE_MASK (~(XC_PAGE_SIZE-1)) +/* * DEFINITIONS FOR CPU BARRIERS */
@@ -39,6 +47,11 @@#define mb () __asm__ __volatile__ ( "mfence" : : : "memory")#define rmb () __asm__ __volatile__ ( "lfence" : : : "memory")#define wmb () __asm__ __volatile__ ( "" : : : "memory") +#elif defined(__ia64__) +/* FIXME */ +#define mb () +#define rmb () +#define wmb ()#else #error "Define barriers"#endif
@@ -462,6 +475,9 @@int xc_get_pfn_list (int xc_handle,u32 domid,unsigned long *pfn_buf,unsigned long max_pfns); +int xc_ia64_get_pfn_list (int xc_handle,u32 domid,unsigned long *pfn_buf, +unsigned int start_page,unsigned int nr_pages); +/*\ * GRANT TABLE FUNCTIONS \*/
tools/libxc/xc_domain.c +3 -2
@@ -264,10 +264,11 @@ unsigned int mem_kb) {int err; +unsigned int npages = mem_kb / (PAGE_SIZE /1024 ); err =do_dom_mem_op (xc_handle, MEMOP_increase_reservation,NULL , - mem_kb /4 ,0 , domid); -if (err == mem_kb /4 ) + npages,0 , domid); +if (err == npages)return 0 ;if (err >0 ) {
tools/libxc/xc_linux_build.c +84 -1
128 lines not on this page · raw message
tools/libxc/xc_load_elf.c +5 -1
@@ -7,7 +7,7 @@#if defined(__i386__)#define ELFSIZE 32#endif -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__ia64__)#define ELFSIZE 64#endif
@@ -122,8 +122,12 @@ }if ( guestinfo ==NULL ) { +#ifdef __ia64__ + guestinfo ="" ; +#else ERROR ("Not a Xen-ELF image: '__xen_guest' section not found." );return -EINVAL ; +#endif }for ( h =0 ; h < ehdr->e_phnum; h++ )
tools/libxc/xc_private.c +31 -0
@@ -256,6 +256,37 @@return (ret <0 ) ?-1 : op.u.getmemlist.num_pfns; } +#ifdef __ia64__ +int xc_ia64_get_pfn_list (int xc_handle, +u32 domid, +unsigned long *pfn_buf, +unsigned int start_page, +unsigned int nr_pages) +{ +dom0_op_t op; +int ret; + + op.cmd =DOM0_GETMEMLIST ; + op.u.getmemlist.domain = (domid_t )domid; + op.u.getmemlist.max_pfns = ((unsigned long )start_page <<32 ) | nr_pages; + op.u.getmemlist.buffer = pfn_buf; + +if (mlock (pfn_buf, nr_pages *sizeof (unsigned long )) !=0 ) + { +PERROR ("Could not lock pfn list buffer" ); +return -1 ; + } + +/* XXX Hack to put pages in TLB, hypervisor should be able to handle this */ +memset (pfn_buf,0 , nr_pages *sizeof (unsigned long )); + ret =do_dom0_op (xc_handle, &op); + + (void )munlock (pfn_buf, nr_pages *sizeof (unsigned long )); + +return (ret <0 ) ?-1 : op.u.getmemlist.num_pfns; +} +#endif +long xc_get_tot_pages (int xc_handle,u32 domid) {dom0_op_t op;
tools/libxc/xc_private.h +1 -1
@@ -55,7 +55,7 @@#define L4_PAGETABLE_ENTRIES 512#endif -#define PAGE_SHIFT L1_PAGETABLE_SHIFT +#define PAGE_SHIFT XC_PAGE_SHIFT#define PAGE_SIZE (1UL << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))
tools/misc/Makefile +2 -0
@@ -22,7 +22,9 @@ build: $(TARGETS) $(MAKE) -C miniterm $(MAKE) -C cpuperf +ifneq ($(XEN_TARGET_ARCH),ia64) $(MAKE) -C mbootpack +endif $(MAKE) -C lomount install: build
tools/python/xen/lowlevel/xc/xc.c +1 -1
@@ -242,7 +242,7 @@"paused" , info[i].paused,"blocked" , info[i].blocked,"running" , info[i].running, -"mem_kb" , info[i].nr_pages*4 , +"mem_kb" , info[i].nr_pages*(XC_PAGE_SIZE /1024 ),"cpu_time" , info[i].cpu_time,"maxmem_kb" , info[i].max_memkb, "ssidref", info[i].ssidref,
tools/python/xen/lowlevel/xu/xu.c +0 -3
@@ -45,9 +45,6 @@#define EVTCHN_BIND _IO('E', 2)/* EVTCHN_UNBIND: Unbind from the specified event-channel port. */ #define EVTCHN_UNBIND _IO('E', 3) - -/* Size of a machine page frame. */ -#define PAGE_SIZE 4096/* Set the close-on-exec flag on a file descriptor. Doesn't currently bother * to check for errors. */
tools/python/xen/xend/XendCheckpoint.py +0 -1
@@ -17,7 +17,6 @@ from XendLogging import log SIGNATURE = "LinuxGuestRecord" -PAGE_SIZE = 4096 PATH_XC_SAVE = "/usr/libexec/xen/xc_save" PATH_XC_RESTORE = "/usr/libexec/xen/xc_restore"
tools/xcs/xcs.h +1 -1
@@ -37,7 +37,7 @@/* ------[ Other required defines ]----------------------------------------*/ /* Size of a machine page frame. */ -#define PAGE_SIZE 4096 +#define PAGE_SIZE XC_PAGE_SIZE#ifndef timersub/* XOPEN and __BSD don't cooperate well... */ #define timersub (a, b, result) \
tools/libxc/xc_ia64_stubs.c new file +39 -0
@@ -0,0 +1,39 @@ +#include "xc_private.h" + +int xc_linux_save (int xc_handle,int io_fd,u32 dom) +{ +PERROR ("xc_linux_save not implemented\n" ); +return -1 ; +} + +int xc_linux_restore (int xc_handle,int io_fd,u32 dom,unsigned long nr_pfns) +{ +PERROR ("xc_linux_restore not implemented\n" ); +return -1 ; +} + +int xc_vmx_build (int xc_handle, +u32 domid, +int memsize, +const char *image_name, +struct mem_map *mem_mapp, +const char *ramdisk_name, +const char *cmdline, +unsigned int control_evtchn, +unsigned long flags) +{ +PERROR ("xc_vmx_build not implemented\n" ); +return -1 ; +} + +int +xc_plan9_build (int xc_handle, +u32 domid, +const char *image_name, +const char *cmdline, +unsigned int control_evtchn,unsigned long flags) +{ +PERROR ("xc_plan9_build not implemented\n" ); +return -1 ; +} +
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel