[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Here is our latest patch to enable the Xen tools to
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 8c194453808697f5f7b4b883bc28ec9a61ec661d # Parent 51094fae410e574ca2194478974c034fb1884d61 Here is our latest patch to enable the Xen tools to build and work with IA64 Xen. Signed-off-by: Matt Chapman <matthewc@xxxxxx> Acked-by: Dan Magenheimer <dan.magenheimer@xxxxxx> diff -r 51094fae410e -r 8c1944538086 tools/libxc/Makefile --- a/tools/libxc/Makefile Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/Makefile Fri Jul 29 10:34:45 2005 @@ -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 diff -r 51094fae410e -r 8c1944538086 tools/libxc/xc.h --- a/tools/libxc/xc.h Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/xc.h Fri Jul 29 10:34:45 2005 @@ -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 \*/ diff -r 51094fae410e -r 8c1944538086 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/xc_domain.c Fri Jul 29 10:34:45 2005 @@ -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) { diff -r 51094fae410e -r 8c1944538086 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/xc_linux_build.c Fri Jul 29 10:34:45 2005 @@ -8,7 +8,7 @@ #define ELFSIZE 32 #endif -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__ia64__) #define ELFSIZE 64 #endif @@ -34,6 +34,10 @@ #define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) #define round_pgdown(_p) ((_p)&PAGE_MASK) + +#ifdef __ia64__ +#define probe_aout9(image,image_size,load_funcs) 1 +#endif static int probeimageformat(char *image, unsigned long image_size, @@ -258,6 +262,67 @@ } #endif +#ifdef __ia64__ +#include <asm/fpu.h> /* for FPSR_DEFAULT */ +static int setup_guest(int xc_handle, + u32 dom, + char *image, unsigned long image_size, + gzFile initrd_gfd, unsigned long initrd_len, + unsigned long nr_pages, + unsigned long *pvsi, unsigned long *pvke, + unsigned long *pvss, vcpu_guest_context_t *ctxt, + const char *cmdline, + unsigned long shared_info_frame, + unsigned int control_evtchn, + unsigned long flags, + unsigned int vcpus, + unsigned int store_evtchn, unsigned long *store_mfn) +{ + unsigned long *page_array = NULL; + struct load_funcs load_funcs; + struct domain_setup_info dsi; + unsigned long start_page; + int rc; + + rc = probeimageformat(image, image_size, &load_funcs); + if ( rc != 0 ) + goto error_out; + + memset(&dsi, 0, sizeof(struct domain_setup_info)); + + rc = (load_funcs.parseimage)(image, image_size, &dsi); + if ( rc != 0 ) + goto error_out; + + dsi.v_start = round_pgdown(dsi.v_start); + dsi.v_end = round_pgup(dsi.v_end); + + start_page = dsi.v_start >> PAGE_SHIFT; + nr_pages = (dsi.v_end - dsi.v_start) >> PAGE_SHIFT; + if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ) + { + PERROR("Could not allocate memory"); + goto error_out; + } + + if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array, start_page, nr_pages) != nr_pages ) + { + PERROR("Could not get the page frame list"); + goto error_out; + } + + (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array, + &dsi); + + *pvke = dsi.v_kernentry; + return 0; + + error_out: + if ( page_array != NULL ) + free(page_array); + return -1; +} +#else /* x86 */ static int setup_guest(int xc_handle, u32 dom, char *image, unsigned long image_size, @@ -557,6 +622,7 @@ free(page_array); return -1; } +#endif int xc_linux_build(int xc_handle, u32 domid, @@ -627,7 +693,11 @@ } if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || +#ifdef __ia64__ + 0 ) +#else (ctxt->ctrlreg[3] != 0) ) +#endif { ERROR("Domain is already constructed"); goto error_out; @@ -652,6 +722,18 @@ if ( image != NULL ) free(image); +#ifdef __ia64__ + /* based on new_thread in xen/arch/ia64/domain.c */ + ctxt->regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */ + ctxt->regs.cr_iip = vkern_entry; + ctxt->regs.cr_ifs = 1UL << 63; + ctxt->regs.ar_fpsr = FPSR_DEFAULT; + /* ctxt->regs.r28 = dom_fw_setup(); currently done by hypervisor, should move here */ + ctxt->vcpu.privregs = 0; + ctxt->shared.domain_controller_evtchn = control_evtchn; + ctxt->shared.flags = flags; + i = 0; /* silence unused variable warning */ +#else /* x86 */ /* * Initial register values: * DS,ES,FS,GS = FLAT_KERNEL_DS @@ -706,6 +788,7 @@ ctxt->failsafe_callback_eip = 0; ctxt->syscall_callback_eip = 0; #endif +#endif /* x86 */ memset( &launch_op, 0, sizeof(launch_op) ); diff -r 51094fae410e -r 8c1944538086 tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/xc_load_elf.c Fri Jul 29 10:34:45 2005 @@ -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++ ) diff -r 51094fae410e -r 8c1944538086 tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/xc_private.c Fri Jul 29 10:34:45 2005 @@ -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; diff -r 51094fae410e -r 8c1944538086 tools/libxc/xc_private.h --- a/tools/libxc/xc_private.h Fri Jul 29 10:31:22 2005 +++ b/tools/libxc/xc_private.h Fri Jul 29 10:34:45 2005 @@ -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)) diff -r 51094fae410e -r 8c1944538086 tools/misc/Makefile --- a/tools/misc/Makefile Fri Jul 29 10:31:22 2005 +++ b/tools/misc/Makefile Fri Jul 29 10:34:45 2005 @@ -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 diff -r 51094fae410e -r 8c1944538086 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Fri Jul 29 10:31:22 2005 +++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jul 29 10:34:45 2005 @@ -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, diff -r 51094fae410e -r 8c1944538086 tools/python/xen/lowlevel/xu/xu.c --- a/tools/python/xen/lowlevel/xu/xu.c Fri Jul 29 10:31:22 2005 +++ b/tools/python/xen/lowlevel/xu/xu.c Fri Jul 29 10:34:45 2005 @@ -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. */ diff -r 51094fae410e -r 8c1944538086 tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Fri Jul 29 10:31:22 2005 +++ b/tools/python/xen/xend/XendCheckpoint.py Fri Jul 29 10:34:45 2005 @@ -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" diff -r 51094fae410e -r 8c1944538086 tools/xcs/xcs.h --- a/tools/xcs/xcs.h Fri Jul 29 10:31:22 2005 +++ b/tools/xcs/xcs.h Fri Jul 29 10:34:45 2005 @@ -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) \ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |