[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [xenppc-unstable] merge
# HG changeset patch # User Jimi Xenidis <jimix@xxxxxxxxxxxxxx> # Node ID c3a10094bfae99139c96aac904116ea54ecbe069 # Parent f46a34f4dea16dc107404aec8fbabc007506fe65 # Parent d5af6a21a324163b5371ce8733535ebee46156c5 merge --- tools/libxc/xc_ppc_linux_build.c | 38 +++++++++++++------------------ xen/arch/powerpc/dom0_ops.c | 43 +++++++++++++++++++++++++----------- xen/arch/powerpc/domain.c | 29 ++++++++++++++++++------ xen/arch/powerpc/powerpc64/ppc970.c | 7 +++++ xen/include/asm-powerpc/processor.h | 1 5 files changed, 75 insertions(+), 43 deletions(-) diff -r f46a34f4dea1 -r c3a10094bfae tools/libxc/xc_ppc_linux_build.c --- a/tools/libxc/xc_ppc_linux_build.c Fri Aug 04 17:25:29 2006 -0400 +++ b/tools/libxc/xc_ppc_linux_build.c Fri Aug 04 17:26:27 2006 -0400 @@ -37,11 +37,6 @@ #define MEMSIZE (64UL << 20) #define INITRD_ADDR (24UL << 20) -int verbose; -#define VERBOSE(stuff, ...) \ - if (verbose) \ - stuff __VA_ARGS__; - #define ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) #define max(x,y) ({ \ @@ -56,7 +51,7 @@ static void *load_file(const char *path, ssize_t size; int fd; - VERBOSE(printf("load_file(%s)\n", path)); + DPRINTF("load_file(%s)\n", path); fd = open(path, O_RDONLY); if (fd < 0) { @@ -114,7 +109,7 @@ static int init_boot_vcpu( * we must make sure this register is 0 */ ctxt.user_regs.gprs[13] = 0; - VERBOSE(printf("xc_vcpu_setvcpucontext:\n" + DPRINTF("xc_vcpu_setvcpucontext:\n" " pc 0x%"PRIx64", msr 0x016%"PRIx64"\n" " r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64 " %016"PRIx64"\n", @@ -123,7 +118,7 @@ static int init_boot_vcpu( ctxt.user_regs.gprs[2], ctxt.user_regs.gprs[3], ctxt.user_regs.gprs[4], - ctxt.user_regs.gprs[5])); + ctxt.user_regs.gprs[5]); rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt); if (rc < 0) perror("setdomaininfo"); @@ -181,8 +176,7 @@ static int load_dtb( goto out; } - VERBOSE(printf("copying device tree to 0x%lx[0x%lx]\n", - dtb_addr, dtb_size)); + DPRINTF("copying device tree to 0x%lx[0x%lx]\n", dtb_addr, dtb_size); rc = install_image(xc_handle, domid, page_array, img, dtb_addr, dtb_size); out: @@ -241,7 +235,7 @@ static int load_kernel( hack_kernel_img(kernel_img); - VERBOSE(printf("probe_elf\n")); + DPRINTF("probe_elf\n"); rc = probe_elf(kernel_img, kernel_size, &load_funcs); if (rc < 0) { rc = -1; @@ -249,22 +243,22 @@ static int load_kernel( goto out; } - VERBOSE(printf("parseimage\n")); + DPRINTF("parseimage\n"); rc = (load_funcs.parseimage)(kernel_img, kernel_size, dsi); if (rc < 0) { rc = -1; goto out; } - VERBOSE(printf("loadimage\n")); + DPRINTF("loadimage\n"); (load_funcs.loadimage)(kernel_img, kernel_size, xc_handle, domid, page_array, dsi); - VERBOSE(printf(" v_start %016"PRIx64"\n", dsi->v_start)); - VERBOSE(printf(" v_end %016"PRIx64"\n", dsi->v_end)); - VERBOSE(printf(" v_kernstart %016"PRIx64"\n", dsi->v_kernstart)); - VERBOSE(printf(" v_kernend %016"PRIx64"\n", dsi->v_kernend)); - VERBOSE(printf(" v_kernentry %016"PRIx64"\n", dsi->v_kernentry)); + DPRINTF(" v_start %016"PRIx64"\n", dsi->v_start); + DPRINTF(" v_end %016"PRIx64"\n", dsi->v_end); + DPRINTF(" v_kernstart %016"PRIx64"\n", dsi->v_kernstart); + DPRINTF(" v_kernend %016"PRIx64"\n", dsi->v_kernend); + DPRINTF(" v_kernentry %016"PRIx64"\n", dsi->v_kernentry); out: free(kernel_img); @@ -287,7 +281,7 @@ static int load_initrd( if (initrd_img == NULL) return -1; - VERBOSE(printf("copying initrd to 0x%lx[0x%lx]\n", INITRD_ADDR, *len)); + DPRINTF("copying initrd to 0x%lx[0x%lx]\n", INITRD_ADDR, *len); if (install_image(xc_handle, domid, page_array, initrd_img, INITRD_ADDR, *len)) goto out; @@ -326,9 +320,9 @@ static int get_page_array(int xc_handle, int nr_pages; int rc; - VERBOSE(printf("xc_get_tot_pages\n")); + DPRINTF("xc_get_tot_pages\n"); nr_pages = xc_get_tot_pages(xc_handle, domid); - VERBOSE(printf(" 0x%x\n", nr_pages)); + DPRINTF(" 0x%x\n", nr_pages); *page_array = malloc(nr_pages * sizeof(xen_pfn_t)); if (*page_array == NULL) { @@ -336,7 +330,7 @@ static int get_page_array(int xc_handle, return -1; } - VERBOSE(printf("xc_get_pfn_list\n")); + DPRINTF("xc_get_pfn_list\n"); rc = xc_get_pfn_list(xc_handle, domid, *page_array, nr_pages); if (rc != nr_pages) { perror("Could not get the page frame list"); diff -r f46a34f4dea1 -r c3a10094bfae xen/arch/powerpc/dom0_ops.c --- a/xen/arch/powerpc/dom0_ops.c Fri Aug 04 17:25:29 2006 -0400 +++ b/xen/arch/powerpc/dom0_ops.c Fri Aug 04 17:26:27 2006 -0400 @@ -40,23 +40,40 @@ long arch_do_dom0_op(struct dom0_op *op, long ret = 0; switch (op->cmd) { - case DOM0_GETMEMLIST: { - /* XXX 64M hackage */ - const int memsize = (64UL<<20); - int domain_pfns = memsize>>12; - int max_pfns = op->u.getmemlist.max_pfns; - int domid = op->u.getmemlist.domain; + case DOM0_GETMEMLIST: + { int i; + struct domain *d = find_domain_by_id(op->u.getmemlist.domain); + unsigned long max_pfns = op->u.getmemlist.max_pfns; + xen_pfn_t mfn; + struct list_head *list_ent; - for (i = 0; (i < max_pfns) && (i < domain_pfns); i++) { - xen_pfn_t mfn = (((domid + 1) * memsize) >> 12) + i; - if (copy_to_guest_offset(op->u.getmemlist.buffer, i, &mfn, 1)) { - ret = -EFAULT; - break; + ret = -EINVAL; + if ( d != NULL ) + { + ret = 0; + + spin_lock(&d->page_alloc_lock); + list_ent = d->page_list.next; + for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ ) + { + mfn = page_to_mfn(list_entry( + list_ent, struct page_info, list)); + if ( copy_to_guest_offset(op->u.getmemlist.buffer, + i, &mfn, 1) ) + { + ret = -EFAULT; + break; + } + list_ent = mfn_to_page(mfn)->list.next; } + spin_unlock(&d->page_alloc_lock); + + op->u.getmemlist.num_pfns = i; + copy_to_guest(u_dom0_op, op, 1); + + put_domain(d); } - op->u.getmemlist.num_pfns = i; - copy_to_guest(u_dom0_op, op, 1); } break; diff -r f46a34f4dea1 -r c3a10094bfae xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Fri Aug 04 17:25:29 2006 -0400 +++ b/xen/arch/powerpc/domain.c Fri Aug 04 17:26:27 2006 -0400 @@ -73,6 +73,10 @@ unsigned long hypercall_create_continuat int arch_domain_create(struct domain *d) { + struct page_info *rma; + unsigned long rma_base; + unsigned long rma_size; + unsigned int rma_order; if (d->domain_id == IDLE_DOMAIN_ID) { d->shared_info = (void *)alloc_xenheap_page(); @@ -81,17 +85,28 @@ int arch_domain_create(struct domain *d) return 0; } - /* XXX the hackage... hardcode 64M domains */ - d->arch.rma_base = (64<<20) * (d->domain_id + 1); - d->arch.rma_size = (64<<20); - - printk("clearing RMO: 0x%lx[0x%lx]\n", d->arch.rma_base, d->arch.rma_size); - memset((void*)d->arch.rma_base, 0, d->arch.rma_size); + rma_order = cpu_rma_order(); + rma_size = 1UL << rma_order << PAGE_SHIFT; + + /* allocate the real mode area */ + d->max_pages = 1UL << rma_order; + rma = alloc_domheap_pages(d, rma_order, 0); + if (NULL == rma) + return 1; + rma_base = page_to_maddr(rma); + + BUG_ON(rma_base & (rma_size-1)); /* check alignment */ + + d->arch.rma_base = rma_base; + d->arch.rma_size = rma_size; + + printk("clearing RMO: 0x%lx[0x%lx]\n", rma_base, rma_size); + memset((void *)rma_base, 0, rma_size); htab_alloc(d, LOG_DEFAULT_HTAB_BYTES); d->shared_info = (shared_info_t *) - (rma_addr(&d->arch, RMA_SHARED_INFO) + d->arch.rma_base); + (rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base); d->arch.large_page_sizes = 1; d->arch.large_page_shift[0] = 24; /* 16 M for 970s */ diff -r f46a34f4dea1 -r c3a10094bfae xen/arch/powerpc/powerpc64/ppc970.c --- a/xen/arch/powerpc/powerpc64/ppc970.c Fri Aug 04 17:25:29 2006 -0400 +++ b/xen/arch/powerpc/powerpc64/ppc970.c Fri Aug 04 17:26:27 2006 -0400 @@ -30,6 +30,12 @@ #include <asm/powerpc64/ppc970-hid.h> #undef SERIALIZE + +unsigned int cpu_rma_order(void) +{ + /* XXX what about non-HV mode? */ + return 14; /* 1<<14<<PAGE_SIZE = 64M */ +} void cpu_initialize(void) { @@ -102,7 +108,6 @@ void cpu_initialize(void) mthid5(hid5.word); __asm__ __volatile__("isync; slbia; isync" : : : "memory"); - } void cpu_init_vcpu(struct vcpu *v) diff -r f46a34f4dea1 -r c3a10094bfae xen/include/asm-powerpc/processor.h --- a/xen/include/asm-powerpc/processor.h Fri Aug 04 17:25:29 2006 -0400 +++ b/xen/include/asm-powerpc/processor.h Fri Aug 04 17:26:27 2006 -0400 @@ -39,6 +39,7 @@ struct cpu_user_regs; struct cpu_user_regs; extern void show_registers(struct cpu_user_regs *); extern void show_execution_state(struct cpu_user_regs *); +extern unsigned int cpu_rma_order(void); extern void cpu_initialize(void); extern void cpu_init_vcpu(struct vcpu *); extern void save_cpu_sprs(struct vcpu *); _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ppc-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |