debuggers.hg
changeset 13973:819b8a872d9f
[POWERPC][XEN] Add information into flat devtree needed to create a start_info_t structure in linux.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author | Hollis Blanchard <hollisb@us.ibm.com> |
---|---|
date | Tue Feb 06 13:42:19 2007 -0600 (2007-02-06) |
parents | 4ce0b332b572 |
children | 978ff6fad81f |
files | tools/libxc/powerpc64/mk_flatdevtree.c tools/libxc/powerpc64/mk_flatdevtree.h tools/libxc/powerpc64/xc_linux_build.c |
line diff
1.1 --- a/tools/libxc/powerpc64/mk_flatdevtree.c Tue Feb 06 13:42:19 2007 -0600 1.2 +++ b/tools/libxc/powerpc64/mk_flatdevtree.c Tue Feb 06 13:42:19 2007 -0600 1.3 @@ -316,13 +316,17 @@ int make_devtree(struct ft_cxt *root, 1.4 unsigned long shadow_mb, 1.5 unsigned long initrd_base, 1.6 unsigned long initrd_len, 1.7 - const char *bootargs) 1.8 + const char *bootargs, 1.9 + uint64_t shared_info_paddr, 1.10 + unsigned long console_evtchn, 1.11 + uint64_t console_paddr, 1.12 + unsigned long store_evtchn, 1.13 + uint64_t store_paddr) 1.14 { 1.15 struct boot_param_header *bph = NULL; 1.16 uint64_t val[2]; 1.17 uint32_t val32[2]; 1.18 unsigned long remaining; 1.19 - unsigned long rma_reserve = 4 * PAGE_SIZE; 1.20 unsigned long initrd_end = initrd_base + initrd_len; 1.21 int64_t shadow_mb_log; 1.22 uint64_t pft_size; 1.23 @@ -351,10 +355,26 @@ int make_devtree(struct ft_cxt *root, 1.24 1.25 /* you MUST set reservations BEFORE _starting_the_tree_ */ 1.26 1.27 - /* reserve some pages at the end of RMA */ 1.28 - val[0] = cpu_to_be64((u64) (rma_bytes - rma_reserve)); 1.29 - val[1] = cpu_to_be64((u64) rma_reserve); 1.30 - ft_add_rsvmap(root, val[0], val[1]); 1.31 + /* reserve shared_info_t page */ 1.32 + if (shared_info_paddr) { 1.33 + val[0] = cpu_to_be64((u64) shared_info_paddr); 1.34 + val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.35 + ft_add_rsvmap(root, val[0], val[1]); 1.36 + } 1.37 + 1.38 + /* reserve console page for domU */ 1.39 + if (console_paddr) { 1.40 + val[0] = cpu_to_be64((u64) console_paddr); 1.41 + val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.42 + ft_add_rsvmap(root, val[0], val[1]); 1.43 + } 1.44 + 1.45 + /* reserve xen store page for domU */ 1.46 + if (store_paddr) { 1.47 + val[0] = cpu_to_be64((u64) store_paddr); 1.48 + val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.49 + ft_add_rsvmap(root, val[0], val[1]); 1.50 + } 1.51 1.52 /* reserve space for initrd if needed */ 1.53 if ( initrd_len > 0 ) { 1.54 @@ -419,19 +439,19 @@ int make_devtree(struct ft_cxt *root, 1.55 /* xen = root.addnode('xen') */ 1.56 ft_begin_node(root, "xen"); 1.57 1.58 - /* start-info is the first page in the RMA reserved area */ 1.59 - val[0] = cpu_to_be64((u64) (rma_bytes - rma_reserve)); 1.60 - val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.61 - ft_prop(root, "start-info", val, sizeof(val)); 1.62 - 1.63 /* xen.addprop('version', 'Xen-3.0-unstable\0') */ 1.64 - ft_prop_str(root, "version", "Xen-3.0-unstable"); 1.65 + ft_prop_str(root, "compatible", "Xen-3.0-unstable"); 1.66 1.67 /* xen.addprop('reg', long(imghandler.vm.domid), long(0)) */ 1.68 val[0] = cpu_to_be64((u64) domid); 1.69 val[1] = cpu_to_be64((u64) 0); 1.70 ft_prop(root, "reg", val, sizeof(val)); 1.71 1.72 + /* point to shared_info_t page base addr */ 1.73 + val[0] = cpu_to_be64((u64) shared_info_paddr); 1.74 + val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.75 + ft_prop(root, "shared-info", val, sizeof(val)); 1.76 + 1.77 /* xen.addprop('domain-name', imghandler.vm.getName() + '\0') */ 1.78 /* libxc doesn't know the domain name, that is purely a xend thing */ 1.79 /* ft_prop_str(root, "domain-name", domain_name); */ 1.80 @@ -439,16 +459,41 @@ int make_devtree(struct ft_cxt *root, 1.81 /* add xen/linux,phandle for chosen/interrupt-controller */ 1.82 ft_prop_int(root, "linux,phandle", xen_phandle); 1.83 1.84 - /* xencons = xen.addnode('console') */ 1.85 - ft_begin_node(root, "console"); 1.86 + if (console_paddr != 0) { 1.87 + /* xencons = xen.addnode('console') */ 1.88 + ft_begin_node(root, "console"); 1.89 + 1.90 + /* console_paddr */ 1.91 + val[0] = cpu_to_be64((u64) console_paddr); 1.92 + val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.93 + ft_prop(root, "reg", val, sizeof(val)); 1.94 + 1.95 + /* xencons.addprop('interrupts', console_evtchn, 0) */ 1.96 + val32[0] = cpu_to_be32((u32) console_evtchn); 1.97 + val32[1] = cpu_to_be32((u32) 0); 1.98 + ft_prop(root, "interrupts", val32, sizeof(val32)); 1.99 + 1.100 + /* end of console */ 1.101 + ft_end_node(root); 1.102 + } 1.103 1.104 - /* xencons.addprop('interrupts', 1, 0) */ 1.105 - val32[0] = cpu_to_be32((u32) 1); 1.106 - val32[1] = cpu_to_be32((u32) 0); 1.107 - ft_prop(root, "interrupts", val32, sizeof(val32)); 1.108 + if (store_paddr != 0) { 1.109 + /* start store node */ 1.110 + ft_begin_node(root, "store"); 1.111 + 1.112 + /* store paddr */ 1.113 + val[0] = cpu_to_be64((u64) store_paddr); 1.114 + val[1] = cpu_to_be64((u64) PAGE_SIZE); 1.115 + ft_prop(root, "reg", val, sizeof(val)); 1.116 1.117 - /* end of console */ 1.118 - ft_end_node(root); 1.119 + /* store event channel */ 1.120 + val32[0] = cpu_to_be32((u32) store_evtchn); 1.121 + val32[1] = cpu_to_be32((u32) 0); 1.122 + ft_prop(root, "interrupts", val32, sizeof(val32)); 1.123 + 1.124 + /* end of store */ 1.125 + ft_end_node(root); 1.126 + } 1.127 1.128 /* end of xen node */ 1.129 ft_end_node(root);
2.1 --- a/tools/libxc/powerpc64/mk_flatdevtree.h Tue Feb 06 13:42:19 2007 -0600 2.2 +++ b/tools/libxc/powerpc64/mk_flatdevtree.h Tue Feb 06 13:42:19 2007 -0600 2.3 @@ -32,7 +32,12 @@ extern int make_devtree(struct ft_cxt *r 2.4 unsigned long shadow_mb, 2.5 unsigned long initrd_base, 2.6 unsigned long initrd_len, 2.7 - const char *bootargs); 2.8 + const char *bootargs, 2.9 + uint64_t shared_info_paddr, 2.10 + unsigned long console_evtchn, 2.11 + uint64_t console_paddr, 2.12 + unsigned long store_evtchn, 2.13 + uint64_t store_paddr); 2.14 2.15 #define MAX_PATH 200 2.16 #define BUFSIZE 1024
3.1 --- a/tools/libxc/powerpc64/xc_linux_build.c Tue Feb 06 13:42:19 2007 -0600 3.2 +++ b/tools/libxc/powerpc64/xc_linux_build.c Tue Feb 06 13:42:19 2007 -0600 3.3 @@ -33,6 +33,7 @@ 3.4 #include <xc_private.h> 3.5 #include <xg_private.h> 3.6 #include <xenctrl.h> 3.7 +#include <xen/arch-powerpc.h> 3.8 3.9 #include "flatdevtree_env.h" 3.10 #include "flatdevtree.h" 3.11 @@ -109,34 +110,6 @@ out: 3.12 return rc; 3.13 } 3.14 3.15 -static unsigned long create_start_info( 3.16 - start_info_t *start_info, 3.17 - unsigned int console_evtchn, 3.18 - unsigned int store_evtchn, 3.19 - unsigned long nr_pages, 3.20 - unsigned long rma_pages) 3.21 -{ 3.22 - unsigned long start_info_addr; 3.23 - uint64_t rma_top; 3.24 - 3.25 - memset(start_info, 0, sizeof(*start_info)); 3.26 - snprintf(start_info->magic, sizeof(start_info->magic), 3.27 - "xen-%d.%d-powerpc64HV", 3, 0); 3.28 - 3.29 - rma_top = rma_pages << PAGE_SHIFT; 3.30 - DPRINTF("RMA top = 0x%"PRIX64"\n", rma_top); 3.31 - 3.32 - start_info->nr_pages = nr_pages; 3.33 - start_info->shared_info = rma_top - PAGE_SIZE; 3.34 - start_info->store_mfn = (rma_top >> PAGE_SHIFT) - 2; 3.35 - start_info->store_evtchn = store_evtchn; 3.36 - start_info->console.domU.mfn = (rma_top >> PAGE_SHIFT) - 3; 3.37 - start_info->console.domU.evtchn = console_evtchn; 3.38 - start_info_addr = rma_top - 4*PAGE_SIZE; 3.39 - 3.40 - return start_info_addr; 3.41 -} 3.42 - 3.43 static void free_page_array(xen_pfn_t *page_array) 3.44 { 3.45 free(page_array); 3.46 @@ -191,7 +164,6 @@ int xc_linux_build(int xc_handle, 3.47 unsigned int console_evtchn, 3.48 unsigned long *console_mfn) 3.49 { 3.50 - start_info_t start_info; 3.51 struct domain_setup_info dsi; 3.52 xen_pfn_t *page_array = NULL; 3.53 unsigned long nr_pages; 3.54 @@ -199,9 +171,11 @@ int xc_linux_build(int xc_handle, 3.55 unsigned long kern_addr; 3.56 unsigned long initrd_base = 0; 3.57 unsigned long initrd_len = 0; 3.58 - unsigned long start_info_addr; 3.59 unsigned long rma_pages; 3.60 unsigned long shadow_mb; 3.61 + u64 shared_info_paddr; 3.62 + u64 store_paddr; 3.63 + u64 console_paddr; 3.64 u32 remaining_kb; 3.65 u32 extent_order; 3.66 u64 nr_extents; 3.67 @@ -281,25 +255,28 @@ int xc_linux_build(int xc_handle, 3.68 goto out; 3.69 } 3.70 3.71 + /* determine shared_info, console, and store paddr */ 3.72 + shared_info_paddr = (rma_pages << PAGE_SHIFT) - 3.73 + (RMA_SHARED_INFO * PAGE_SIZE); 3.74 + console_paddr = (rma_pages << PAGE_SHIFT) - (RMA_CONSOLE * PAGE_SIZE); 3.75 + store_paddr = (rma_pages << PAGE_SHIFT) - (RMA_STORE * PAGE_SIZE); 3.76 + 3.77 + /* map paddrs to mfns */ 3.78 + *store_mfn = page_array[(xen_pfn_t)(store_paddr >> PAGE_SHIFT)]; 3.79 + *console_mfn = page_array[(xen_pfn_t)(console_paddr >> PAGE_SHIFT)]; 3.80 + DPRINTF("console_mfn->%08lx store_mfn->%08lx\n", *console_mfn, 3.81 + *store_mfn); 3.82 + 3.83 /* build the devtree here */ 3.84 DPRINTF("constructing devtree\n"); 3.85 - if (make_devtree(&devtree, domid, mem_mb, (rma_pages*PAGE_SIZE), shadow_mb, 3.86 - initrd_base, initrd_len, cmdline) < 0) { 3.87 + if (make_devtree(&devtree, domid, mem_mb, (rma_pages << PAGE_SHIFT), 3.88 + shadow_mb, initrd_base, initrd_len, cmdline, 3.89 + shared_info_paddr, console_evtchn, console_paddr, 3.90 + store_evtchn, store_paddr) < 0) { 3.91 DPRINTF("failed to create flattened device tree\n"); 3.92 rc = -1; 3.93 goto out; 3.94 } 3.95 - 3.96 - /* start_info stuff: about to be removed */ 3.97 - start_info_addr = create_start_info(&start_info, console_evtchn, 3.98 - store_evtchn, nr_pages, rma_pages); 3.99 - *console_mfn = page_array[start_info.console.domU.mfn]; 3.100 - *store_mfn = page_array[start_info.store_mfn]; 3.101 - if (install_image(xc_handle, domid, page_array, &start_info, 3.102 - start_info_addr, sizeof(start_info_t))) { 3.103 - rc = -1; 3.104 - goto out; 3.105 - } 3.106 3.107 devtree_addr = DEVTREE_ADDR; 3.108 DPRINTF("loading flattened device tree to 0x%lx[0x%x]\n",