[XenPPC] Re: [Xen-devel] [RFC][PATCH 1/2] export NUMA topology from xen
* Keir Fraser [EMAIL PROTECTED] [2007-04-10 04:13]: On 10/4/07 02:09, Ryan Harper [EMAIL PROTECTED] wrote: nr_nodes : 4 mem_chunks : node0:0x-0x00019000 node1:0x00019000-0x0003 node2:0x0003-0x00047000 node3:0x00047000-0x00064000 node_to_cpu: node0:0-7 node1:8-15 node2:16-23 node3:24-31 I've also reworked the the physinfo call to contain an array of cpu_to_node elements rather than node_to_cpu to support machines larger than 64-way. I convert the array back to node_to_cpu for brevity in xm info display. The same would make sense for memory regions (i.e., have a list of memory-regions and include a node identifier for each one, rather than mapping node-id to memory-region) as this would allow to have multiple memory regions per node quite easily. But actually I'm not convinced that allowing dom0 to read out the physical addresses of memory regions is at all useful -- why would anyone care which particular physical address ranges belong to a particular node? The hypercall to find amount of free memory per node seems more useful, and probably sufficient by itself. Updated. - Dropped mem_chunks (removed that from existing ia64 NUMA physinfo) - Fixed up ia64 cpu_to_node_map array size (was MAX_NUMNODES, now NR_CPUS) - Fixed sockets_per_node calculation (was bogus on Opteron systems) - Updated all arches physinfo call to use num_online_nodes() and new sockets_per_node calculation Untested on ia64, ppc. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: tools/libxc/xc_misc.c |3 tools/libxc/xenctrl.h |1 tools/python/xen/lowlevel/xc/xc.c | 61 tools/python/xen/xend/XendNode.py | 50 tools/xenmon/xenbaked.c |3 tools/xenstat/libxenstat/src/xenstat.c |3 tools/xentrace/xentrace.c |3 tools/xm-test/tests/info/02_info_compiledata_pos.py |4 - xen/arch/ia64/xen/dom0_ops.c| 46 +-- xen/arch/powerpc/sysctl.c |6 - xen/arch/x86/sysctl.c | 33 +- xen/include/public/sysctl.h |1 12 files changed, 152 insertions(+), 62 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- This patch modifies the physinfo hcall to export NUMA cpu_to_node topology information. The new physinfo hcall is integrated into libxc and xend (xm info specifically). Included in this patch is a minor tweak to xm-test's xm info testcase. I've also fixed the sockets_per_node calculation. The new fields in xm info are: nr_cpus: 32 nr_nodes : 4 sockets_per_node : 4 cores_per_socket : 1 threads_per_core : 2 ... node_to_cpu: node0:0-7 node1:8-15 node2:16-23 node3:24-31 I've also reworked the the physinfo call to contain an array of cpu_to_node elements rather than node_to_cpu to support machines larger than 64-ways. I convert the array back to node_to_cpu for brevity in xm info display. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 400a3dca237e tools/libxc/xc_misc.c --- a/tools/libxc/xc_misc.c Mon Apr 09 12:05:26 2007 +0100 +++ b/tools/libxc/xc_misc.c Fri Apr 13 13:04:24 2007 -0500 @@ -59,6 +59,9 @@ int xc_physinfo(int xc_handle, DECLARE_SYSCTL; sysctl.cmd = XEN_SYSCTL_physinfo; + +/* set pointers to caller's so memcpy doesn't clobber them */ +sysctl.u.physinfo.cpu_to_node = put_info-cpu_to_node; if ( (ret = do_sysctl(xc_handle, sysctl)) != 0 ) return ret; diff -r 400a3dca237e tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Mon Apr 09 12:05:26 2007 +0100 +++ b/tools/libxc/xenctrl.h Fri Apr 13 13:04:24 2007 -0500 @@ -473,6 +473,7 @@ int xc_send_debug_keys(int xc_handle, ch int xc_send_debug_keys(int xc_handle, char *keys); typedef xen_sysctl_physinfo_t xc_physinfo_t; +typedef uint32_t xc_cpu_to_node_t; int xc_physinfo(int xc_handle, xc_physinfo_t *info); diff -r 400a3dca237e tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Mon Apr 09 12:05:26 2007 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Fri Apr 13 15:41:39 2007 -0500 @@ -640,14 +640,26 @@ static PyObject *pyxc_pages_to_kib(XcObj } +#define MAX_NR_CPUS 256 static PyObject *pyxc_physinfo(XcObject *self) { xc_physinfo_t info; char cpu_cap[128], *p=cpu_cap
[XenPPC] [PATCH 2 of 2] [PATCH] introduce io hole into dom0 p2m map
3 files changed, 14 insertions(+), 11 deletions(-) xen/arch/powerpc/domain_build.c | 15 --- xen/arch/powerpc/mm.c |6 ++ xen/arch/powerpc/ofd_fixup_memory.c |4 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1174331762 18000 # Node ID ffc0f57d6f6b16edb1587bc7aeda48d21e323f8f # Parent 155c212fda16103d2f58ea3a321f61a68b044846 [PATCH] introduce io hole into dom0 p2m map This patch adds in space in dom0's p2m map if dom0's memory footprint would run into the io hole. We check the request memory, if exceeds the size of the io hole, we add in the size of the iohole t othe p2m map. During extent allocation, when we are initializing pfns that would normally fall within the io hole, we shift those up past the end of the io hole. Dom0 devtree has to be aware of how its memory is laid out. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 155c212fda16 -r ffc0f57d6f6b xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Mon Mar 19 14:16:01 2007 -0500 +++ b/xen/arch/powerpc/domain_build.c Mon Mar 19 14:16:02 2007 -0500 @@ -74,6 +74,7 @@ int construct_dom0(struct domain *d, ulong eomem; int preempt = 0; int vcpu; +uint p2m_size; ulong mod_start = 0; ulong mod_len = 0; ulong shared_info_addr; @@ -130,16 +131,16 @@ int construct_dom0(struct domain *d, ((dom0_nrpages PAGE_SHIFT) 20)); } -/* XXX Dom0 currently can't extend past the IO hole. */ -if (dom0_nrpages (platform_iohole_base() PAGE_SHIFT)) { -dom0_nrpages = (platform_iohole_base() PAGE_SHIFT); -printk(Limiting DOM0 memory size to %u MiB to avoid IO hole.\n, -((dom0_nrpages PAGE_SHIFT) 20)); -} +/* if we extend into IO range, add in IO range */ +p2m_size = dom0_nrpages; +if (p2m_size (platform_iohole_size() PAGE_SHIFT)) +p2m_size += (platform_iohole_size() PAGE_SHIFT); /* Set Dom0 max mem, triggering p2m table creation. */ -if ((guest_physmap_max_mem_pages(d, dom0_nrpages)) != 0) +spin_lock(d-page_alloc_lock); +if ((guest_physmap_max_mem_pages(d, (ulong)p2m_size)) != 0) panic(Failed to set DOM0 max mem pages value\n); +spin_unlock(d-page_alloc_lock); d-max_pages = dom0_nrpages; if (0 allocate_rma(d, cpu_default_rma_order_pages())) diff -r 155c212fda16 -r ffc0f57d6f6b xen/arch/powerpc/mm.c --- a/xen/arch/powerpc/mm.c Mon Mar 19 14:16:01 2007 -0500 +++ b/xen/arch/powerpc/mm.c Mon Mar 19 14:16:02 2007 -0500 @@ -316,6 +316,8 @@ uint allocate_extents(struct domain *d, struct page_info *pg; ulong mfn; ulong gpfn = rma_nrpages; /* starting PFN at end of RMA */ +ulong iobase_page = platform_iohole_base() PAGE_SHIFT; +ulong iobase_sz = platform_iohole_size() PAGE_SHIFT; uint ext_order; uint ext_nrpages; uint total_nrpages; @@ -342,6 +344,10 @@ uint allocate_extents(struct domain *d, gpfn += ext_nrpages; total_nrpages += ext_nrpages; + +/* if the current gpfn falls within the iohole, offset it */ +if ((gpfn = iobase_page) (gpfn (iobase_page + iobase_sz))) +gpfn += iobase_sz; } return total_nrpages; diff -r 155c212fda16 -r ffc0f57d6f6b xen/arch/powerpc/ofd_fixup_memory.c --- a/xen/arch/powerpc/ofd_fixup_memory.c Mon Mar 19 14:16:01 2007 -0500 +++ b/xen/arch/powerpc/ofd_fixup_memory.c Mon Mar 19 14:16:02 2007 -0500 @@ -101,15 +101,11 @@ static void ofd_memory_extent_nodes(void BUG_ON(n = 0); -/* XXX Our p2m translation currnetly doesn't allow dom0 memory above - * the IO hole. */ -#if 0 /* remaining memory shifted up to [EMAIL PROTECTED] */ start = platform_iohole_base()+platform_iohole_size(); size = (d-tot_pages PAGE_SHIFT) - platform_iohole_base(); n = ofd_memory_node_create(m, OFD_ROOT, , memory, memory, start, size); -#endif } else { /* we fit beneath the IO hole as one chunk */ start = cur_pfn PAGE_SHIFT; ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH] linux: flag mfns when mapping another domain's memory
1 files changed, 16 insertions(+) arch/powerpc/platforms/xen/setup.c | 16 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1174343262 18000 # Node ID e4586f18b81e035f2b60d02f487ee23d01049e66 # Parent 04f6ad5d9232878cbcf8810025bb3ab59cbb62b6 linux: flag mfns when mapping another domain's memory This patch reads the mfn flag from the devtree, and then when mapping in guest memory, adds the flag to aid the hypervisor in pfn to mfn translation. diff -r 04f6ad5d9232 -r e4586f18b81e arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.cMon Mar 05 13:23:38 2007 -0600 +++ b/arch/powerpc/platforms/xen/setup.cMon Mar 19 17:27:42 2007 -0500 @@ -39,6 +39,8 @@ extern struct machdep_calls mach_maple_m extern struct machdep_calls mach_maple_md; extern void maple_pci_init(void); +static unsigned long foreign_mfn_flag; + int direct_remap_pfn_range(struct vm_area_struct *vma, unsigned long address, unsigned long mfn, @@ -48,6 +50,9 @@ int direct_remap_pfn_range(struct vm_are { int rc; + /* set flag in mfn to tell xen this is an mfn not an pfn */ + mfn = mfn | foreign_mfn_flag; + down_write(vma-vm_mm-mmap_sem); rc = remap_pfn_range(vma, address, mfn, size, prot); up_write(vma-vm_mm-mmap_sem); @@ -89,6 +94,7 @@ static void __init xen_init_early(void) static void __init xen_init_early(void) { struct device_node *xen; + u64 *v; DBG( - %s\n, __func__); @@ -147,6 +153,16 @@ static void __init xen_init_early(void) xen_reboot_init(mach_maple_md); else xen_reboot_init(NULL); + + /* get mfn-base for dom0 to flag guest mfns */ + v = (u64 *)get_property(xen, mfn-base, NULL); + if (v) { + if (is_initial_xendomain()) { + foreign_mfn_flag = (1UL ((unsigned long) *(v))); + printk(OF: using 0x%lx as foreign mfn flag\n, foreign_mfn_flag); + } else + printk(OF: /xen/mfn-base must be present it build guests\n); + } /* get the domain features */ setup_xen_features(); ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 0 of 2] [PATCH] xen: flag gmfns as mfns
This patchset adds the ability to mark gmfn values indicating that they are mfns. This disambiguates the case where a privileged domain might ask the hypervisor to insert a guest's mfn and the value is both a valid mfn, and a valid pfn for the priviledged domain. The flag is added to Xen, used in pfn2mfn(), and exported via the devtree to dom0. A seperate patch to Linux reads the value of the flag and updates Linux to use the flag when mapping another domain's memory. Signed-off-by: Ryan Harper [EMAIL PROTECTED] 5 files changed, 57 insertions(+), 31 deletions(-) xen/arch/powerpc/domain_build.c | 15 + xen/arch/powerpc/mm.c | 56 ++- xen/arch/powerpc/ofd_fixup.c|6 +++ xen/arch/powerpc/ofd_fixup_memory.c |4 -- xen/include/asm-powerpc/mm.h|7 ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] RFC: Move p2m table into the kernel for priv domains
In testing out the p2m/m2p patches which simplify our memory translation code, I ran into the issue of not being able to distinguish foreign machine frames from valid dom0 pfns with dom0 2G. To address this particular issue we want to move the p2m table from Xen into the guest kernel for privileged domains (or any domain needing to do IO) and require priv domains to pass machine addrs to the hypervisor for insertion into the hash table. As a result of this change, we can further simplify our pfn2mfn() translation (we can drop check for IO, and the foreign type check hack) and we will be able to support balloon drivers, with priv domains maintaining their p2m table. The privileged guest needs the p2m table to be available during early boot in order to build its memory mappings. As the guest is in real-mode during early boot the p2m table has to reside in the RMA. By putting the p2m table in the RMA, we are introducing some limitations. There are smaller RMA sizes that we would like to use even if we are stuck at 64MB for now, however, putting in the p2m table would keep our min RMA at 64MB. Assuming that we would install the p2m table at 32MB, that imposes a practical limit of a guest no larger than 32G. For dom0, the p2m table will be constructed and initialized in Xen, but installed into the domain's RMA. A new entry in the devtree will contain the paddr of this table for use by Linux. We will override hpte_insert et al to use the p2m table prior to hcall. The following changes will be needed: Xen: guest_physmap_{add/remove}_page(): - don't manipulate the p2m table for non-shadow domains as the guest kernel will maintain the translation something like: guest_physmap_add_page() if (!d-is_shadow) return; /* update d-arch.p2m table for shadow domains*/ pfn2mfn(): - translation for priv domains is done in the kernel if (!d-is_shadow) return pfn; construct_dom0: - we won't initialize the Xen p2m table for dom0 (d-arch.p2m) don't call guest_physmap_max_mem_pages() - allocate the rma (which calls guest_physmap_add_page, but that is a nop for non-shadow domains) - calculate a location for the p2m table in the guest RMA something like just past the OF area, or some distance back from the end of the RMA, leaving enough room for a p2m table that covers the max domain size as limited by the platform - fix up p2m table in RMA with the mfns allocated. We can do this as we have a struct page pointer (d-arch.rma_page) which we can turn into a mfn. A simple for loop and we will build the p2m mapping for the RMA. - set d-arch.p2m to the maddr of the p2m table in the guest RMA this will be used when we allocate extents for the domain. - add paddr of p2m table to devtree or at least keep track of paddr for devtree to use when we later construct it - allocate_extents() - as we allocate the extents, rather than call guest_physmap_add_page() we use the struct page pointer and a small for loop to initialize the p2m table directly (using d-arch.p2m). Linux: - override hpte_insert et al to translate pfn to mfn prior to hcall - modify xen comm code (for priv domains) to use p2m table to translate physical to machine before calling hypervisor -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 1 of 5] [PATCH] xen: add arch hook for max_mem hcall
4 files changed, 14 insertions(+), 1 deletion(-) xen/common/domctl.c |4 xen/include/asm-ia64/shadow.h|2 ++ xen/include/asm-powerpc/shadow.h |7 ++- xen/include/asm-x86/shadow.h |2 ++ # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172776731 21600 # Node ID af8e290682dd2c045fa181d5837ae2d3c97e856c # Parent 0902dfafca1c9b247556760e451fabd7eb464345 [PATCH] xen: add arch hook for max_mem hcall This patch introduces an arch hook in the MAX_MEM hcall. In particular, powerpc will use this hook to create/update a p2m mapping array. This patch introduces the hook only and should compile away on all arches. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 0902dfafca1c -r af8e290682dd xen/common/domctl.c --- a/xen/common/domctl.c Mon Feb 26 15:29:42 2007 -0600 +++ b/xen/common/domctl.c Thu Mar 01 13:18:51 2007 -0600 @@ -19,6 +19,7 @@ #include xen/iocap.h #include xen/guest_access.h #include xen/bitmap.h +#include xen/shadow.h #include asm/current.h #include public/domctl.h #include acm/acm_hooks.h @@ -614,6 +615,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc spin_lock(d-page_alloc_lock); if ( new_max = d-tot_pages ) { +ret = guest_physmap_max_mem_pages(d, new_max); +if ( ret != 0 ) +break; d-max_pages = new_max; ret = 0; } diff -r 0902dfafca1c -r af8e290682dd xen/include/asm-ia64/shadow.h --- a/xen/include/asm-ia64/shadow.h Mon Feb 26 15:29:42 2007 -0600 +++ b/xen/include/asm-ia64/shadow.h Thu Mar 01 13:18:51 2007 -0600 @@ -61,6 +61,8 @@ shadow_mark_page_dirty(struct domain *d, return 0; } +#define guest_physmap_max_mem_pages(d, n) (0) + #endif // _XEN_SHADOW_H /* diff -r 0902dfafca1c -r af8e290682dd xen/include/asm-powerpc/shadow.h --- a/xen/include/asm-powerpc/shadow.h Mon Feb 26 15:29:42 2007 -0600 +++ b/xen/include/asm-powerpc/shadow.h Thu Mar 01 13:18:51 2007 -0600 @@ -13,9 +13,10 @@ * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (C) IBM Corp. 2005, 2006 + * Copyright IBM Corp. 2005, 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #ifndef _ASM_SHADOW_H_ @@ -58,4 +59,8 @@ static inline unsigned int shadow_get_al { return (1ULL (d-arch.htab.order + PAGE_SHIFT)) 20; } + +#define guest_physmap_max_mem_pages(d, n) (0) + #endif + diff -r 0902dfafca1c -r af8e290682dd xen/include/asm-x86/shadow.h --- a/xen/include/asm-x86/shadow.h Mon Feb 26 15:29:42 2007 -0600 +++ b/xen/include/asm-x86/shadow.h Thu Mar 01 13:18:51 2007 -0600 @@ -460,6 +460,8 @@ gl1e_to_ml1e(struct domain *d, l1_pgentr return l1e; } +#define guest_physmap_max_mem_pages(d, n) (0) + #endif /* _XEN_SHADOW_H */ /* ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 5 of 5] [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap()
1 files changed, 32 insertions(+), 5 deletions(-) tools/libxc/powerpc64/xc_linux_build.c | 37 +++- # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172776732 21600 # Node ID 178a3e6615fbf8dd556a4f8afa87e58bf7bbe575 # Parent 76a5923eaed2cc0f3ea2f9b1ac26c82fd8e7bc2b [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap() Now that ppc has implemented its guest_physmap_{add/remove}_page() domU builder needs to use populate_physmap() which will call out to the arch hooks. To use populate_physmap, we still allocate in the same 16MB chunks, but we have to pass down an array of pfns to tell the hypervisor how to map the newly allocated mfns. The extent_array is just such an array. It is initialized to the end of the RMA, and we adjust the pfn values in the array based on how many extents we've allocated. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 76a5923eaed2 -r 178a3e6615fb tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cThu Mar 01 13:18:52 2007 -0600 +++ b/tools/libxc/powerpc64/xc_linux_build.cThu Mar 01 13:18:52 2007 -0600 @@ -166,6 +166,7 @@ int xc_linux_build(int xc_handle, { struct domain_setup_info dsi; xen_pfn_t *page_array = NULL; +xen_pfn_t *ext_array = NULL; unsigned long nr_pages; unsigned long devtree_addr = 0; unsigned long kern_addr; @@ -182,6 +183,8 @@ int xc_linux_build(int xc_handle, int rma_log = 26; /* 64MB RMA */ int rc = 0; int op; +int i; +int j; struct ft_cxt devtree; DPRINTF(%s\n, __func__); @@ -219,11 +222,34 @@ int xc_linux_build(int xc_handle, (((1 extent_order) 10) * PAGE_SIZE) 10); /* now allocate the remaining memory as large-order allocations */ -DPRINTF(increase_reservation(%u, %llu, %u)\n, domid, nr_extents, extent_order); -if (xc_domain_memory_increase_reservation(xc_handle, domid, nr_extents, - extent_order, 0, NULL)) { -rc = -1; -goto out; +for ( i = 0; i nr_extents; i++ ) { +/* all extents are of the same size, alloc array once can re-use */ +if ( ext_array == NULL ) { +if ((ext_array = malloc((1extent_order)*sizeof(xen_pfn_t))) == NULL) { +PERROR(Couldn't allocate memory for extent allocation\n); +rc = 1; +goto out; +} +} + +/* initialize the extent array with pfn values. The + starting pfn is based on which extent past the RMA + we are using. + rma_pages is the starting pfn base + (i*(1extent_order)) will offset into the proper extent */ +for ( j = 0; j (1 extent_order); j++ ) +ext_array[j] = rma_pages + (i*(1 extent_order)) + j; + +DPRINTF(populate_physmap(DOM%u, order %u, starting_pfn %llx)\n, +domid, extent_order, ext_array[0]); + +if ( xc_domain_memory_populate_physmap(xc_handle, domid, 1, extent_order, + 0, ext_array) ) +{ +PERROR(Could not allocate extents\n); +rc = -1; +goto out; +} } if (get_rma_page_array(xc_handle, domid, page_array, rma_pages)) { @@ -297,5 +323,6 @@ out: out: free_devtree(devtree); free_page_array(page_array); +free_page_array(ext_array); return rc; } ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 3 of 5] [PATCH] xen: implement guest_physmap_max_mem_pages() for ppc
3 files changed, 69 insertions(+), 2 deletions(-) xen/arch/powerpc/domain.c| 62 ++ xen/include/asm-powerpc/domain.h |6 +++ xen/include/asm-powerpc/shadow.h |3 + # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172776732 21600 # Node ID 539e61f7482e832ffc372f0fa8d745202f86baa4 # Parent 0a9ecb03cb24b9035726dd316ca6af388983c05b [PATCH] xen: implement guest_physmap_max_mem_pages() for ppc Implement arch hook for setting domain max_mem_pages. This triggers the creation/extension of the domain's physical to machine (p2m) mapping array. This array is used to translate a guest physical address to the corresponding machine frame. Currently we only support growing the size of the p2m array. When the size of the array is increased, we copy over the existing mappings and initialize any new slots to INVALID_MFN. The size of the current p2m array is kept in d-arch.p2m_size. The p2m table can be larger than d-max_pages for dom0 as it needs to account for platform iohole. p2m table will always be at least d-max_pages. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 0a9ecb03cb24 -r 539e61f7482e xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Thu Mar 01 13:18:52 2007 -0600 +++ b/xen/arch/powerpc/domain.c Thu Mar 01 13:18:52 2007 -0600 @@ -16,6 +16,7 @@ * Copyright IBM Corp. 2005, 2006, 2007 * * Authors: Jimi Xenidis [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #include stdarg.h @@ -347,3 +348,64 @@ void idle_loop(void) do_softirq(); } } + +/* NB: caller holds d-page_alloc lock, sets d-max_pages = new_max */ +int do_guest_physmap_max_mem_pages(struct domain *d, unsigned long new_max) +{ +ulong *p2m_array = NULL; +ulong *p2m_old = NULL; +ulong p2m_old_sz; +ulong p2m_pages; +ulong copy_end = 0; +ulong i; + +/* we don't handle shrinking p2m array + * NB: d-max_pages = d-arch.p2m_size */ +if (new_max d-max_pages) { +printk(Can't shrink DOM%d max memory pages\n, d-domain_id); +return -EINVAL; +} + +/* our work is done here */ +if (new_max = d-arch.p2m_size) +return 0; + +/* the only case we handle is growing p2m table */ +ASSERT(new_max d-arch.p2m_size); + +/* make a p2m array of new_max mfns */ +p2m_pages = (new_max * sizeof(ulong)) PAGE_SHIFT; +/* NB: must use xenheap as caller holds page_alloc lock */ +p2m_array = alloc_xenheap_pages(get_order_from_pages(p2m_pages)); +if (p2m_array == NULL) +return -ENOMEM; + +/* copy old mappings into new array if any */ +if (d-arch.p2m != NULL) { +/* mark where the copy will stop (which page) */ +copy_end = d-arch.p2m_size; + +/* TODO: this could take a long time, we should do a hcall continuation + * that uses copy_page() */ +/* memcpy takes size in bytes */ +memcpy(p2m_array, d-arch.p2m, (d-arch.p2m_size * sizeof(ulong))); + +/* keep a pointer to the old array and size */ +p2m_old = d-arch.p2m; +p2m_old_sz = d-arch.p2m_size; +} + +/* mark remaining (or all) mfn as INVALID_MFN, memset takes size in bytes */ +for (i = copy_end; i (new_max - d-arch.p2m_size); i++) +p2m_array[i] = INVALID_MFN; + +/* set p2m pointer and size */ +d-arch.p2m = p2m_array; +d-arch.p2m_size = new_max; + +/* free old p2m array if present */ +if (p2m_old) +free_xenheap_pages(p2m_old, get_order_from_pages(d-arch.p2m_size)); + +return 0; +} diff -r 0a9ecb03cb24 -r 539e61f7482e xen/include/asm-powerpc/domain.h --- a/xen/include/asm-powerpc/domain.h Thu Mar 01 13:18:52 2007 -0600 +++ b/xen/include/asm-powerpc/domain.h Thu Mar 01 13:18:52 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (C) IBM Corp. 2005 + * Copyright IBM Corp. 2005, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] */ @@ -46,6 +46,10 @@ struct arch_domain { /* I/O-port access bitmap mask. */ u8 *iobmp_mask; /* Address of IO bitmap mask, or NULL. */ + +/* P2M mapping array and size */ +ulong *p2m; +ulong p2m_size; uint large_page_sizes; uint large_page_order[4]; diff -r 0a9ecb03cb24 -r 539e61f7482e xen/include/asm-powerpc/shadow.h --- a/xen/include/asm-powerpc/shadow.h Thu Mar 01 13:18:52 2007 -0600 +++ b/xen/include/asm-powerpc/shadow.h Thu Mar 01 13:18:52 2007 -0600 @@ -60,7 +60,8 @@ static inline unsigned int shadow_get_al return (1ULL (d-arch.htab.order + PAGE_SHIFT)) 20; } -#define guest_physmap_max_mem_pages(d, n) (0) +int do_guest_physmap_max_mem_pages(struct domain *d, unsigned long new_max); +#define guest_physmap_max_mem_pages(d, n) do_guest_physmap_max_mem_pages(d, n) #endif ___ Xen-ppc-devel mailing list Xen
[XenPPC] [PATCH 4 of 5] [PATCH] xen: implement guest_physmap_{add/remove}_page for ppc
14 files changed, 237 insertions(+), 145 deletions(-) xen/arch/powerpc/Makefile |1 xen/arch/powerpc/domain.c |3 xen/arch/powerpc/domain_build.c | 26 xen/arch/powerpc/domctl.c | 18 ++- xen/arch/powerpc/iommu.c|3 xen/arch/powerpc/memory.c |1 xen/arch/powerpc/mm.c | 192 ++- xen/arch/powerpc/ofd_fixup_memory.c | 33 -- xen/arch/powerpc/platform.c | 35 ++ xen/arch/powerpc/powerpc64/ppc970.c |8 - xen/common/memory.c |3 xen/include/asm-powerpc/domain.h|3 xen/include/asm-powerpc/mm.h| 29 + xen/include/asm-powerpc/platform.h | 27 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172776732 21600 # Node ID 76a5923eaed2cc0f3ea2f9b1ac26c82fd8e7bc2b # Parent 539e61f7482e832ffc372f0fa8d745202f86baa4 [PATCH] xen: implement guest_physmap_{add/remove}_page for ppc Introduce an machine to guest physical array (m2p) table. This array is the same size(# of elements) as the frame table, and maps mfns to a guest pfn. This m2p array us used in the mfn_to_gmfn() function. With the existence of both an m2p and p2m table, we implement the ppc version of guest_physmap_{add/remove}_page(). Modify construct_dom0 to initialize the p2m array. In doing so, we need to account for the platform iohole in dom0 by introducing platform_iohole_{base/size}() functions. If dom0_mem is larger than the start of the platform iohole, then we allocate platform_iohole_size() space in the p2m array and shift any memory above the platform_iohole_base() past the end of the iohole. This is reflected in the p2m_size and when we allocate dom0's memory, account for this shifting (this is done in allocate_extents()). To ensure proper dom0 memory alignment w.r.t extents, introduce a macro, EXTENT_UP(), which will round dom0's requested memory size up to the next cpu extent order and inform users we've done so. With the above in place, we eliminate the domain extent list, update dom0's device tree memory node construction accordingly, simplify pfn2mfn() and mfn_to_gmfn() by removing the extent list walking, killed extent list struct and extent functions. As a nice side-effect, we've increased mapping performance. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 539e61f7482e -r 76a5923eaed2 xen/arch/powerpc/Makefile --- a/xen/arch/powerpc/Makefile Thu Mar 01 13:18:52 2007 -0600 +++ b/xen/arch/powerpc/Makefile Thu Mar 01 13:18:52 2007 -0600 @@ -33,6 +33,7 @@ obj-y += ofd_fixup.o obj-y += ofd_fixup.o obj-y += ofd_fixup_memory.o obj-y += physdev.o +obj-y += platform.o obj-y += rtas.o obj-y += setup.o obj-y += shadow.o diff -r 539e61f7482e -r 76a5923eaed2 xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Thu Mar 01 13:18:52 2007 -0600 +++ b/xen/arch/powerpc/domain.c Thu Mar 01 13:18:52 2007 -0600 @@ -87,8 +87,6 @@ int arch_domain_create(struct domain *d) d-arch.large_page_sizes = cpu_large_page_orders( d-arch.large_page_order, ARRAY_SIZE(d-arch.large_page_order)); -INIT_LIST_HEAD(d-arch.extent_list); - d-arch.foreign_mfn_count = 1024; d-arch.foreign_mfns = xmalloc_array(uint, d-arch.foreign_mfn_count); BUG_ON(d-arch.foreign_mfns == NULL); @@ -310,7 +308,6 @@ void domain_relinquish_resources(struct { relinquish_memory(d, d-xenpage_list); relinquish_memory(d, d-page_list); -free_extents(d); xfree(d-arch.foreign_mfns); return; } diff -r 539e61f7482e -r 76a5923eaed2 xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Thu Mar 01 13:18:52 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Thu Mar 01 13:18:52 2007 -0600 @@ -16,6 +16,7 @@ * Copyright IBM Corp. 2005, 2007 * * Authors: Jimi Xenidis [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #include xen/config.h @@ -27,7 +28,9 @@ #include xen/shadow.h #include xen/domain.h #include xen/version.h +#include xen/shadow.h #include asm/processor.h +#include asm/platform.h #include asm/papr.h #include public/arch-powerpc.h #include public/libelf.h @@ -52,6 +55,9 @@ boolean_param(dom0_shadow, opt_dom0_sh /* adapted from common/elf.c */ #define RM_MASK(a,l) ((a) ((1UL (l)) - 1)) + +#define EXTENT_SIZE (1 cpu_extent_order()) +#define EXTENT_UP(x) x)+(EXTENT_SIZE-1))cpu_extent_order())*EXTENT_SIZE) int construct_dom0(struct domain *d, unsigned long image_start, unsigned long image_len, @@ -71,6 +77,7 @@ int construct_dom0(struct domain *d, ulong eomem; int preempt = 0; int vcpu; +ulong p2m_size; /* Sanity! */ BUG_ON(d-domain_id != 0); @@ -114,6 +121,25 @@ int construct_dom0(struct domain *d, printk(Forcing DOM0 memory size to %u MiB\n, ((rma_nrpages PAGE_SHIFT) 20)); } + +/* ensure dom0 is cpu_extent_order aligned, round up if + not and let user know we did
[XenPPC] [PATCH 2 of 5] [PATCH] xen: move dom0 memory allocation into construct_dom0()
2 files changed, 35 insertions(+), 28 deletions(-) xen/arch/powerpc/domain_build.c | 56 +++ xen/arch/powerpc/setup.c|7 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172776732 21600 # Node ID 0a9ecb03cb24b9035726dd316ca6af388983c05b # Parent af8e290682dd2c045fa181d5837ae2d3c97e856c [PATCH] xen: move dom0 memory allocation into construct_dom0() Signed-off-by: Ryan Harper [EMAIL PROTECTED] General clean-up to prepare for initializing dom0's p2m array o Move rma allocation into construct_dom0() o Move vcpu0 allocation into construct_dom0() o Allow dom0_mem to set d-max_pages o Be verbose when aligning dom0_mem with RMA check diff -r af8e290682dd -r 0a9ecb03cb24 xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Thu Mar 01 13:18:51 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Thu Mar 01 13:18:52 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (C) IBM Corp. 2005 + * Copyright IBM Corp. 2005, 2007 * * Authors: Jimi Xenidis [EMAIL PROTECTED] */ @@ -61,12 +61,12 @@ int construct_dom0(struct domain *d, struct elf_binary elf; struct elf_dom_parms parms; int rc; -struct vcpu *v = d-vcpu[0]; +struct vcpu *v; ulong dst; u64 *ofh_tree; -uint rma_nrpages = 1 d-arch.rma_order; -ulong rma_sz = rma_size(d-arch.rma_order); -ulong rma = page_to_maddr(d-arch.rma_page); +uint rma_nrpages = (1 cpu_default_rma_order_pages()); +ulong rma_sz; +ulong rma; start_info_t *si; ulong eomem; int preempt = 0; @@ -74,12 +74,9 @@ int construct_dom0(struct domain *d, /* Sanity! */ BUG_ON(d-domain_id != 0); -BUG_ON(d-vcpu[0] == NULL); if (image_len == 0) panic(No Dom0 image supplied\n); - -cpu_init_vcpu(v); printk(*** LOADING DOMAIN 0 ***\n); @@ -103,9 +100,6 @@ int construct_dom0(struct domain *d, parms.virt_kend = RM_MASK(parms.virt_kend, 42); parms.virt_entry = RM_MASK(parms.virt_entry, 42); -/* By default DOM0 is allocated all available memory. */ -d-max_pages = ~0U; - /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */ if (dom0_nrpages == 0) { dom0_nrpages = total_pages 4; @@ -114,7 +108,21 @@ int construct_dom0(struct domain *d, dom0_nrpages = CONFIG_MIN_DOM0_PAGES; } -/* make sure we are at least as big as the RMA */ +/* DOM0 has to be at least RMA size */ +if (dom0_nrpages rma_nrpages) { +dom0_nrpages = rma_nrpages; +printk(Forcing DOM0 memory size to %u MiB\n, +((rma_nrpages PAGE_SHIFT) 20)); +} + +d-max_pages = dom0_nrpages; +if (0 allocate_rma(d, cpu_default_rma_order_pages())) +panic(Error allocating domain 0 RMA\n); + +rma_sz = rma_size(d-arch.rma_order); +rma = page_to_maddr(d-arch.rma_page); + +/* if we are bigger than rma, allocate extents */ if (dom0_nrpages rma_nrpages) dom0_nrpages = allocate_extents(d, dom0_nrpages, rma_nrpages); @@ -152,15 +160,6 @@ int construct_dom0(struct domain *d, si-pt_base = 0; si-nr_pt_frames = 0; si-mfn_list = 0; - -/* OF usually sits here: - * - Linux needs it to be loaded before the vmlinux or initrd - * - AIX demands it to be @ 32M. - */ -dst = (32 20); - -/* put stack below everything */ -v-arch.ctxt.gprs[1] = dst - STACK_FRAME_OVERHEAD; /* startup secondary processors */ if ( opt_dom0_max_vcpus == 0 ) @@ -175,13 +174,26 @@ int construct_dom0(struct domain *d, #endif printk(Dom0 has maximum %u VCPUs\n, opt_dom0_max_vcpus); -for (vcpu = 1; vcpu opt_dom0_max_vcpus; vcpu++) { +for (vcpu = 0; vcpu opt_dom0_max_vcpus; vcpu++) { if (NULL == alloc_vcpu(dom0, vcpu, vcpu)) panic(Error creating domain 0 vcpu %d\n, vcpu); /* for now we pin Dom0 VCPUs to their coresponding CPUs */ if (cpu_isset(vcpu, cpu_online_map)) dom0-vcpu[vcpu]-cpu_affinity = cpumask_of_cpu(vcpu); } + +/* init VCPU0 */ +v = d-vcpu[0]; +cpu_init_vcpu(v); + +/* OF usually sits here: + * - Linux needs it to be loaded before the vmlinux or initrd + * - AIX demands it to be @ 32M. + */ +dst = (32 20); + +/* put stack below everything */ +v-arch.ctxt.gprs[1] = dst - STACK_FRAME_OVERHEAD; /* copy relative to Xen */ dst += rma; diff -r af8e290682dd -r 0a9ecb03cb24 xen/arch/powerpc/setup.c --- a/xen/arch/powerpc/setup.c Thu Mar 01 13:18:51 2007 -0600 +++ b/xen/arch/powerpc/setup.c Thu Mar 01 13:18:52 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (C) IBM Corp. 2005, 2006
[XenPPC] [PATCH 0 of 5] [PATCH] replace extent list with p2m/m2p mapping
Revised set of patches to addressing memory management [1] ugliness. Applies to xenppc-unstable.hg changeset: 14607:0902dfafca1c dom0 booted, multiple domUs created/used/destroyed Patches: add_arch_hook_for_max_mem.patch: - dummy call for x86/ia64/ppc clean_up_dom0_memory_alloc.patch: - Move rma allocation into construct_dom0() - Move vcpu0 allocation into construct_dom0() - Allow dom0_mem to set d-max_pages - Be verbose when aligning dom0_mem with RMA check add_powerpc_guest_physmap_max_mem.patch: - implement max_mem arch hook for ppc. - have dom0 create p2m table ppc_guest_physmap_add_remove_page.patch: - implement add/remove page hooks for ppc. - change allocate_extents not call add_extent() - for each page allocated, call physmap_add_page() to get p2m mapping - change pfn2mfn to use p2m table - change mfn_to_gmfn() to use p2m table - use d-tot_pages rather than extent list to create memory nodes in dom0 OF tree and avoid putting memory in I/O hole. - create machine_to_phys_table() for m2p mapping - wire up m2p accessors {get/set}_gpfn_from_mfn() - change guest_physmap_{add/remove}_page() to do m2p mapping - change mfn_to_gmfn() to use m2p mapping instead of extent calculation - add check for page ownership in mfn_to_gmfn() - add platform.c/platform.h to account for iohole - remove old struct page_extents and related functions - change cpu_io_mfn() to use platform code - removed PFN_TYPE_RMA, not needed - change pfnlist/getmemlist to use p2m map xc_linux_build_use_populate_physmap.patch: - change libxc/powerc64/xc_linux_build() to use populate_physmap hcall Note that a 1 line patch to linux is needed to allow populate_physmap to work. I'll send that seperately from this patchset. Signed-off-by: Ryan Harper [EMAIL PROTECTED] 1. http://lists.xensource.com/archives/html/xen-ppc-devel/2007-02/msg00047.html 20 files changed, 387 insertions(+), 181 deletions(-) tools/libxc/powerpc64/xc_linux_build.c | 37 +- xen/arch/powerpc/Makefile |1 xen/arch/powerpc/domain.c | 65 ++ xen/arch/powerpc/domain_build.c| 82 ++--- xen/arch/powerpc/domctl.c | 18 +-- xen/arch/powerpc/iommu.c |3 xen/arch/powerpc/memory.c |1 xen/arch/powerpc/mm.c | 192 xen/arch/powerpc/ofd_fixup_memory.c| 33 +++-- xen/arch/powerpc/platform.c| 35 + xen/arch/powerpc/powerpc64/ppc970.c|8 - xen/arch/powerpc/setup.c |7 - xen/common/domctl.c|4 xen/common/memory.c|3 xen/include/asm-ia64/shadow.h |2 xen/include/asm-powerpc/domain.h |9 - xen/include/asm-powerpc/mm.h | 29 +--- xen/include/asm-powerpc/platform.h | 27 xen/include/asm-powerpc/shadow.h | 10 + xen/include/asm-x86/shadow.h |2 ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 0 of 5] [PATCH] replace extent list with p2m/m2p mapping
* Ryan Harper [EMAIL PROTECTED] [2007-03-01 13:45]: Note that a 1 line patch to linux is needed to allow populate_physmap to work. I'll send that seperately from this patchset. Same as before. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: hcall.c |1 + 1 files changed, 1 insertion(+) --- [PATCH] linux: add populate_phsymap to memory hcalls for ppc. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 37ea4cf1281a arch/powerpc/platforms/xen/hcall.c --- a/arch/powerpc/platforms/xen/hcall.cTue Feb 06 17:10:20 2007 -0500 +++ b/arch/powerpc/platforms/xen/hcall.cFri Feb 16 17:27:17 2007 -0600 @@ -537,6 +537,7 @@ int HYPERVISOR_memory_op(unsigned int cm switch (cmd) { case XENMEM_increase_reservation: case XENMEM_decrease_reservation: + case XENMEM_populate_physmap: { void *desc = NULL; ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 2 of 6] [PATCH] xen: move dom0 memory allocation into construct_dom0()
* Jimi Xenidis [EMAIL PROTECTED] [2007-02-23 15:04]: On Feb 21, 2007, at 6:17 PM, Ryan Harper wrote: NOTE: Linux creates its own stack so there is we do not need the following: /* put stack below everything */ v-arch.ctxt.gprs[1] = dst - STACK_FRAME_OVERHEAD; Testing this out, we fail to boot dom0 if I don't include this. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] Re: xen heap size
* Hollis Blanchard [EMAIL PROTECTED] [2007-02-22 16:30]: On Thu, 2007-02-22 at 16:07 -0600, Ryan Harper wrote: IIRC, when dom0 boots with 192MB (the default) I usually see ~19MB of heap available in the boot messages on js20. Looking at js21, I see: (XEN) Xen Heap: 135MiB (138548KiB) RMA different size on js21? That's an unusual size: it's slightly more than the second 64MB RMA boundary, which seems to indicate there's a lot of wasted memory before dom0 at 192MB. I wonder if this is related to the 4GB of memory in this system. A more complete boot log might shed some light on it. Attached. To answer your question, the 970MP (in JS21) supports the same RMA sizes as 970 and 970FX (in JS20). OK. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] 0 boot net1 xen || root=/dev/sda3 Trying to load: xen || root=/dev/sda3 from: /ht/[EMAIL PROTECTED]/[EMAIL PROTECTED],1 ... Bootloader 1.5 Reading MAC address from device: 00:14:5E:9C:1C:C5 Requesting IP address via BOOTP: 9.3.189.7 Requesting file leaf4 via TFTP Receiving data: ##A##- TFTP: Received leaf4 (9428 KBytes) Successfully loaded --- OF: Xen/PPC version 3.0-unstable ([EMAIL PROTECTED]) (gcc version 4.1.0 (SUSE Linux)) Mon Feb 19 17:24:41 CST 2007 boot_of_init args: 0x0 0x0 0xe11027c 0xe291b0f 0x15 boot msr: 0x10003000 boot_of_init: _start 0040 _end 00c45c90 0xe291b0f bootargs = xen || root=/dev/sda3 boot_of_module: Dom0 is linked in: 0x479b4c[size 0x758860] mod0: 177 E L F boot_of_module: dom0 mod @ 0x00479b4c[0xbd23ac] boot_of_module: dom0 mod string: root=/dev/sda3 instantiating RTAS at: 0x4000 creating oftree at: 0xc000 pkg_save: saved device tree in 0x57b8 bytes boot_of_devtree: devtree mod @ 0xc000 - 0x0003c000 OF: timebase-frequency = 14318378 Hz OF: clock-frequency = 230 KHz spinning up secondary processor #1: ping = 0x: pong = 0x1 spinning up secondary processor #2: ping = 0x: pong = 0x2 spinning up secondary processor #3: ping = 0x: pong = 0x3 pruning `/ht/[EMAIL PROTECTED]/[EMAIL PROTECTED]' from devtree pruning `/ht/[EMAIL PROTECTED]/[EMAIL PROTECTED]' from devtree boot_of_serial: ISA base: 0xf400 boot_of_serial: ISRC=0x44, but forcing poll mode __ ___ ___ __ _ \ \/ /___ _ __ |___ / / _ \_ _ _ __ ___| |_ __ _| |__ | | ___ \ // _ \ '_ \|_ \| | | |__| | | | '_ \/ __| __/ _` | '_ \| |/ _ \ / \ __/ | | | ___) | |_| |__| |_| | | | \__ \ || (_| | |_) | | __/ /_/\_\___|_| |_| |(_)___/\__,_|_| |_|___/\__\__,_|_.__/|_|\___| http://www.cl.cam.ac.uk/netos/xen University of Cambridge Computer Laboratory Xen version 3.0-unstable ([EMAIL PROTECTED]) (gcc version 4.1.0 (SUSE Linux)) Mon Feb 19 17:24:41 CST 2007 Latest ChangeSet: Mon Feb 19 17:16:56 2007 -0600 13949:1c63549d7578 (XEN) Physical RAM map: (XEN) : 8000 (XEN) 0001: 8000 (XEN) End of Xen Area: 144MiB (147456KiB) (XEN) End of RAM: 6144MiB (6291456KiB) (XEN) boot allocator @ 3c000 - 6d000 (XEN) boot free: 0900 - 8000 (XEN) boot free: 0001 - 00018000 (XEN) total_pages: 0x000f7000 (XEN) NUMA turned off (XEN) Faking a node at -00018000 (XEN) Domain heap initialised: DMA width 64 bits (XEN) xenheap: 0006d000 - 0040 (XEN) xenheap: 00c46000 - 0900 (XEN) Xen Heap: 135MiB (138548KiB) (XEN) Dom Heap: 3880MiB (3973120KiB) (XEN) CPU[PIR:0 IPI:0 Logical:0] Hello World! (XEN) xen_mpic_init: start (XEN) mpic: Setting up MPIC Xen-U3-MPIC version 1.2 at f804, max 4 CPUs (XEN) mpic: ISU size: 124, shift: 7, mask: 7f (XEN) mpic: Initializing for 124 sources (XEN) mpic: Setting up HT PICs workarounds for U3/U4 (XEN) mpic: - HT:07.0 [0xf0] vendor 1022 device 7460 has 24 irqs (XEN) xen_mpic_init: success (XEN) requesting IPIs ... (XEN) IPIs requested... (XEN) Using scheduler: SMP Credit Scheduler (credit) (XEN) Initializing DART 0xf8033000: tbl: 0020[0x200] entries: 0x8 (XEN) Initializing DART Model U4: ctl: 0x8000 base: 0x200 size: 0x200 (XEN) spinning up at most 16 total processors ... (XEN) Synchronizing timebase (XEN) CPU[PIR:1 IPI:1 Logical:1] Hello World! (XEN) Got ack (XEN) score 299, offset 1000 (XEN) score 299, offset 500 (XEN) score 299, offset 250 (XEN) score 299, offset 125 (XEN) score 299, offset 62 (XEN) score 299, offset 31 (XEN) score 299, offset 15 (XEN) score 111, offset 7 (XEN) score -299, offset 3 (XEN) score -299, offset 5 (XEN) score -299, offset 6 (XEN) Min 6 (score -299), Max 7 (score 119) (XEN) Final offset: 7 (215/300) (XEN) Synchronizing timebase (XEN) CPU[PIR:2 IPI:2 Logical:2] Hello World! (XEN) Got ack (XEN) score 299, offset 1000 (XEN
Re: [XenPPC] Re: xen heap size
* Jimi Xenidis [EMAIL PROTECTED] [2007-02-22 19:30]: We don't consider the RMA boundary for the Xen heap at all anymore (not for a while) The Xen heap is calculated based on the estimated resources we'll need. on example is that we need to get enough HTABs for all the domain, so 1/64th of all of memory is part of the Xen heap size. Hrm. One of the items I need to address is determining how much of dom0's memory allocation runs into the 2-4G IO hole. One method I was hoping might work is: /* overlap in pages into 2G-4G IO range (if any) */ dom0_overlap = (cpu_default_rma_order_pages() + dom0_nrpages) - IO_SIZE_PAGES; It doesn't look like we can make the assumption that Xen+xenheap will only occupy the first RMA of the platform. The other method I was going to look into was to allocate dom0's rma, and then calculation would look like: dom0_start_mfn = page_to_mfn(d-arch.rma_base); dom0_overlap = (dom0_start_mfn + dom0_nrpages - rma_sz) - IO_SIZE_PAGES; Any other good way to figure how much of dom0's allocation will fall within 2-4G IO hole? -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 3 of 6] [PATCH] xen: implement guest_physmap_max_mem for ppc
* Christian Ehrhardt [EMAIL PROTECTED] [2007-02-22 07:40]: +int do_guest_physmap_max_mem(struct domain *d, unsigned long new_max) +{ +ulong *p2m_array = NULL; +ulong *p2m_old = NULL; +ulong p2m_pages; +ulong copy_end = 0; + +/* we don't handle shrinking max_pages */ +if ( new_max d-max_pages ) +{ +printk(Can't shrink %d max_mem\n, d-domain_id); Just some wording, but maybe printk(Can't shrink max_mem of domain %d\n, d-domain_id); would prevent some users from mis-interpreting the number as an unit of memory size. Yeah, definitely worth being more specific. +/* free old p2m array if present */ +if ( p2m_old ) +free_xenheap_pages(d-arch.p2m, get_order_from_pages(d-max_pages)); Maybe I just don't get it right because I'm new in this area, but if an old mapping exists you do here summarized: 1. save old d-arch.p2m in p2m_old 2. create a new p2m_array including the old mapping as copy 3. assigning the new array to d-arch.p2m 4. ?? if an old mapping was present you free the new one in d-arch.p2m ?? = this would leave one unreferenced heap allocation in memory (p2m_old) without a chance to free it after the local variable p2m_old disappears and the actively used table d-arch.p2m point to freed heap. I assume the freeing code should be +/* free old p2m array if present */ +if ( p2m_old ) +free_xenheap_pages(p2m_old, get_order_from_pages(d-max_pages)); Yep, good catch. Thanks. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 3 of 6] [PATCH] xen: implement guest_physmap_max_mem for ppc
* Hollis Blanchard [EMAIL PROTECTED] [2007-02-22 15:01]: On Wed, 2007-02-21 at 18:17 -0500, Ryan Harper wrote: 4 files changed, 72 insertions(+) xen/arch/powerpc/domain.c| 60 ++ xen/arch/powerpc/domain_build.c |5 +++ xen/include/asm-powerpc/domain.h |3 + xen/include/asm-powerpc/shadow.h |4 ++ # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 35fd77200dff7e73fe3959b5dbfa6088c691c502 # Parent 84ec1b4d5cd50cc9d49202eb978a4715c4780e28 [PATCH] xen: implement guest_physmap_max_mem for ppc Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 84ec1b4d5cd5 -r 35fd77200dff xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/domain.c Wed Feb 21 18:14:12 2007 -0600 @@ -33,6 +33,7 @@ #include asm/htab.h #include asm/current.h #include asm/hcalls.h +#include asm/shadow.h #include rtas.h #include exceptions.h @@ -347,3 +348,62 @@ void idle_loop(void) do_softirq(); } } + +int do_guest_physmap_max_mem(struct domain *d, unsigned long new_max) Could you rename new_max to new_max_pages so we can keep the units straight? (I know they use new_max in the XEN_DOMCTL_max_mem handler.) Yep. +{ +ulong *p2m_array = NULL; +ulong *p2m_old = NULL; +ulong p2m_pages; +ulong copy_end = 0; + +/* we don't handle shrinking max_pages */ +if ( new_max d-max_pages ) +{ +printk(Can't shrink %d max_mem\n, d-domain_id); +return -EINVAL; +} We won't be called in this case, so this test can be removed. OK. +/* our work is done here */ +if ( new_max == d-max_pages ) +return 0; + +/* check new_max pages is 16MiB aligned */ +if ( new_max ((112)-1) ) +{ +printk(Must be 16MiB aligned increments\n); +return -EACCES; +} The 16MB thing is because the 970's large page size is 16MB, and the kernel uses large pages to map its text. That said, I don't see why this should be enforced by Xen when setting max_mem (if ever). Stylistically, I also object to the literals used here. Great. I told myself that I was going to replace the literals since I was guessing that there might be a common check like cpu_aligned(). +/* make a p2m array of new_max mfns */ +p2m_pages = (new_max * sizeof(ulong)) PAGE_SHIFT; +/* XXX: could use domheap anonymously */ +p2m_array = alloc_xenheap_pages(get_order_from_pages(p2m_pages)); +if ( p2m_array == NULL ) +return -ENOMEM; I think the Xen heap is on the small side. Do you have an idea of how much memory we have available? I suppose we can change it later if we exhaust the heap. IIRC, when dom0 boots with 192MB (the default) I usually see ~19MB of heap available in the boot messages on js20. Looking at js21, I see: (XEN) Xen Heap: 135MiB (138548KiB) RMA different size on js21? We had talked about using ints for the p2m array, since that would only limit us to 44 bits of physical memory. Did you decide to use longs instead? No, just being lazy. I wanted to get the patches out for comment ASAP but I forgot to note that we were going to use u32 in the mails. I still plan to switch p2m array to smaller size. +/* copy old mappings into new array if any */ +if ( d-arch.p2m != NULL ) +{ +/* mark where the copy will stop (which page) */ +copy_end = d-max_pages; + +/* memcpy takes size in bytes */ +memcpy(p2m_array, d-arch.p2m, (d-max_pages * sizeof(ulong))); + +/* keep a pointer to the old array */ +p2m_old = d-arch.p2m; +} This memcpy could be pretty slow; might be better if we could make this a continuation some day. If you agree, could you add a comment to that effect? Good point. +/* mark remaining (or all) mfn as INVALID_MFN, memset takes size in bytes */ +memset(p2m_array+copy_end, (int)INVALID_MFN, + (((ulong)(new_max - d-max_pages)) * sizeof(ulong))); Here you're initializing the array of longs with an int. Since INVALID_MFN happens to be uniform (0x), it will work out, but I don't think it's ideal coding practice Right, I guess that should have been a for loop. The fact that I had to cast that should have been a hint. +/* set p2m pointer */ +d-arch.p2m = p2m_array; + +/* free old p2m array if present */ +if ( p2m_old ) +free_xenheap_pages(d-arch.p2m, get_order_from_pages(d-max_pages)); + +return 0; +} diff -r 84ec1b4d5cd5 -r 35fd77200dff xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 @@ -28,6 +28,7 @@ #include xen
Re: [XenPPC] [PATCH 4 of 6] [PATCH] xen: implement guest_physmap_{add/remove}_page for ppc
* Hollis Blanchard [EMAIL PROTECTED] [2007-02-22 16:20]: On Wed, 2007-02-21 at 18:17 -0500, Ryan Harper wrote: @@ -504,17 +508,15 @@ unsigned long mfn_to_gmfn(struct domain mfn (rma_mfn + (1 d-arch.rma_order))) return mfn - rma_mfn; -/* Extent? */ -cur_pfn = 1UL d-arch.rma_order; -list_for_each_entry (pe, d-arch.extent_list, pe_list) { -uint pe_pages = 1UL pe-order; -uint b_mfn = page_to_mfn(pe-pg); -uint e_mfn = b_mfn + pe_pages; - -if (mfn = b_mfn mfn e_mfn) { +/* check extents (cpu-defined contiguous chunks after RMA) */ +cur_pfn = 1UL d-arch.rma_order; /* start looking after RMA */ +for ( ; cur_pfn d-max_pages; cur_pfn += ext_nrpages ) +{ +uint b_mfn = d-arch.p2m[cur_pfn]; +uint e_mfn = b_mfn + ext_nrpages; + +if (mfn = b_mfn mfn e_mfn) return cur_pfn + (mfn - b_mfn); -} -cur_pfn += pe_pages; } return INVALID_M2P_ENTRY; } I think you're splitting these patches up a lot more than necessary (to the point I've having a hard time understanding them). Also, the above code is just removed by the next patch! If you combine 4 and 5 I think it will actually be smaller and easier to understand. OK I didn't realize these were just RFC. When you resubmit, could you put a little more description in each commit message? Yeah, I should have put RFC in the subject. I'll expand the descriptions in the patches as well. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 2 of 6] [PATCH] xen: move dom0 memory allocation into construct_dom0()
2 files changed, 17 insertions(+), 14 deletions(-) xen/arch/powerpc/domain_build.c | 24 xen/arch/powerpc/setup.c|7 +-- # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 84ec1b4d5cd50cc9d49202eb978a4715c4780e28 # Parent 17815286856eb2b67a64e64f2a0a53a7c5d505e2 [PATCH] xen: move dom0 memory allocation into construct_dom0() Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 17815286856e -r 84ec1b4d5cd5 xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 @@ -112,9 +112,9 @@ int construct_dom0(struct domain *d, struct domain_setup_info dsi; ulong dst; u64 *ofh_tree; -uint rma_nrpages = 1 d-arch.rma_order; -ulong rma_sz = rma_size(d-arch.rma_order); -ulong rma = page_to_maddr(d-arch.rma_page); +uint rma_nrpages; +ulong rma_sz; +ulong rma; start_info_t *si; ulong eomem; int am64 = 1; @@ -131,8 +131,6 @@ int construct_dom0(struct domain *d, if (image_len == 0) panic(No Dom0 image supplied\n); -cpu_init_vcpu(v); - memset(dsi, 0, sizeof(struct domain_setup_info)); dsi.image_addr = image_start; dsi.image_len = image_len; @@ -154,9 +152,6 @@ int construct_dom0(struct domain *d, printk(*** LOADING DOMAIN 0 ***\n); -/* By default DOM0 is allocated all available memory. */ -d-max_pages = ~0U; - /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */ if (dom0_nrpages == 0) { dom0_nrpages = total_pages 4; @@ -164,6 +159,19 @@ int construct_dom0(struct domain *d, if (dom0_nrpages CONFIG_MIN_DOM0_PAGES) dom0_nrpages = CONFIG_MIN_DOM0_PAGES; } + +/* By default DOM0 is allocated all available memory. */ +d-max_pages = dom0_nrpages; + +if (0 allocate_rma(d, cpu_default_rma_order_pages())) +panic(Error allocating domain 0 RMA\n); + +/* init vcpu now that RMA has been allocated */ +cpu_init_vcpu(v); + +rma_nrpages = 1 d-arch.rma_order; +rma_sz = rma_size(d-arch.rma_order); +rma = page_to_maddr(d-arch.rma_page); /* make sure we are at least as big as the RMA */ if (dom0_nrpages rma_nrpages) diff -r 17815286856e -r 84ec1b4d5cd5 xen/arch/powerpc/setup.c --- a/xen/arch/powerpc/setup.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/setup.c Wed Feb 21 18:14:12 2007 -0600 @@ -369,13 +369,8 @@ static void __init __start_xen(multiboot /* Create initial domain 0. */ dom0 = domain_create(0, 0); -if (dom0 == NULL) +if ( (dom0 == NULL) || (alloc_vcpu(dom0, 0, 0) == NULL) ) panic(Error creating domain 0\n); -dom0-max_pages = ~0U; -if (0 allocate_rma(dom0, cpu_default_rma_order_pages())) -panic(Error allocating domain 0 RMA\n); -if (NULL == alloc_vcpu(dom0, 0, 0)) -panic(Error creating domain 0 vcpu 0\n); /* The Interrupt Controller will route everything to CPU 0 so we * need to make sure Dom0's vVCPU 0 is pinned to the CPU */ ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 0 of 6] [PATCH] replace extent list with p2m/m2p mapping
First round of patches addressing memory management [1] ugliness. During implementation, determined we needed to have some sort of machine to physical mapping in addition to the p2m mapping as discussed. Patches: add_arch_hook_for_max_mem.patch: - dummy call for x86/ia64/ppc clean_up_dom0_memory_alloc.patch: - move dom0 memory allocation out of setup.c and into construct_dom0(). This makes allocating p2m for dom0 easier. - Set dom0-max_pages based on parsed value from dom0_mem cmdline rather than defaulting to ~0UL; no need for p2m table to be that big. add_powerpc_guest_physmap_max_mem.patch: - implement max_mem arch hook for ppc. - have dom0 create p2m table ppc_guest_physmap_add_remove_page.patch: - implement add/remove page hooks for ppc. - change allocate_extents not call add_extent() - for each page allocated, call physmap_add_page() to get p2m mapping - change pfn2mfn to use p2m table - change mfn_to_gmfn() to use p2m table - use d-tot_pages rather than extent list to create memory nodes in dom0 of tree add_m2p_table_for_ppc.patch: - create machine_to_phys_table() for m2p mapping - wire up m2p accessors {get/set}_gpfn_from_mfn() - change guest_physmap_{add/remove}_page() to do m2p mapping - change mfn_to_gmfn() to use m2p mapping instead of extent calculation - add check for page ownership in mfn_to_gmfn() xc_linux_build_use_populate_physmap.patch: - change libxc/powerc64/xc_linux_build() to use populate_physmap hcall Note that a 1 line patch to linux is needed to allow populate_physmap to work. I'll send that seperately from this patchset. Signed-off-by: Ryan Harper [EMAIL PROTECTED] 1. http://lists.xensource.com/archives/html/xen-ppc-devel/2007-02/msg00047.html 12 files changed, 243 insertions(+), 87 deletions(-) tools/libxc/powerpc64/xc_linux_build.c | 37 ++- xen/arch/powerpc/domain.c | 60 xen/arch/powerpc/domain_build.c| 33 -- xen/arch/powerpc/memory.c |1 xen/arch/powerpc/mm.c | 157 +--- xen/arch/powerpc/ofd_fixup_memory.c|8 - xen/arch/powerpc/setup.c |7 - xen/common/domctl.c|4 xen/include/asm-powerpc/domain.h |3 xen/include/asm-powerpc/mm.h | 14 +- xen/include/asm-powerpc/shadow.h |4 xen/include/xen/shadow.h |2 ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 6 of 6] [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap()
1 files changed, 32 insertions(+), 5 deletions(-) tools/libxc/powerpc64/xc_linux_build.c | 37 +++- # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 4a00d1da032210b39d80bdfff4d5f4b63c94d802 # Parent 82803360d949f547abfd7601177ecd836e492e36 [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap() Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 82803360d949 -r 4a00d1da0322 tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cWed Feb 21 18:14:12 2007 -0600 +++ b/tools/libxc/powerpc64/xc_linux_build.cWed Feb 21 18:14:12 2007 -0600 @@ -166,6 +166,7 @@ int xc_linux_build(int xc_handle, { struct domain_setup_info dsi; xen_pfn_t *page_array = NULL; +xen_pfn_t *ext_array = NULL; unsigned long nr_pages; unsigned long devtree_addr = 0; unsigned long kern_addr; @@ -182,6 +183,8 @@ int xc_linux_build(int xc_handle, int rma_log = 26; /* 64MB RMA */ int rc = 0; int op; +int i; +int j; struct ft_cxt devtree; DPRINTF(%s\n, __func__); @@ -219,11 +222,34 @@ int xc_linux_build(int xc_handle, (((1 extent_order) 10) * PAGE_SIZE) 10); /* now allocate the remaining memory as large-order allocations */ -DPRINTF(increase_reservation(%u, %llu, %u)\n, domid, nr_extents, extent_order); -if (xc_domain_memory_increase_reservation(xc_handle, domid, nr_extents, - extent_order, 0, NULL)) { -rc = -1; -goto out; +for ( i = 0; i nr_extents; i++ ) { +/* all extents are of the same size, alloc array once can re-use */ +if ( ext_array == NULL ) { +if ((ext_array = malloc((1extent_order)*sizeof(xen_pfn_t))) == NULL) { +PERROR(Couldn't allocate memory for extent allocation\n); +rc = 1; +goto out; +} +} + +/* initialize the extent array with pfn values. The + starting pfn is based on which extent past the RMA + we are using. + rma_pages is the starting pfn base + (i*(1extent_order)) will offset into the proper extent */ +for ( j = 0; j (1 extent_order); j++ ) +ext_array[j] = rma_pages + (i*(1 extent_order)) + j; + +DPRINTF(populate_physmap(DOM%u, order %u, starting_pfn %llx)\n, +domid, extent_order, ext_array[0]); + +if ( xc_domain_memory_populate_physmap(xc_handle, domid, 1, extent_order, + 0, ext_array) ) +{ +PERROR(Could not allocate extents\n); +rc = -1; +goto out; +} } if (get_rma_page_array(xc_handle, domid, page_array, rma_pages)) { @@ -297,5 +323,6 @@ out: out: free_devtree(devtree); free_page_array(page_array); +free_page_array(ext_array); return rc; } ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 4 of 6] [PATCH] xen: implement guest_physmap_{add/remove}_page for ppc
3 files changed, 73 insertions(+), 40 deletions(-) xen/arch/powerpc/domain_build.c |4 + xen/arch/powerpc/mm.c | 101 +++ xen/arch/powerpc/ofd_fixup_memory.c |8 -- # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 33f05ec503bfabccd119f06b30037b618f8d05b9 # Parent 35fd77200dff7e73fe3959b5dbfa6088c691c502 [PATCH] xen: implement guest_physmap_{add/remove}_page for ppc Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 35fd77200dff -r 33f05ec503bf xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 @@ -178,10 +178,12 @@ int construct_dom0(struct domain *d, rma_sz = rma_size(d-arch.rma_order); rma = page_to_maddr(d-arch.rma_page); -/* make sure we are at least as big as the RMA */ +/* if requested dom0 RAM amount is more than the RMA, then alloc + the rest in cpu-defined extent sized chunks */ if (dom0_nrpages rma_nrpages) dom0_nrpages = allocate_extents(d, dom0_nrpages, rma_nrpages); +/* make sure we are at least as big as the RMA */ ASSERT(d-tot_pages == dom0_nrpages); ASSERT(d-tot_pages = rma_nrpages); diff -r 35fd77200dff -r 33f05ec503bf xen/arch/powerpc/mm.c --- a/xen/arch/powerpc/mm.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/mm.c Wed Feb 21 18:14:12 2007 -0600 @@ -319,11 +319,15 @@ void free_extents(struct domain *d) } } +/* allocate rma_nrpages - nrpages more memory for domain in proper size */ uint allocate_extents(struct domain *d, uint nrpages, uint rma_nrpages) { uint ext_order; uint ext_nrpages; uint total_nrpages; +ulong mfn; +ulong gpfn = rma_nrpages; /* starting pfn at end of RMA */ +int i; struct page_info *pg; ext_order = cpu_extent_order(); @@ -338,10 +342,13 @@ uint allocate_extents(struct domain *d, if (pg == NULL) return total_nrpages; -if (add_extent(d, pg, ext_order) 0) { -free_domheap_pages(pg, ext_order); -return total_nrpages; -} +/* build p2m mapping for newly allocated extent */ +mfn = page_to_mfn(pg); +for ( i = 0; i (1 ext_order); i++ ) +guest_physmap_add_page(d, gpfn + i, mfn + i); + +/* bump starting pfn by extent size pages */ +gpfn += ext_nrpages; total_nrpages += ext_nrpages; } @@ -353,6 +360,7 @@ int allocate_rma(struct domain *d, unsig struct vcpu *v; ulong rma_base; ulong rma_sz; +ulong mfn = INVALID_MFN; int i; if (d-arch.rma_page) @@ -374,10 +382,15 @@ int allocate_rma(struct domain *d, unsig printk(allocated RMA for Dom[%d]: 0x%lx[0x%lx]\n, d-domain_id, rma_base, rma_sz); +mfn = page_to_mfn(d-arch.rma_page); + for (i = 0; i (1 d-arch.rma_order); i++ ) { /* Add in any extra CPUs that need flushing because of this page. */ d-arch.rma_page[i].count_info |= PGC_page_RMA; clear_page((void *)page_to_maddr(d-arch.rma_page[i])); + +/* setup p2m mapping for RMA */ +guest_physmap_add_page(d, i, mfn+i); } d-shared_info = (shared_info_t *) @@ -403,7 +416,6 @@ ulong pfn2mfn(struct domain *d, ulong pf { ulong rma_base_mfn = page_to_mfn(d-arch.rma_page); ulong rma_size_mfn = 1UL d-arch.rma_order; -struct page_extents *pe; ulong mfn = INVALID_MFN; int t = PFN_TYPE_NONE; ulong foreign_map_pfn = 1UL cpu_foreign_map_order(); @@ -424,18 +436,9 @@ ulong pfn2mfn(struct domain *d, ulong pf t = PFN_TYPE_RMA; mfn = pfn + rma_base_mfn; } else { -ulong cur_pfn = rma_size_mfn; - -list_for_each_entry (pe, d-arch.extent_list, pe_list) { -uint pe_pages = 1UL pe-order; -uint end_pfn = cur_pfn + pe_pages; - -if (pfn = cur_pfn pfn end_pfn) { -t = PFN_TYPE_LOGICAL; -mfn = page_to_mfn(pe-pg) + (pfn - cur_pfn); -break; -} -cur_pfn += pe_pages; +if ( pfn d-max_pages ) { +t = PFN_TYPE_LOGICAL; +mfn = d-arch.p2m[pfn]; } } #ifdef DEBUG @@ -483,12 +486,13 @@ ulong pfn2mfn(struct domain *d, ulong pf return mfn; } +/* mfn_to_pfn */ unsigned long mfn_to_gmfn(struct domain *d, unsigned long mfn) { -struct page_extents *pe; ulong cur_pfn; ulong gnttab_mfn; ulong rma_mfn; +uint ext_nrpages = (1 cpu_extent_order()); /* grant? */ gnttab_mfn = gnttab_shared_mfn(d, d-grant_table, 0); @@ -504,17 +508,15 @@ unsigned long mfn_to_gmfn(struct domain mfn (rma_mfn + (1 d-arch.rma_order))) return mfn - rma_mfn; -/* Extent? */ -cur_pfn = 1UL d-arch.rma_order
[XenPPC] [PATCH 5 of 6] [PATCH] xen: add machine_to_phys table for ppc
3 files changed, 43 insertions(+), 28 deletions(-) xen/arch/powerpc/memory.c|1 xen/arch/powerpc/mm.c| 56 ++ xen/include/asm-powerpc/mm.h | 14 +- # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 82803360d949f547abfd7601177ecd836e492e36 # Parent 33f05ec503bfabccd119f06b30037b618f8d05b9 [PATCH] xen: add machine_to_phys table for ppc Signed-off-by: Ryan Harper [EMAIL PROTECTED] ediff -r a9398ae1c634 xen/arch/powerpc/memory.c diff -r 33f05ec503bf -r 82803360d949 xen/arch/powerpc/memory.c --- a/xen/arch/powerpc/memory.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/memory.c Wed Feb 21 18:14:12 2007 -0600 @@ -176,6 +176,7 @@ void memory_init(module_t *mod, int mcou DBG(total_pages: 0x%016lx\n, total_pages); init_frametable(); +init_machine_to_phys_table(); numa_initmem_init(0, max_page); diff -r 33f05ec503bf -r 82803360d949 xen/arch/powerpc/mm.c --- a/xen/arch/powerpc/mm.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/mm.c Wed Feb 21 18:14:12 2007 -0600 @@ -43,6 +43,9 @@ unsigned long max_page; unsigned long max_page; unsigned long total_pages; +/* machine to phys mapping to used by all domains */ +unsigned long *machine_phys_mapping; + void __init init_frametable(void) { unsigned long p; @@ -58,6 +61,25 @@ void __init init_frametable(void) frame_table = (struct page_info *)(p PAGE_SHIFT); for (i = 0; i nr_pages; i += 1) clear_page((void *)((p + i) PAGE_SHIFT)); +} + +/* array of pfns, indexed by mfn */ +void __init init_machine_to_phys_table(void) +{ +unsigned long p; +unsigned long nr_pages; +int i; + +nr_pages = PFN_UP(max_page * sizeof(unsigned long)); + +p = alloc_boot_pages(nr_pages, 1); +if (p == 0) +panic(Not enough memory for machine phys mapping table\n); + +machine_phys_mapping = (unsigned long *)(p PAGE_SHIFT); +for (i = 0; i nr_pages; i += 1) +clear_page((void *)((p + i) PAGE_SHIFT)); + } void share_xen_page_with_guest( @@ -489,10 +511,12 @@ ulong pfn2mfn(struct domain *d, ulong pf /* mfn_to_pfn */ unsigned long mfn_to_gmfn(struct domain *d, unsigned long mfn) { -ulong cur_pfn; +struct page_info *pg = mfn_to_page(mfn); ulong gnttab_mfn; -ulong rma_mfn; -uint ext_nrpages = (1 cpu_extent_order()); + +/* is this our mfn? */ +if ( page_get_owner(pg) != d ) +return INVALID_M2P_ENTRY; /* grant? */ gnttab_mfn = gnttab_shared_mfn(d, d-grant_table, 0); @@ -503,22 +527,8 @@ unsigned long mfn_to_gmfn(struct domain if (d-is_privileged cpu_io_mfn(mfn)) return mfn; -rma_mfn = page_to_mfn(d-arch.rma_page); -if (mfn = rma_mfn -mfn (rma_mfn + (1 d-arch.rma_order))) -return mfn - rma_mfn; - -/* check extents (cpu-defined contiguous chunks after RMA) */ -cur_pfn = 1UL d-arch.rma_order; /* start looking after RMA */ -for ( ; cur_pfn d-max_pages; cur_pfn += ext_nrpages ) -{ -uint b_mfn = d-arch.p2m[cur_pfn]; -uint e_mfn = b_mfn + ext_nrpages; - -if (mfn = b_mfn mfn e_mfn) -return cur_pfn + (mfn - b_mfn); -} -return INVALID_M2P_ENTRY; +/* check m2p table */ +return get_gpfn_from_mfn(mfn); } void guest_physmap_add_page( @@ -543,8 +553,10 @@ void guest_physmap_add_page( printk(Ack! PFN aliased. pfn%lx, old mfn=%lx, new mfn=%lx\n, gpfn, d-arch.p2m[gpfn], mfn); -/* pfn and mfn ok, map it */ +/* pfn and mfn ok, map p2m */ d-arch.p2m[gpfn] = mfn; +/* map m2p */ +set_gpfn_from_mfn(mfn, gpfn); } void guest_physmap_remove_page( @@ -562,8 +574,10 @@ void guest_physmap_remove_page( return; } -/* pfn and mfn ok, unmap it */ +/* pfn and mfn ok, unmap p2m */ d-arch.p2m[gpfn] = INVALID_MFN; +/* unmap m2p */ +set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY); } void shadow_drop_references( diff -r 33f05ec503bf -r 82803360d949 xen/include/asm-powerpc/mm.h --- a/xen/include/asm-powerpc/mm.h Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/include/asm-powerpc/mm.h Wed Feb 21 18:14:12 2007 -0600 @@ -145,6 +145,7 @@ extern unsigned long max_page; extern unsigned long max_page; extern unsigned long total_pages; void init_frametable(void); +void init_machine_to_phys_table(void); void free_rma_check(struct page_info *page); static inline void put_page(struct page_info *page) @@ -226,14 +227,13 @@ typedef struct { } vm_assist_info_t; extern vm_assist_info_t vm_assist_info[]; - -/* hope that accesses to this will fail spectacularly */ -#undef machine_to_phys_mapping +extern unsigned long *machine_phys_mapping; +#define machine_to_phys_mapping (machine_phys_mapping) #define INVALID_M2P_ENTRY(~0UL) - -/* do nothing, its all calculated */ -#define set_gpfn_from_mfn(mfn, pfn) do { } while (0) -#define get_gpfn_from_mfn(mfn
[XenPPC] [PATCH 1 of 6] [PATCH] xen: add arch hook for max_mem hcall
2 files changed, 6 insertions(+) xen/common/domctl.c |4 xen/include/xen/shadow.h |2 ++ # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 17815286856eb2b67a64e64f2a0a53a7c5d505e2 # Parent 059beff4129bc0fc44032a95a8756c6ca89f6b21 [PATCH] xen: add arch hook for max_mem hcall Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 059beff4129b -r 17815286856e xen/common/domctl.c --- a/xen/common/domctl.c Thu Feb 08 07:05:26 2007 -0500 +++ b/xen/common/domctl.c Wed Feb 21 18:14:12 2007 -0600 @@ -19,6 +19,7 @@ #include xen/iocap.h #include xen/guest_access.h #include xen/bitmap.h +#include xen/shadow.h #ifdef CONFIG_COMPAT #include xen/compat.h #endif @@ -623,6 +624,9 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom spin_lock(d-page_alloc_lock); if ( new_max = d-tot_pages ) { +ret = guest_physmap_max_mem(d, new_max); +if ( ret != 0 ) +break; d-max_pages = new_max; ret = 0; } diff -r 059beff4129b -r 17815286856e xen/include/xen/shadow.h --- a/xen/include/xen/shadow.h Thu Feb 08 07:05:26 2007 -0500 +++ b/xen/include/xen/shadow.h Wed Feb 21 18:14:12 2007 -0600 @@ -3,6 +3,8 @@ #define __XEN_SHADOW_H__ #include xen/config.h + +#define guest_physmap_max_mem(d, n) (0) #ifdef CONFIG_SHADOW ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 3 of 6] [PATCH] xen: implement guest_physmap_max_mem for ppc
4 files changed, 72 insertions(+) xen/arch/powerpc/domain.c| 60 ++ xen/arch/powerpc/domain_build.c |5 +++ xen/include/asm-powerpc/domain.h |3 + xen/include/asm-powerpc/shadow.h |4 ++ # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1172103252 21600 # Node ID 35fd77200dff7e73fe3959b5dbfa6088c691c502 # Parent 84ec1b4d5cd50cc9d49202eb978a4715c4780e28 [PATCH] xen: implement guest_physmap_max_mem for ppc Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 84ec1b4d5cd5 -r 35fd77200dff xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/domain.c Wed Feb 21 18:14:12 2007 -0600 @@ -33,6 +33,7 @@ #include asm/htab.h #include asm/current.h #include asm/hcalls.h +#include asm/shadow.h #include rtas.h #include exceptions.h @@ -347,3 +348,62 @@ void idle_loop(void) do_softirq(); } } + +int do_guest_physmap_max_mem(struct domain *d, unsigned long new_max) +{ +ulong *p2m_array = NULL; +ulong *p2m_old = NULL; +ulong p2m_pages; +ulong copy_end = 0; + +/* we don't handle shrinking max_pages */ +if ( new_max d-max_pages ) +{ +printk(Can't shrink %d max_mem\n, d-domain_id); +return -EINVAL; +} + +/* our work is done here */ +if ( new_max == d-max_pages ) +return 0; + +/* check new_max pages is 16MiB aligned */ +if ( new_max ((112)-1) ) +{ +printk(Must be 16MiB aligned increments\n); +return -EACCES; +} + +/* make a p2m array of new_max mfns */ +p2m_pages = (new_max * sizeof(ulong)) PAGE_SHIFT; +/* XXX: could use domheap anonymously */ +p2m_array = alloc_xenheap_pages(get_order_from_pages(p2m_pages)); +if ( p2m_array == NULL ) +return -ENOMEM; + +/* copy old mappings into new array if any */ +if ( d-arch.p2m != NULL ) +{ +/* mark where the copy will stop (which page) */ +copy_end = d-max_pages; + +/* memcpy takes size in bytes */ +memcpy(p2m_array, d-arch.p2m, (d-max_pages * sizeof(ulong))); + +/* keep a pointer to the old array */ +p2m_old = d-arch.p2m; +} + +/* mark remaining (or all) mfn as INVALID_MFN, memset takes size in bytes */ +memset(p2m_array+copy_end, (int)INVALID_MFN, + (((ulong)(new_max - d-max_pages)) * sizeof(ulong))); + +/* set p2m pointer */ +d-arch.p2m = p2m_array; + +/* free old p2m array if present */ +if ( p2m_old ) +free_xenheap_pages(d-arch.p2m, get_order_from_pages(d-max_pages)); + +return 0; +} diff -r 84ec1b4d5cd5 -r 35fd77200dff xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Wed Feb 21 18:14:12 2007 -0600 @@ -28,6 +28,7 @@ #include xen/shadow.h #include xen/domain.h #include xen/version.h +#include xen/shadow.h #include asm/processor.h #include asm/papr.h #include public/arch-powerpc.h @@ -159,6 +160,10 @@ int construct_dom0(struct domain *d, if (dom0_nrpages CONFIG_MIN_DOM0_PAGES) dom0_nrpages = CONFIG_MIN_DOM0_PAGES; } + +/* set DOM0 max mem, triggering p2m table creation */ +if ( (guest_physmap_max_mem(d, dom0_nrpages)) != 0 ) +panic(Failed to set DOM0 max mem value\n); /* By default DOM0 is allocated all available memory. */ d-max_pages = dom0_nrpages; diff -r 84ec1b4d5cd5 -r 35fd77200dff xen/include/asm-powerpc/domain.h --- a/xen/include/asm-powerpc/domain.h Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/include/asm-powerpc/domain.h Wed Feb 21 18:14:12 2007 -0600 @@ -46,6 +46,9 @@ struct arch_domain { /* I/O-port access bitmap mask. */ u8 *iobmp_mask; /* Address of IO bitmap mask, or NULL. */ + +/* P2M mapping array */ +ulong *p2m; uint large_page_sizes; uint large_page_order[4]; diff -r 84ec1b4d5cd5 -r 35fd77200dff xen/include/asm-powerpc/shadow.h --- a/xen/include/asm-powerpc/shadow.h Wed Feb 21 18:14:12 2007 -0600 +++ b/xen/include/asm-powerpc/shadow.h Wed Feb 21 18:14:12 2007 -0600 @@ -37,6 +37,10 @@ extern void guest_physmap_remove_page( extern void guest_physmap_remove_page( struct domain *d, unsigned long gpfn, unsigned long mfn); +int do_guest_physmap_max_mem(struct domain *d, unsigned long new_max); +#undef guest_physmap_max_mem +#define guest_physmap_max_mem(d, n) do_guest_physmap_max_mem(d, n) + extern void shadow_drop_references( struct domain *d, struct page_info *page); ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH] linux: add populate_physmap to memory hcalls for ppc
* Ryan Harper [EMAIL PROTECTED] [2007-02-21 18:18]: xc_linux_build_use_populate_physmap.patch: - change libxc/powerc64/xc_linux_build() to use populate_physmap hcall Note that a 1 line patch to linux is needed to allow populate_physmap to work. I'll send that seperately from this patchset. Here is the linux patch. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: hcall.c |1 + 1 files changed, 1 insertion(+) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- [PATCH] linux: add populate_phsymap to memory hcalls for ppc. diff -r 37ea4cf1281a arch/powerpc/platforms/xen/hcall.c --- a/arch/powerpc/platforms/xen/hcall.cTue Feb 06 17:10:20 2007 -0500 +++ b/arch/powerpc/platforms/xen/hcall.cFri Feb 16 17:27:17 2007 -0600 @@ -537,6 +537,7 @@ int HYPERVISOR_memory_op(unsigned int cm switch (cmd) { case XENMEM_increase_reservation: case XENMEM_decrease_reservation: + case XENMEM_populate_physmap: { void *desc = NULL; ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] Can't boot latest xen without debug=y build parameter
I've filed the details [1]here. I've tried both xen+zImage and xen+vmlinux.strip. Same error. If I add debug=y to building Xen, then xen+vmlinux.strip works fine. 1. http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=902 -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 1/2] xen: remove start_info_t from dom0 building
* Jimi Xenidis [EMAIL PROTECTED] [2007-02-08 06:30]: Just 2 things. (1) I really do not want OFD code to compute anything so please pass in the shared page address for ofd_dom0_fixup() heh, unlike how it was calculating start-info ? =) (2) I'm pretty sure the all of the #define RMA_* can go now. There are a couple places, (mm.c for shared_info) and xc_linux_build() for domU which have to pick a page to use. Don't we want those choices marked in some common place? -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 2/2] linux: build start_info_t from devtree only
* Jimi Xenidis [EMAIL PROTECTED] [2007-02-08 06:48]: some comments On Feb 7, 2007, at 6:34 PM, Ryan Harper wrote: This patch cleans up xen_init_early() to construct a start_info_t only from the devtree as Patch1 fixes xen to no longer create a start_info_t for dom0. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: setup.c | 33 +++-- 1 files changed, 15 insertions(+), 18 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r a6adf094e08e arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.c Tue Feb 06 13:55:48 2007 -0600 +++ b/arch/powerpc/platforms/xen/setup.c Wed Feb 07 11:33:10 2007 -0600 @@ -88,29 +88,26 @@ static void __init xen_init_early(void) static void __init xen_init_early(void) { struct device_node *xen; -u64 *si; DBG( - %s\n, __func__); xen = of_find_node_by_path(/xen); -si = (u64 *)get_property(xen, start-info, NULL); - -/* build our own start_info_t if start-info property is not present */ -if (si != NULL) { -xen_start_info = (start_info_t *)__va(*si); -} else { -struct device_node *console; -struct device_node *store; - -console = of_find_node_by_path(/xen/console); -store = of_find_node_by_path(/xen/store); - -xen_start_info = xsi; - -/* fill out start_info_t from devtree */ -xen_start_info-shared_info = *((u64 *)get_property(xen, - shared-info, NULL)); +xen_start_info = xsi; Please make xsi static in its declaration earlier in the file. Sure. And while I wanted to access xsi vai xen_start_info, the xen_start_info = xsi seemed a bit awkward. Not sure if I should switch to xsi. Thoughts? + +/* fill out start_info_t from devtree */ +if ((char *)get_property(xen, privileged, NULL)) +xen_start_info-flags |= SIF_PRIVILEGED; +if ((char *)get_property(xen, initdomain, NULL)) +xen_start_info-flags |= SIF_INITDOMAIN; +xen_start_info-shared_info = *((u64 *)get_property(xen, + shared-info, NULL)); + +/* only look for store and console for guest domains */ Hmm, I think you need to look for them always. You _at_least_ need the console evtchn, which may not be zero and we create the node/prop anyway. Hrm, you may be right. I know that dom0 boots fine with this, but that maybe because it defaults those values to 0. I'll kill the if(). Feel free to panic() more: NOTE: this is early so a udbg_printf(); HYPERVISOR_shutdown (SHUTDOWN_poweroff); will do cuz panic() is no available yet. Yeah, good idea though none of the messages get out if our shared_info page isn't setup correctly, which I learned during my testing of this patch, was the value most likely to get hosed. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 1/2][2nd try] xen: remove start_info_t from dom0 building
Updated: - pass in shared_info guest physical to ofd_dom0_fixup() - only reserve shared info page in dom0 devtree - kill rma_addr() - kill RMA_* defines in public header - update xc_linux_build() to use last page of RMA as shared_info - update xc_linux_build() to choose a console/store page -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: tools/libxc/powerpc64/xc_linux_build.c |8 ++--- xen/arch/powerpc/domain_build.c| 47 ++--- xen/arch/powerpc/mm.c |4 +- xen/arch/powerpc/ofd_fixup.c | 27 +++--- xen/arch/powerpc/oftree.h |3 +- xen/include/asm-powerpc/domain.h |5 --- xen/include/public/arch-powerpc.h |8 - 7 files changed, 39 insertions(+), 63 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r 20e5f508accc tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cTue Feb 06 13:42:19 2007 -0600 +++ b/tools/libxc/powerpc64/xc_linux_build.cThu Feb 08 12:21:02 2007 -0600 @@ -33,7 +33,6 @@ #include xc_private.h #include xg_private.h #include xenctrl.h -#include xen/arch-powerpc.h #include flatdevtree_env.h #include flatdevtree.h @@ -256,10 +255,9 @@ int xc_linux_build(int xc_handle, } /* determine shared_info, console, and store paddr */ -shared_info_paddr = (rma_pages PAGE_SHIFT) - -(RMA_SHARED_INFO * PAGE_SIZE); -console_paddr = (rma_pages PAGE_SHIFT) - (RMA_CONSOLE * PAGE_SIZE); -store_paddr = (rma_pages PAGE_SHIFT) - (RMA_STORE * PAGE_SIZE); +shared_info_paddr = (rma_pages PAGE_SHIFT) - PAGE_SIZE; +console_paddr = shared_info_paddr - PAGE_SIZE; +store_paddr = console_paddr - PAGE_SIZE; /* map paddrs to mfns */ *store_mfn = page_array[(xen_pfn_t)(store_paddr PAGE_SHIFT)]; diff -r 20e5f508accc xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Tue Feb 06 13:42:19 2007 -0600 +++ b/xen/arch/powerpc/domain_build.c Thu Feb 08 12:21:02 2007 -0600 @@ -115,13 +115,15 @@ int construct_dom0(struct domain *d, uint rma_nrpages = 1 d-arch.rma_order; ulong rma_sz = rma_size(d-arch.rma_order); ulong rma = page_to_maddr(d-arch.rma_page); -start_info_t *si; ulong eomem; int am64 = 1; int preempt = 0; ulong msr; ulong pc; ulong r2; +ulong mod_start = 0; +ulong mod_len = 0; +ulong shared_info_addr; int vcpu; /* Sanity! */ @@ -185,24 +187,8 @@ int construct_dom0(struct domain *d, ASSERT( image_len rma_sz ); -si = (start_info_t *)(rma_addr(d-arch, RMA_START_INFO) + rma); -printk(xen_start_info: %p\n, si); - -sprintf(si-magic, xen-%i.%i-powerpc%d%s, -xen_major_version(), xen_minor_version(), BITS_PER_LONG, HV); -si-flags = SIF_PRIVILEGED | SIF_INITDOMAIN; - -si-shared_info = ((ulong)d-shared_info) - rma; -printk(shared_info: 0x%lx,%p\n, si-shared_info, d-shared_info); - -eomem = si-shared_info; - -/* number of pages accessible */ -si-nr_pages = rma_sz PAGE_SHIFT; - -si-pt_base = 0; -si-nr_pt_frames = 0; -si-mfn_list = 0; +eomem = ((ulong)d-shared_info) - rma; +printk(shared_info: 0x%lx,%p\n, eomem, d-shared_info); /* OF usually sits here: * - Linux needs it to be loaded before the vmlinux or initrd @@ -273,15 +259,13 @@ int construct_dom0(struct domain *d, printk(loading initrd: 0x%lx, 0x%lx\n, dst, initrd_len); memcpy((void *)dst, (void *)initrd_start, initrd_len); -si-mod_start = dst - rma; -si-mod_len = image_len; +mod_start = dst - rma; +mod_len = image_len; dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE); -} else { +} else printk(no initrd\n); -si-mod_start = 0; -si-mod_len = 0; -} + /* it may be a function descriptor */ fdesc = (ulong *)(dsi.v_kernstart + dsi.v_kernentry + kbase); @@ -309,12 +293,8 @@ int construct_dom0(struct domain *d, msr = 0; } -v-arch.ctxt.gprs[3] = si-mod_start; -v-arch.ctxt.gprs[4] = si-mod_len; - -memset(si-cmd_line, 0, sizeof(si-cmd_line)); -if ( cmdline != NULL ) -strncpy((char *)si-cmd_line, cmdline, sizeof(si-cmd_line)-1); +v-arch.ctxt.gprs[3] = mod_start; +v-arch.ctxt.gprs[4] = mod_len; v-arch.ctxt.msr = msr; v-arch.ctxt.pc = pc; @@ -322,7 +302,10 @@ int construct_dom0(struct domain *d, printk(DOM: pc = 0x%lx, r2 = 0x%lx\n, pc, r2); -ofd_dom0_fixup(d, *ofh_tree + rma, si); +/* convert xen pointer shared_info into guest physical */ +shared_info_addr = (ulong)d-shared_info - page_to_maddr(d-arch.rma_page); + +ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr); set_bit
[XenPPC] [PATCH 2/2][2nd try] linux: build start_info_t from devtree only
Updated: - made start_info_t xsi static -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: setup.c | 35 --- 1 files changed, 16 insertions(+), 19 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r a6adf094e08e arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.cTue Feb 06 13:55:48 2007 -0600 +++ b/arch/powerpc/platforms/xen/setup.cThu Feb 08 17:11:45 2007 -0600 @@ -32,7 +32,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info); EXPORT_SYMBOL(HYPERVISOR_shared_info); /* Raw start-of-day parameters from the hypervisor. */ -start_info_t xsi; +static start_info_t xsi; start_info_t *xen_start_info; extern struct machdep_calls mach_maple_md; @@ -88,29 +88,26 @@ static void __init xen_init_early(void) static void __init xen_init_early(void) { struct device_node *xen; - u64 *si; DBG( - %s\n, __func__); xen = of_find_node_by_path(/xen); - si = (u64 *)get_property(xen, start-info, NULL); - - /* build our own start_info_t if start-info property is not present */ - if (si != NULL) { - xen_start_info = (start_info_t *)__va(*si); - } else { - struct device_node *console; - struct device_node *store; - - console = of_find_node_by_path(/xen/console); - store = of_find_node_by_path(/xen/store); - - xen_start_info = xsi; - - /* fill out start_info_t from devtree */ - xen_start_info-shared_info = *((u64 *)get_property(xen, - shared-info, NULL)); + xen_start_info = xsi; + + /* fill out start_info_t from devtree */ + if ((char *)get_property(xen, privileged, NULL)) + xen_start_info-flags |= SIF_PRIVILEGED; + if ((char *)get_property(xen, initdomain, NULL)) + xen_start_info-flags |= SIF_INITDOMAIN; + xen_start_info-shared_info = *((u64 *)get_property(xen, + shared-info, NULL)); + + /* only look for store and console for guest domains */ + if (xen_start_info-flags == 0) { + struct device_node *console = of_find_node_by_path(/xen/console); + struct device_node *store = of_find_node_by_path(/xen/store); + xen_start_info-store_mfn = (*((u64 *)get_property(store, reg, NULL))) PAGE_SHIFT; xen_start_info-store_evtchn = *((u32 *)get_property(store, ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 2/2] linux: build start_info_t from devtree only
This patch cleans up xen_init_early() to construct a start_info_t only from the devtree as Patch1 fixes xen to no longer create a start_info_t for dom0. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: setup.c | 33 +++-- 1 files changed, 15 insertions(+), 18 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r a6adf094e08e arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.cTue Feb 06 13:55:48 2007 -0600 +++ b/arch/powerpc/platforms/xen/setup.cWed Feb 07 11:33:10 2007 -0600 @@ -88,29 +88,26 @@ static void __init xen_init_early(void) static void __init xen_init_early(void) { struct device_node *xen; - u64 *si; DBG( - %s\n, __func__); xen = of_find_node_by_path(/xen); - si = (u64 *)get_property(xen, start-info, NULL); - - /* build our own start_info_t if start-info property is not present */ - if (si != NULL) { - xen_start_info = (start_info_t *)__va(*si); - } else { - struct device_node *console; - struct device_node *store; - - console = of_find_node_by_path(/xen/console); - store = of_find_node_by_path(/xen/store); - - xen_start_info = xsi; - - /* fill out start_info_t from devtree */ - xen_start_info-shared_info = *((u64 *)get_property(xen, - shared-info, NULL)); + xen_start_info = xsi; + + /* fill out start_info_t from devtree */ + if ((char *)get_property(xen, privileged, NULL)) + xen_start_info-flags |= SIF_PRIVILEGED; + if ((char *)get_property(xen, initdomain, NULL)) + xen_start_info-flags |= SIF_INITDOMAIN; + xen_start_info-shared_info = *((u64 *)get_property(xen, + shared-info, NULL)); + + /* only look for store and console for guest domains */ + if (xen_start_info-flags == 0) { + struct device_node *console = of_find_node_by_path(/xen/console); + struct device_node *store = of_find_node_by_path(/xen/store); + xen_start_info-store_mfn = (*((u64 *)get_property(store, reg, NULL))) PAGE_SHIFT; xen_start_info-store_evtchn = *((u32 *)get_property(store, ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH] Fix bug where dtb database is not created
* Jerone Young [EMAIL PROTECTED] [2007-02-06 16:52]: This fixes a bug in the creating of the flat dev tree. If open is used and O_CREAT not is specified, it will fail if the file has not already been created. This patch will create the file if it does not exist already. Which will allow for DomU creation. Nice catch. Thanks Jerone. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] Slab corruption
I noticed the following output from the kernel running XenPPC on JS20, Slab corruption: start=c6d9f800, len=2048 680: a5 0c 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Prev obj: start=c6d9f000, len=2048 000: 30 30 2c 0a 30 78 30 30 30 30 30 30 30 30 2c 30 010: 78 30 30 30 30 30 30 30 30 2c 30 78 30 30 30 30 -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 2/4] create start_info_t in linux
Add information into flat devtree needed to create a start_info_t structure in linux. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: mk_flatdevtree.c | 89 +-- mk_flatdevtree.h |7 +++- xc_linux_build.c | 63 -- 3 files changed, 93 insertions(+), 66 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r 220e131bde0d tools/libxc/powerpc64/mk_flatdevtree.c --- a/tools/libxc/powerpc64/mk_flatdevtree.cMon Jan 29 20:49:18 2007 -0600 +++ b/tools/libxc/powerpc64/mk_flatdevtree.cMon Jan 29 20:54:54 2007 -0600 @@ -316,13 +316,17 @@ int make_devtree(struct ft_cxt *root, unsigned long shadow_mb, unsigned long initrd_base, unsigned long initrd_len, - const char *bootargs) + const char *bootargs, + uint64_t shared_info_maddr, + unsigned long console_evtchn, + uint64_t console_maddr, + unsigned long store_evtchn, + uint64_t store_maddr) { struct boot_param_header *bph = NULL; uint64_t val[2]; uint32_t val32[2]; unsigned long remaining; -unsigned long rma_reserve = 4 * PAGE_SIZE; unsigned long initrd_end = initrd_base + initrd_len; int64_t shadow_mb_log; uint64_t pft_size; @@ -351,10 +355,26 @@ int make_devtree(struct ft_cxt *root, /* you MUST set reservations BEFORE _starting_the_tree_ */ -/* reserve some pages at the end of RMA */ -val[0] = cpu_to_be64((u64) (rma_bytes - rma_reserve)); -val[1] = cpu_to_be64((u64) rma_reserve); -ft_add_rsvmap(root, val[0], val[1]); +/* reserve shared_info_t page */ +if (shared_info_maddr) { +val[0] = cpu_to_be64((u64) shared_info_maddr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_add_rsvmap(root, val[0], val[1]); +} + +/* reserve console page for domU */ +if (console_maddr) { +val[0] = cpu_to_be64((u64) console_maddr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_add_rsvmap(root, val[0], val[1]); +} + +/* reserve xen store page for domU */ +if (store_maddr) { +val[0] = cpu_to_be64((u64) store_maddr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_add_rsvmap(root, val[0], val[1]); +} /* reserve space for initrd if needed */ if ( initrd_len 0 ) { @@ -419,19 +439,19 @@ int make_devtree(struct ft_cxt *root, /* xen = root.addnode('xen') */ ft_begin_node(root, xen); -/* start-info is the first page in the RMA reserved area */ -val[0] = cpu_to_be64((u64) (rma_bytes - rma_reserve)); -val[1] = cpu_to_be64((u64) PAGE_SIZE); -ft_prop(root, start-info, val, sizeof(val)); - /* xen.addprop('version', 'Xen-3.0-unstable\0') */ -ft_prop_str(root, version, Xen-3.0-unstable); +ft_prop_str(root, compatible, Xen-3.0-unstable); /* xen.addprop('reg', long(imghandler.vm.domid), long(0)) */ val[0] = cpu_to_be64((u64) domid); val[1] = cpu_to_be64((u64) 0); ft_prop(root, reg, val, sizeof(val)); +/* point to shared_info_t page base addr */ +val[0] = cpu_to_be64((u64) shared_info_maddr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_prop(root, shared-info, val, sizeof(val)); + /* xen.addprop('domain-name', imghandler.vm.getName() + '\0') */ /* libxc doesn't know the domain name, that is purely a xend thing */ /* ft_prop_str(root, domain-name, domain_name); */ @@ -439,16 +459,41 @@ int make_devtree(struct ft_cxt *root, /* add xen/linux,phandle for chosen/interrupt-controller */ ft_prop_int(root, linux,phandle, xen_phandle); -/* xencons = xen.addnode('console') */ -ft_begin_node(root, console); - -/* xencons.addprop('interrupts', 1, 0) */ -val32[0] = cpu_to_be32((u32) 1); -val32[1] = cpu_to_be32((u32) 0); -ft_prop(root, interrupts, val32, sizeof(val32)); - -/* end of console */ -ft_end_node(root); +if (console_maddr != 0) { +/* xencons = xen.addnode('console') */ +ft_begin_node(root, console); + +/* console_maddr */ +val[0] = cpu_to_be64((u64) console_maddr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_prop(root, reg, val, sizeof(val)); + +/* xencons.addprop('interrupts', console_evtchn, 0) */ +val32[0] = cpu_to_be32((u32) console_evtchn); +val32[1] = cpu_to_be32((u32) 0); +ft_prop(root, interrupts, val32, sizeof(val32)); + +/* end of console */ +ft_end_node(root); +} + +if (store_maddr != 0) { +/* start store node */ +ft_begin_node(root, store); + +/* store maddr */ +val[0] = cpu_to_be64((u64) store_maddr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_prop(root
[XenPPC] [PATCH 1/4] move shared page definitions to public header
Move shared page location contract to public header to share with libxc. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: arch/powerpc/domain_build.c |1 + arch/powerpc/mm.c |1 + include/asm-powerpc/domain.h |7 --- include/public/arch-powerpc.h |8 4 files changed, 10 insertions(+), 7 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r 0980dfbae746 xen/include/asm-powerpc/domain.h --- a/xen/include/asm-powerpc/domain.h Thu Jan 25 15:55:25 2007 -0500 +++ b/xen/include/asm-powerpc/domain.h Mon Jan 29 17:57:52 2007 -0600 @@ -107,13 +107,6 @@ extern void save_float(struct vcpu *); extern void save_float(struct vcpu *); extern void load_float(struct vcpu *); -#define RMA_SHARED_INFO 1 -#define RMA_START_INFO 2 -#define RMA_LAST_DOM0 2 -/* these are not used for dom0 so they should be last */ -#define RMA_CONSOLE 3 -#define RMA_LAST_DOMU 3 - #define rma_size(rma_order) (1UL ((rma_order) + PAGE_SHIFT)) static inline ulong rma_addr(struct arch_domain *ad, int type) diff -r 0980dfbae746 xen/include/public/arch-powerpc.h --- a/xen/include/public/arch-powerpc.h Thu Jan 25 15:55:25 2007 -0500 +++ b/xen/include/public/arch-powerpc.h Mon Jan 29 17:57:52 2007 -0600 @@ -117,6 +117,14 @@ struct arch_vcpu_info { struct arch_vcpu_info { }; +#define RMA_SHARED_INFO 1 +#define RMA_START_INFO 2 +#define RMA_LAST_DOM0 2 +/* these are not used for dom0 so they should be last */ +#define RMA_CONSOLE 3 +#define RMA_STORE 4 +#define RMA_LAST_DOMU 4 + /* Support for multi-processor guests. */ #define MAX_VIRT_CPUS 32 #endif diff -r 0980dfbae746 xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Thu Jan 25 15:55:25 2007 -0500 +++ b/xen/arch/powerpc/domain_build.c Mon Jan 29 20:48:09 2007 -0600 @@ -30,6 +30,7 @@ #include xen/version.h #include asm/processor.h #include asm/papr.h +#include public/arch-powerpc.h #include oftree.h extern int parseelfimage_32(struct domain_setup_info *dsi); diff -r 0980dfbae746 xen/arch/powerpc/mm.c --- a/xen/arch/powerpc/mm.c Thu Jan 25 15:55:25 2007 -0500 +++ b/xen/arch/powerpc/mm.c Mon Jan 29 20:47:39 2007 -0600 @@ -28,6 +28,7 @@ #include asm/init.h #include asm/page.h #include asm/string.h +#include public/arch-powerpc.h #ifdef VERBOSE #define MEM_LOG(_f, _a...) \ ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 3/4] linux: create start_info_t from devtree
Create a start_info_t structure from devtree if start_info_t is not passed in. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: setup.c | 28 +++- 1 files changed, 27 insertions(+), 1 deletion(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r bbf2db4ddf54 arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.cTue Dec 19 09:22:37 2006 -0500 +++ b/arch/powerpc/platforms/xen/setup.cTue Jan 30 09:43:11 2007 -0600 @@ -32,6 +32,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info); EXPORT_SYMBOL(HYPERVISOR_shared_info); /* Raw start-of-day parameters from the hypervisor. */ +start_info_t xsi; start_info_t *xen_start_info; extern struct machdep_calls mach_maple_md; @@ -94,7 +95,32 @@ static void __init xen_init_early(void) xen = of_find_node_by_path(/xen); si = (u64 *)get_property(xen, start-info, NULL); - xen_start_info = (start_info_t *)__va(*si); + + /* build our own start_info_t if prop start-info not found */ + if (si != NULL ) { + xen_start_info = (start_info_t *)__va(*si); + } else { + struct device_node *console; + struct device_node *store; + + console = of_find_node_by_path(/xen/console); + store = of_find_node_by_path(/xen/store); + + xen_start_info = xsi; + + /* fill out start_info_t from devtree */ + xen_start_info-shared_info = *((u64 *)get_property(xen, + shared-info, NULL)); + xen_start_info-store_mfn = (*((u64 *)get_property(store, + reg, NULL))) PAGE_SHIFT; + xen_start_info-store_evtchn = *((u32 *)get_property(store, + interrupts, NULL)); + xen_start_info-console.domU.mfn = (*((u64 *)get_property(console, + reg, NULL))) PAGE_SHIFT; + xen_start_info-console.domU.evtchn = *((u32 *)get_property(console, + interrupts, NULL)); + } + HYPERVISOR_shared_info = __va(xen_start_info-shared_info); udbg_init_xen(); ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 3/3] sync xen/include/public/xen.h with unstable
* Jimi Xenidis [EMAIL PROTECTED] [2007-01-24 12:52]: since we don;t use the sparse tree, we'll need a linux patch with this change as well. I looks to me that linux-ppc-2.6.hg/include/xen/interface/xen.h is already in sync w.r.t start_info_t so no extra patch for linux needed. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 1/3] libxc: add start_info_t node to devtree
* Jimi Xenidis [EMAIL PROTECTED] [2007-01-24 12:42]: The data that was in start_info_t should be just simple bindings in / xen since they describe xen, there is no need to create a new node. many of the props are not needed since they are expressed elsewhere in the devtree or perhaps differently. more below. New rev: -dropped /xen/start_info_t, hanging new node /xen/store -fixed up /xen/console/reg to be proper u64 baseu64 size value -fixed up /xen/console/interrupts to use value passed from xend -renamed property 'shared_info' to 'shared-info' -fixed 'shared-info' to be a proper u64 baseu64 size value -reduced the number of pages reserved at the end of RMA from 4 to 3 as we no longer need to reserve a page for start_info_t -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: mk_flatdevtree.c | 45 +++-- mk_flatdevtree.h |6 ++- xc_linux_build.c | 83 ++- 3 files changed, 80 insertions(+), 54 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r ed5ee9dde0bd tools/libxc/powerpc64/mk_flatdevtree.c --- a/tools/libxc/powerpc64/mk_flatdevtree.cSun Jan 21 08:17:46 2007 -0500 +++ b/tools/libxc/powerpc64/mk_flatdevtree.cThu Jan 25 11:57:41 2007 -0600 @@ -316,13 +316,16 @@ int make_devtree(struct ft_cxt *root, unsigned long shadow_mb, unsigned long initrd_base, unsigned long initrd_len, - const char *bootargs) + const char *bootargs, + unsigned long console_evtchn, + unsigned long store_evtchn, + unsigned long nr_pages) { struct boot_param_header *bph = NULL; uint64_t val[2]; uint32_t val32[2]; unsigned long remaining; -unsigned long rma_reserve = 4 * PAGE_SIZE; +unsigned long rma_reserve = 3 * PAGE_SIZE; unsigned long initrd_end = initrd_base + initrd_len; int64_t shadow_mb_log; uint64_t pft_size; @@ -332,6 +335,9 @@ int make_devtree(struct ft_cxt *root, char *cpuname = NULL; int saved_errno; int dtb_fd = -1; +uint64_t shared_info_addr = (rma_bytes - PAGE_SIZE); +uint64_t store_mfn = (rma_bytes - (2*PAGE_SIZE)) PAGE_SHIFT; +uint64_t console_mfn = (rma_bytes - (3*PAGE_SIZE)) PAGE_SHIFT; uint32_t cpu0_phandle = get_phandle(); uint32_t xen_phandle = get_phandle(); uint32_t rma_phandle = get_phandle(); @@ -419,11 +425,6 @@ int make_devtree(struct ft_cxt *root, /* xen = root.addnode('xen') */ ft_begin_node(root, xen); -/* start-info is the first page in the RMA reserved area */ -val[0] = cpu_to_be64((u64) (rma_bytes - rma_reserve)); -val[1] = cpu_to_be64((u64) PAGE_SIZE); -ft_prop(root, start-info, val, sizeof(val)); - /* xen.addprop('version', 'Xen-3.0-unstable\0') */ ft_prop_str(root, version, Xen-3.0-unstable); @@ -432,6 +433,11 @@ int make_devtree(struct ft_cxt *root, val[1] = cpu_to_be64((u64) 0); ft_prop(root, reg, val, sizeof(val)); +/* point to shared_info_t page base addr */ +val[0] = cpu_to_be64((u64) shared_info_addr); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_prop(root, shared-info, val, sizeof(val)); + /* xen.addprop('domain-name', imghandler.vm.getName() + '\0') */ /* libxc doesn't know the domain name, that is purely a xend thing */ /* ft_prop_str(root, domain-name, domain_name); */ @@ -442,12 +448,33 @@ int make_devtree(struct ft_cxt *root, /* xencons = xen.addnode('console') */ ft_begin_node(root, console); -/* xencons.addprop('interrupts', 1, 0) */ -val32[0] = cpu_to_be32((u32) 1); +/* console_mfn */ +val[0] = cpu_to_be64((u64) console_mfn); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_prop(root, reg, val, sizeof(val)); + +/* xencons.addprop('interrupts', console_evtchn, 0) */ +val32[0] = cpu_to_be32((u32) console_evtchn); val32[1] = cpu_to_be32((u32) 0); ft_prop(root, interrupts, val32, sizeof(val32)); /* end of console */ +ft_end_node(root); + +/* start store node */ +ft_begin_node(root, store); + +/* store_mfn */ +val[0] = cpu_to_be64((u64) store_mfn); +val[1] = cpu_to_be64((u64) PAGE_SIZE); +ft_prop(root, reg, val, sizeof(val)); + +/* store event channel */ +val32[0] = cpu_to_be32((u32) store_evtchn); +val32[1] = cpu_to_be32((u32) 0); +ft_prop(root, interrupts, val32, sizeof(val32)); + +/* end of store */ ft_end_node(root); /* end of xen node */ diff -r ed5ee9dde0bd tools/libxc/powerpc64/mk_flatdevtree.h --- a/tools/libxc/powerpc64/mk_flatdevtree.hSun Jan 21 08:17:46 2007 -0500 +++ b/tools/libxc/powerpc64/mk_flatdevtree.hThu Jan 25 11:27:58 2007 -0600 @@ -32,8 +32,10 @@ extern int make_devtree(struct ft_cxt *r unsigned long
Re: [XenPPC] [PATCH 2/3] linux: build start_info_t from devtree
* Ryan Harper [EMAIL PROTECTED] [2007-01-24 11:51]: This patch adds support to linux:xen_init_early() to create a start_info_t structure from properties in /xen/start_info_t if the device tree does not have a pointer (/xen/start-info) to a previously constructed start_info_t in memory. Updated to create start_info_t from /xen/console and /xen/store devtree values if /xen/start-info isn't present. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: setup.c | 28 +++- 1 files changed, 27 insertions(+), 1 deletion(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r ab3b5849331d arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.cSun Jan 21 08:36:53 2007 -0500 +++ b/arch/powerpc/platforms/xen/setup.cThu Jan 25 10:59:53 2007 -0600 @@ -32,6 +32,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info); EXPORT_SYMBOL(HYPERVISOR_shared_info); /* Raw start-of-day parameters from the hypervisor. */ +start_info_t xsi; start_info_t *xen_start_info; extern struct machdep_calls mach_maple_md; @@ -94,7 +95,32 @@ static void __init xen_init_early(void) xen = of_find_node_by_path(/xen); si = (u64 *)get_property(xen, start-info, NULL); - xen_start_info = (start_info_t *)__va(*si); + + /* build our own start_info_t if prop start-info not found */ + if (si != NULL ) { + xen_start_info = (start_info_t *)__va(*si); + } else { + struct device_node *console; + struct device_node *store; + + console = of_find_node_by_path(/xen/console); + store = of_find_node_by_path(/xen/store); + + xen_start_info = xsi; + + /* fill out start_info_t from devtree */ + xen_start_info-shared_info = *((u64 *)get_property(xen, + shared-info, NULL)); + xen_start_info-store_mfn = *((u64 *)get_property(store, + reg, NULL)); + xen_start_info-store_evtchn = *((u32 *)get_property(store, + interrupts, NULL)); + xen_start_info-console.domU.mfn = *((u64 *)get_property(console, + reg, NULL)); + xen_start_info-console.domU.evtchn = *((u32 *)get_property(console, + interrupts, NULL)); + } + HYPERVISOR_shared_info = __va(xen_start_info-shared_info); udbg_init_xen(); ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 0/3] move start_info_t construction to linux
This patchset moves the creation of the start_info_t structure from libxc to linux. Removing the creation of start_info_t from libxc allows us to revert our changes to the start_info_t struct in xen/include/public/xen.h. This is achieved by adding a new node in the flat devtree, /xen/start_info_t under which all of the PPC relevant fields become properties. I've modified linux:xen_init_early() to work with either the previous start-info field present in the devtree that Xen constructs for dom0, or construct a start_info_t based on properties in the /xen/start_info_t if present (domUs). This is one of the steps to eventually removing then need for start_info_t entirely Signed-off-by: Ryan Harper [EMAIL PROTECTED] arch/powerpc/platforms/xen/setup.c | 27 +-- tools/libxc/powerpc64/mk_flatdevtree.c | 36 +-- tools/libxc/powerpc64/mk_flatdevtree.h |6 +- tools/libxc/powerpc64/xc_linux_build.c | 76 ++--- xen/include/public/xen.h | 14 +++--- 5 files changed, 97 insertions(+), 62 deletions(-) -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 1/3] libxc: add start_info_t node to devtree
This patch creates a new node, /xen/start_info_t in the flat devtree. It adds a property for each field of the start_info_t structure that xc_linux_build used to fill-out. I've also removed the helper functions which created/filled-out the start_info_t structure. This patch depends on Patch2 which modifies linux:xen_init_early(). -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: mk_flatdevtree.c | 36 +- mk_flatdevtree.h |6 ++-- xc_linux_build.c | 76 +++ 3 files changed, 67 insertions(+), 51 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r ed5ee9dde0bd tools/libxc/powerpc64/mk_flatdevtree.c --- a/tools/libxc/powerpc64/mk_flatdevtree.cSun Jan 21 08:17:46 2007 -0500 +++ b/tools/libxc/powerpc64/mk_flatdevtree.cTue Jan 23 09:50:43 2007 -0600 @@ -316,7 +316,10 @@ int make_devtree(struct ft_cxt *root, unsigned long shadow_mb, unsigned long initrd_base, unsigned long initrd_len, - const char *bootargs) + const char *bootargs, + unsigned long console_evtchn, + unsigned long store_evtchn, + unsigned long nr_pages) { struct boot_param_header *bph = NULL; uint64_t val[2]; @@ -419,11 +422,6 @@ int make_devtree(struct ft_cxt *root, /* xen = root.addnode('xen') */ ft_begin_node(root, xen); -/* start-info is the first page in the RMA reserved area */ -val[0] = cpu_to_be64((u64) (rma_bytes - rma_reserve)); -val[1] = cpu_to_be64((u64) PAGE_SIZE); -ft_prop(root, start-info, val, sizeof(val)); - /* xen.addprop('version', 'Xen-3.0-unstable\0') */ ft_prop_str(root, version, Xen-3.0-unstable); @@ -448,6 +446,32 @@ int make_devtree(struct ft_cxt *root, ft_prop(root, interrupts, val32, sizeof(val32)); /* end of console */ +ft_end_node(root); + +/* mark up start_info fields here */ +ft_begin_node(root, start_info_t); + +ft_prop_str(root, magic, xen-3.0-powerpc64HV); + +val[0] = cpu_to_be64((u64) nr_pages); +ft_prop(root, nr_pages, (val[0]), sizeof(val[0])); + +val[0] = cpu_to_be64((u64) (rma_bytes - PAGE_SIZE)); +ft_prop(root, shared_info, (val[0]), sizeof(val[0])); + +val[0] = cpu_to_be64((u64) ((rma_bytes PAGE_SHIFT) - 2)); +ft_prop(root, store_mfn, (val[0]), sizeof(val[0])); + +ft_prop_int(root, store_evtchn, store_evtchn); + +/* start_info-console.domU.mfn */ +val[0] = cpu_to_be64((u64) ((rma_bytes PAGE_SHIFT) - 3)); +ft_prop(root, console_domU_mfn, (val[0]), sizeof(val[0])); + +/* start_info-console.domU.evtchn */ +ft_prop_int(root, console_domU_evtchn, console_evtchn); + +/* end of start_info_t */ ft_end_node(root); /* end of xen node */ diff -r ed5ee9dde0bd tools/libxc/powerpc64/mk_flatdevtree.h --- a/tools/libxc/powerpc64/mk_flatdevtree.hSun Jan 21 08:17:46 2007 -0500 +++ b/tools/libxc/powerpc64/mk_flatdevtree.hMon Jan 22 15:38:46 2007 -0600 @@ -32,8 +32,10 @@ extern int make_devtree(struct ft_cxt *r unsigned long shadow_mb, unsigned long initrd_base, unsigned long initrd_len, -const char *bootargs); - +const char *bootargs, +unsigned long console_evtchn, +unsigned long store_evtchn, +unsigned long nr_pages); #define MAX_PATH 200 #define BUFSIZE 1024 #define BPH_SIZE 16*1024 diff -r ed5ee9dde0bd tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cSun Jan 21 08:17:46 2007 -0500 +++ b/tools/libxc/powerpc64/xc_linux_build.cTue Jan 23 10:14:55 2007 -0600 @@ -109,34 +109,6 @@ out: return rc; } -static unsigned long create_start_info( -start_info_t *start_info, -unsigned int console_evtchn, -unsigned int store_evtchn, -unsigned long nr_pages, -unsigned long rma_pages) -{ -unsigned long start_info_addr; -uint64_t rma_top; - -memset(start_info, 0, sizeof(*start_info)); -snprintf(start_info-magic, sizeof(start_info-magic), - xen-%d.%d-powerpc64HV, 3, 0); - -rma_top = rma_pages PAGE_SHIFT; -DPRINTF(RMA top = 0x%PRIX64\n, rma_top); - -start_info-nr_pages = nr_pages; -start_info-shared_info = rma_top - PAGE_SIZE; -start_info-store_mfn = (rma_top PAGE_SHIFT) - 2; -start_info-store_evtchn = store_evtchn; -start_info-console.domU.mfn = (rma_top PAGE_SHIFT) - 3; -start_info-console.domU.evtchn = console_evtchn; -start_info_addr = rma_top - 4*PAGE_SIZE; - -return start_info_addr; -} - static void free_page_array(xen_pfn_t *page_array) { free(page_array); @@ -191,7 +163,6 @@ int
[XenPPC] [PATCH 2/3] linux: build start_info_t from devtree
This patch adds support to linux:xen_init_early() to create a start_info_t structure from properties in /xen/start_info_t if the device tree does not have a pointer (/xen/start-info) to a previously constructed start_info_t in memory. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: setup.c | 27 +++ 1 files changed, 23 insertions(+), 4 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- diff -r ab3b5849331d arch/powerpc/platforms/xen/setup.c --- a/arch/powerpc/platforms/xen/setup.cSun Jan 21 08:36:53 2007 -0500 +++ b/arch/powerpc/platforms/xen/setup.cTue Jan 23 15:39:54 2007 -0600 @@ -32,6 +32,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info); EXPORT_SYMBOL(HYPERVISOR_shared_info); /* Raw start-of-day parameters from the hypervisor. */ +start_info_t xsi; start_info_t *xen_start_info; extern struct machdep_calls mach_maple_md; @@ -87,14 +88,32 @@ static void __init xen_init_early(void) static void __init xen_init_early(void) { struct device_node *xen; - u64 *si; + u64 *start_info; DBG( - %s\n, __func__); xen = of_find_node_by_path(/xen); - - si = (u64 *)get_property(xen, start-info, NULL); - xen_start_info = (start_info_t *)__va(*si); + start_info = (u64 *)get_property(xen, start-info, NULL); + + /* if we failed to get start-info property, then use start_info_t */ + if (start_info != NULL ) { + xen_start_info = (start_info_t *)__va(*start_info); + } else { + struct device_node *si; + si = of_find_node_by_path(/xen/start_info_t); + xen_start_info = xsi; + /* fill out start_info_t from devtree */ + strcpy(xen_start_info-magic, get_property(si, magic, NULL)); + xen_start_info-nr_pages = *((u64 *)get_property(si, nr_pages, NULL)); + xen_start_info-shared_info = *((u64 *)get_property(si, shared_info, NULL)); + xen_start_info-store_mfn = *((u64 *)get_property(si, store_mfn, NULL)); + xen_start_info-store_evtchn = *((u32 *)get_property(si, store_evtchn, NULL)); + xen_start_info-console.domU.mfn = *((u64 *)get_property(si, + console_domU_mfn, NULL)); + xen_start_info-console.domU.evtchn = *((u32 *)get_property(si, + console_domU_evtchn, NULL)); + } + HYPERVISOR_shared_info = __va(xen_start_info-shared_info); udbg_init_xen(); ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 0 of 4] [PATCH][UPDATED] move devtree creation to libxc, sync python with xen-unstable.hg
Rebased on changeset 14144:c16586000525 See previous [1]mail for patches 1 and 2. Added two new patches which remove xenppc deltas from xen-unstable.hg. move_memory_alloc_to_build.patch: - Dropped changes to XendDomainInfo.py - Moved domain memory allocation from XendDomainInfo.py into libxc sync_lowlevel_xc.patch - Dropped changes to xc.c, except for prose builder - Fixed prose_build to pass mem_mb to libxc - Updated prose_build help text to mention mem_mb as parameter 1. http://lists.xensource.com/archives/html/xen-ppc-devel/2007-01/msg00104.html 12 files changed, 850 insertions(+), 863 deletions(-) tools/python/xen/xend/FlatDeviceTree.py | 359 -- tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/mk_flatdevtree.c | 605 +++ tools/libxc/powerpc64/mk_flatdevtree.h | 42 ++ tools/libxc/powerpc64/utils.c | 25 - tools/libxc/powerpc64/utils.h |3 tools/libxc/powerpc64/xc_linux_build.c | 213 +- tools/libxc/powerpc64/xc_prose_build.c | 124 -- tools/libxc/xenguest.h | 21 - tools/python/xen/lowlevel/xc/xc.c | 187 +++-- tools/python/xen/xend/XendDomainInfo.py | 68 --- tools/python/xen/xend/image.py | 65 --- ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 2 of 4] [PATCH] Remove FlatDeviceTree.py, eliminate devtree from prose builder
7 files changed, 23 insertions(+), 571 deletions(-) tools/python/xen/xend/FlatDeviceTree.py | 359 --- tools/libxc/powerpc64/utils.c | 25 -- tools/libxc/powerpc64/utils.h |3 tools/libxc/powerpc64/xc_prose_build.c | 124 -- tools/libxc/xenguest.h | 17 - tools/python/xen/lowlevel/xc/xc.c | 12 - tools/python/xen/xend/image.py | 54 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1169241710 21600 # Node ID 9c743efd5129266689118213daa0d5032b529b20 # Parent 5a846b0c810cd24e5390a4dd2bdda8690d48c808 [PATCH] Remove FlatDeviceTree.py, eliminate devtree from prose builder. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 5a846b0c810c -r 9c743efd5129 tools/libxc/powerpc64/utils.c --- a/tools/libxc/powerpc64/utils.c Fri Jan 19 15:21:50 2007 -0600 +++ b/tools/libxc/powerpc64/utils.c Fri Jan 19 15:21:50 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jimi Xenidis [EMAIL PROTECTED] @@ -36,29 +36,6 @@ #include flatdevtree_env.h #include flatdevtree.h #include utils.h - -unsigned long get_rma_pages(void *devtree) -{ -void *rma; -uint64_t rma_reg[2]; -int rc; - -rma = ft_find_node(devtree, /[EMAIL PROTECTED]); -if (rma == NULL) { -DPRINTF(couldn't find /[EMAIL PROTECTED]); -return 0; -} -rc = ft_get_prop(devtree, rma, reg, rma_reg, sizeof(rma_reg)); -if (rc 0) { -DPRINTF(couldn't get /[EMAIL PROTECTED]/reg\n); -return 0; -} -if (rma_reg[0] != 0) { -DPRINTF(RMA did not start at 0\n); -return 0; -} -return rma_reg[1] PAGE_SHIFT; -} int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array, unsigned long nr_pages) diff -r 5a846b0c810c -r 9c743efd5129 tools/libxc/powerpc64/utils.h --- a/tools/libxc/powerpc64/utils.h Fri Jan 19 15:21:50 2007 -0600 +++ b/tools/libxc/powerpc64/utils.h Fri Jan 19 15:21:50 2007 -0600 @@ -13,13 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jimi Xenidis [EMAIL PROTECTED] */ -extern unsigned long get_rma_pages(void *devtree); extern int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array, unsigned long nr_pages); extern int install_image(int xc_handle, int domid, xen_pfn_t *page_array, diff -r 5a846b0c810c -r 9c743efd5129 tools/libxc/powerpc64/xc_prose_build.c --- a/tools/libxc/powerpc64/xc_prose_build.cFri Jan 19 15:21:50 2007 -0600 +++ b/tools/libxc/powerpc64/xc_prose_build.cFri Jan 19 15:21:50 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jonathan Appavoo [EMAIL PROTECTED] @@ -34,18 +34,14 @@ #include xg_private.h #include xenctrl.h -#include flatdevtree_env.h -#include flatdevtree.h #include utils.h #define INITRD_ADDR (24UL 20) -#define DEVTREE_ADDR (16UL 20) static int init_boot_vcpu( int xc_handle, int domid, struct domain_setup_info *dsi, -unsigned long devtree_addr, unsigned long kern_addr) { vcpu_guest_context_t ctxt; @@ -55,7 +51,7 @@ static int init_boot_vcpu( ctxt.user_regs.pc = dsi-v_kernentry; ctxt.user_regs.msr = 0; ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */ -ctxt.user_regs.gprs[3] = devtree_addr; +ctxt.user_regs.gprs[3] = 0; ctxt.user_regs.gprs[4] = kern_addr; ctxt.user_regs.gprs[5] = 0; /* reserved for specifying OF handler */ /* There is a buggy kernel that does not zero the local_paca, so @@ -79,85 +75,6 @@ static int init_boot_vcpu( return rc; } -static int load_devtree( -int xc_handle, -int domid, -xen_pfn_t *page_array, -void *devtree, -unsigned long devtree_addr, -uint64_t initrd_base, -unsigned long initrd_len, -start_info_t *start_info __attribute__((unused)), -unsigned long start_info_addr) -{ -uint32_t si[4] = {0, start_info_addr, 0, 0x1000}; -struct boot_param_header *header; -void *chosen; -void *xen; -uint64_t initrd_end = initrd_base + initrd_len; -unsigned int devtree_size; -int rc = 0; - -DPRINTF(adding initrd props\n); - -chosen = ft_find_node(devtree, /chosen
[XenPPC] [PATCH 4 of 4] [PATCH] Sync tools/python/xen/lowlevel/xc/xc.c with xen-unstable.hg
1 files changed, 57 insertions(+), 106 deletions(-) tools/python/xen/lowlevel/xc/xc.c | 163 - # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1169241710 21600 # Node ID 2d2cb7d7bd5daa7e4b5ccbc76b2c51163f30f647 # Parent 00c682cf4b4397a4ed25b7b21fefc429f4196d0d [PATCH] Sync tools/python/xen/lowlevel/xc/xc.c with xen-unstable.hg Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 00c682cf4b43 -r 2d2cb7d7bd5d tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 15:21:50 2007 -0600 +++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 15:21:50 2007 -0600 @@ -360,7 +360,6 @@ static PyObject *pyxc_linux_build(XcObje unsigned int mem_mb; unsigned long store_mfn = 0; unsigned long console_mfn = 0; -int unused; static char *kwd_list[] = { domid, store_evtchn, memsize, console_evtchn, image, @@ -368,12 +367,12 @@ static PyObject *pyxc_linux_build(XcObje ramdisk, cmdline, flags, features, NULL }; -if ( !PyArg_ParseTupleAndKeywords(args, kwds, s|ssis#, kwd_list, +if ( !PyArg_ParseTupleAndKeywords(args, kwds, s|ssis, kwd_list, dom, store_evtchn, mem_mb, console_evtchn, image, /* optional */ ramdisk, cmdline, flags, - features, unused) ) + features) ) return NULL; if ( xc_linux_build(self-xc_handle, dom, mem_mb, image, @@ -442,6 +441,47 @@ static PyObject *pyxc_hvm_build(XcObject return Py_BuildValue({s:i}, store_mfn, store_mfn); } +#ifdef __powerpc__ +static PyObject *pyxc_prose_build(XcObject *self, + PyObject *args, + PyObject *kwds) +{ +uint32_t dom; +char *image, *ramdisk = NULL, *cmdline = , *features = NULL; +int flags = 0; +int store_evtchn, console_evtchn; +unsigned int mem_mb; +unsigned long store_mfn = 0; +unsigned long console_mfn = 0; + +static char *kwd_list[] = { dom, store_evtchn, +console_evtchn, image, memsize, +/* optional */ +ramdisk, cmdline, flags, +features, NULL }; + +if ( !PyArg_ParseTupleAndKeywords(args, kwds, iiis|ssis, kwd_list, + dom, store_evtchn, + console_evtchn, image, mem_mb, + /* optional */ + ramdisk, cmdline, flags, + features) ) +return NULL; + +if ( xc_prose_build(self-xc_handle, dom, mem_mb, image, +ramdisk, cmdline, features, flags, +store_evtchn, store_mfn, +console_evtchn, console_mfn) != 0 ) { +if (!errno) + errno = EINVAL; +return pyxc_error_to_exception(); +} +return Py_BuildValue({s:i,s:i}, + store_mfn, store_mfn, + console_mfn, console_mfn); +} +#endif /* powerpc */ + static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self, PyObject *args, PyObject *kwds) @@ -915,68 +955,6 @@ static PyObject *dom_op(XcObject *self, Py_INCREF(zero); return zero; } - -#ifdef __powerpc__ -static PyObject *pyxc_alloc_real_mode_area(XcObject *self, - PyObject *args, - PyObject *kwds) -{ -uint32_t dom; -unsigned int log; - -static char *kwd_list[] = { dom, log, NULL }; - -if ( !PyArg_ParseTupleAndKeywords(args, kwds, ii, kwd_list, - dom, log) ) -return NULL; - -if ( xc_alloc_real_mode_area(self-xc_handle, dom, log) ) -return pyxc_error_to_exception(); - -Py_INCREF(zero); -return zero; -} - -static PyObject *pyxc_prose_build(XcObject *self, - PyObject *args, - PyObject *kwds) -{ -uint32_t dom; -char *image, *ramdisk = NULL, *cmdline = , *features = NULL; -int flags = 0; -int store_evtchn, console_evtchn; -unsigned int mem_mb; -unsigned long store_mfn = 0; -unsigned long console_mfn = 0; -int unused; - -static char *kwd_list[] = { dom, store_evtchn, -console_evtchn, image, memsize, -/* optional */ -ramdisk, cmdline, flags, -features, NULL
[XenPPC] [PATCH 1 of 4] [PATCH] Move flat device tree construction from python to libxc for xc_linux_build()
7 files changed, 699 insertions(+), 113 deletions(-) tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/mk_flatdevtree.c | 605 tools/libxc/powerpc64/mk_flatdevtree.h | 42 ++ tools/libxc/powerpc64/xc_linux_build.c | 143 ++- tools/libxc/xenguest.h |4 tools/python/xen/lowlevel/xc/xc.c | 12 tools/python/xen/xend/image.py |5 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1169241710 21600 # Node ID 5a846b0c810cd24e5390a4dd2bdda8690d48c808 # Parent c16586000525f9d9dfbbe336d9d458dd08b44a0e [PATCH] Move flat device tree construction from python to libxc for xc_linux_build(). Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r c16586000525 -r 5a846b0c810c tools/libxc/powerpc64/Makefile --- a/tools/libxc/powerpc64/MakefileWed Jan 17 19:37:20 2007 -0500 +++ b/tools/libxc/powerpc64/MakefileFri Jan 19 15:21:50 2007 -0600 @@ -1,4 +1,5 @@ GUEST_SRCS-y += powerpc64/flatdevtree.c GUEST_SRCS-y += powerpc64/flatdevtree.c +GUEST_SRCS-y += powerpc64/mk_flatdevtree.c GUEST_SRCS-y += powerpc64/xc_linux_build.c GUEST_SRCS-y += powerpc64/xc_prose_build.c GUEST_SRCS-y += powerpc64/utils.c diff -r c16586000525 -r 5a846b0c810c tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cWed Jan 17 19:37:20 2007 -0500 +++ b/tools/libxc/powerpc64/xc_linux_build.cFri Jan 19 15:21:50 2007 -0600 @@ -13,9 +13,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #include stdio.h @@ -36,6 +37,7 @@ #include flatdevtree_env.h #include flatdevtree.h #include utils.h +#include mk_flatdevtree.h #define INITRD_ADDR (24UL 20) #define DEVTREE_ADDR (16UL 20) @@ -78,85 +80,6 @@ static int init_boot_vcpu( return rc; } -static int load_devtree( -int xc_handle, -int domid, -xen_pfn_t *page_array, -void *devtree, -unsigned long devtree_addr, -uint64_t initrd_base, -unsigned long initrd_len, -start_info_t *start_info __attribute__((unused)), -unsigned long start_info_addr) -{ -uint32_t si[4] = {0, start_info_addr, 0, 0x1000}; -struct boot_param_header *header; -void *chosen; -void *xen; -uint64_t initrd_end = initrd_base + initrd_len; -unsigned int devtree_size; -int rc = 0; - -DPRINTF(adding initrd props\n); - -chosen = ft_find_node(devtree, /chosen); -if (chosen == NULL) { -DPRINTF(couldn't find /chosen\n); -return -1; -} - -xen = ft_find_node(devtree, /xen); -if (xen == NULL) { -DPRINTF(couldn't find /xen\n); -return -1; -} - -/* initrd-start */ -rc = ft_set_prop(devtree, chosen, linux,initrd-start, -initrd_base, sizeof(initrd_base)); -if (rc 0) { -DPRINTF(couldn't set /chosen/linux,initrd-start\n); -return rc; -} - -/* initrd-end */ -rc = ft_set_prop(devtree, chosen, linux,initrd-end, -initrd_end, sizeof(initrd_end)); -if (rc 0) { -DPRINTF(couldn't set /chosen/linux,initrd-end\n); -return rc; -} - -rc = ft_set_rsvmap(devtree, 1, initrd_base, initrd_len); -if (rc 0) { -DPRINTF(couldn't set initrd reservation\n); -return ~0UL; -} - -/* start-info (XXX being removed soon) */ -rc = ft_set_prop(devtree, xen, start-info, si, sizeof(si)); -if (rc 0) { -DPRINTF(couldn't set /xen/start-info\n); -return rc; -} - -header = devtree; -devtree_size = header-totalsize; -{ -static const char dtb[] = /tmp/xc_domU.dtb; -int dfd = creat(dtb, 0666); -if (dfd != -1) { -write(dfd, devtree, devtree_size); -close(dfd); -} else -DPRINTF(could not open(\%s\)\n, dtb); -} - -DPRINTF(copying device tree to 0x%lx[0x%x]\n, DEVTREE_ADDR, devtree_size); -return install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR, - devtree_size); -} - static int load_initrd( int xc_handle, int domid, @@ -187,13 +110,14 @@ out: } static unsigned long create_start_info( -void *devtree, start_info_t *start_info, -unsigned int console_evtchn, unsigned int store_evtchn, -unsigned long nr_pages, unsigned long rma_pages) +start_info_t *start_info, +unsigned int console_evtchn, +unsigned int store_evtchn, +unsigned long nr_pages, +unsigned long rma_pages) { unsigned long start_info_addr; uint64_t rma_top; -int rc; memset(start_info, 0, sizeof(*start_info)); snprintf(start_info-magic, sizeof(start_info-magic), @@ -209,13 +133,6 @@ static unsigned long
[XenPPC] [PATCH 0 of 4] [PATCH][UPDATED] move devtree creation to libxc, sync python with xen-unstable.hg
Hollis pointed out some changes to several of the patches so I fixed those issues up: - dump void *devtree, rename struct ft_ctx root to devtree - kill if(devtree) in xc_linux_build, we always use devtree - make PPC_ProseImageHandler derive from LinuxImageHandler instead of ImageHandler, this cleans up patch3's image.py sync Signed-of-by: Ryan Harper [EMAIL PROTECTED] 12 files changed, 847 insertions(+), 864 deletions(-) tools/python/xen/xend/FlatDeviceTree.py | 359 -- tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/mk_flatdevtree.c | 605 +++ tools/libxc/powerpc64/mk_flatdevtree.h | 42 ++ tools/libxc/powerpc64/utils.c | 25 - tools/libxc/powerpc64/utils.h |3 tools/libxc/powerpc64/xc_linux_build.c | 217 +-- tools/libxc/powerpc64/xc_prose_build.c | 124 -- tools/libxc/xenguest.h | 21 - tools/python/xen/lowlevel/xc/xc.c | 187 +++-- tools/python/xen/xend/XendDomainInfo.py | 68 --- tools/python/xen/xend/image.py | 59 --- ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 1 of 4] [PATCH] Move flat device tree construction from python to libxc for xc_linux_build()
7 files changed, 697 insertions(+), 119 deletions(-) tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/mk_flatdevtree.c | 605 tools/libxc/powerpc64/mk_flatdevtree.h | 42 ++ tools/libxc/powerpc64/xc_linux_build.c | 147 ++- tools/libxc/xenguest.h |4 tools/python/xen/lowlevel/xc/xc.c | 12 tools/python/xen/xend/image.py |5 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1169248739 21600 # Node ID e3b9f4ea49c014d8578415082ad09f76dbfb98b6 # Parent c16586000525f9d9dfbbe336d9d458dd08b44a0e [PATCH] Move flat device tree construction from python to libxc for xc_linux_build(). Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r c16586000525 -r e3b9f4ea49c0 tools/libxc/powerpc64/Makefile --- a/tools/libxc/powerpc64/MakefileWed Jan 17 19:37:20 2007 -0500 +++ b/tools/libxc/powerpc64/MakefileFri Jan 19 17:18:59 2007 -0600 @@ -1,4 +1,5 @@ GUEST_SRCS-y += powerpc64/flatdevtree.c GUEST_SRCS-y += powerpc64/flatdevtree.c +GUEST_SRCS-y += powerpc64/mk_flatdevtree.c GUEST_SRCS-y += powerpc64/xc_linux_build.c GUEST_SRCS-y += powerpc64/xc_prose_build.c GUEST_SRCS-y += powerpc64/utils.c diff -r c16586000525 -r e3b9f4ea49c0 tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cWed Jan 17 19:37:20 2007 -0500 +++ b/tools/libxc/powerpc64/xc_linux_build.cFri Jan 19 17:18:59 2007 -0600 @@ -13,9 +13,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #include stdio.h @@ -36,6 +37,7 @@ #include flatdevtree_env.h #include flatdevtree.h #include utils.h +#include mk_flatdevtree.h #define INITRD_ADDR (24UL 20) #define DEVTREE_ADDR (16UL 20) @@ -78,85 +80,6 @@ static int init_boot_vcpu( return rc; } -static int load_devtree( -int xc_handle, -int domid, -xen_pfn_t *page_array, -void *devtree, -unsigned long devtree_addr, -uint64_t initrd_base, -unsigned long initrd_len, -start_info_t *start_info __attribute__((unused)), -unsigned long start_info_addr) -{ -uint32_t si[4] = {0, start_info_addr, 0, 0x1000}; -struct boot_param_header *header; -void *chosen; -void *xen; -uint64_t initrd_end = initrd_base + initrd_len; -unsigned int devtree_size; -int rc = 0; - -DPRINTF(adding initrd props\n); - -chosen = ft_find_node(devtree, /chosen); -if (chosen == NULL) { -DPRINTF(couldn't find /chosen\n); -return -1; -} - -xen = ft_find_node(devtree, /xen); -if (xen == NULL) { -DPRINTF(couldn't find /xen\n); -return -1; -} - -/* initrd-start */ -rc = ft_set_prop(devtree, chosen, linux,initrd-start, -initrd_base, sizeof(initrd_base)); -if (rc 0) { -DPRINTF(couldn't set /chosen/linux,initrd-start\n); -return rc; -} - -/* initrd-end */ -rc = ft_set_prop(devtree, chosen, linux,initrd-end, -initrd_end, sizeof(initrd_end)); -if (rc 0) { -DPRINTF(couldn't set /chosen/linux,initrd-end\n); -return rc; -} - -rc = ft_set_rsvmap(devtree, 1, initrd_base, initrd_len); -if (rc 0) { -DPRINTF(couldn't set initrd reservation\n); -return ~0UL; -} - -/* start-info (XXX being removed soon) */ -rc = ft_set_prop(devtree, xen, start-info, si, sizeof(si)); -if (rc 0) { -DPRINTF(couldn't set /xen/start-info\n); -return rc; -} - -header = devtree; -devtree_size = header-totalsize; -{ -static const char dtb[] = /tmp/xc_domU.dtb; -int dfd = creat(dtb, 0666); -if (dfd != -1) { -write(dfd, devtree, devtree_size); -close(dfd); -} else -DPRINTF(could not open(\%s\)\n, dtb); -} - -DPRINTF(copying device tree to 0x%lx[0x%x]\n, DEVTREE_ADDR, devtree_size); -return install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR, - devtree_size); -} - static int load_initrd( int xc_handle, int domid, @@ -187,13 +110,14 @@ out: } static unsigned long create_start_info( -void *devtree, start_info_t *start_info, -unsigned int console_evtchn, unsigned int store_evtchn, -unsigned long nr_pages, unsigned long rma_pages) +start_info_t *start_info, +unsigned int console_evtchn, +unsigned int store_evtchn, +unsigned long nr_pages, +unsigned long rma_pages) { unsigned long start_info_addr; uint64_t rma_top; -int rc; memset(start_info, 0, sizeof(*start_info)); snprintf(start_info-magic, sizeof(start_info-magic), @@ -209,13 +133,6 @@ static unsigned long
[XenPPC] [PATCH 2 of 4] [PATCH] Remove FlatDeviceTree.py, eliminate devtree from prose builder
7 files changed, 23 insertions(+), 571 deletions(-) tools/python/xen/xend/FlatDeviceTree.py | 359 --- tools/libxc/powerpc64/utils.c | 25 -- tools/libxc/powerpc64/utils.h |3 tools/libxc/powerpc64/xc_prose_build.c | 124 -- tools/libxc/xenguest.h | 17 - tools/python/xen/lowlevel/xc/xc.c | 12 - tools/python/xen/xend/image.py | 54 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1169248739 21600 # Node ID 7a979077afc8998a702e3fbc8a575397bda80c21 # Parent e3b9f4ea49c014d8578415082ad09f76dbfb98b6 [PATCH] Remove FlatDeviceTree.py, eliminate devtree from prose builder. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r e3b9f4ea49c0 -r 7a979077afc8 tools/libxc/powerpc64/utils.c --- a/tools/libxc/powerpc64/utils.c Fri Jan 19 17:18:59 2007 -0600 +++ b/tools/libxc/powerpc64/utils.c Fri Jan 19 17:18:59 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jimi Xenidis [EMAIL PROTECTED] @@ -36,29 +36,6 @@ #include flatdevtree_env.h #include flatdevtree.h #include utils.h - -unsigned long get_rma_pages(void *devtree) -{ -void *rma; -uint64_t rma_reg[2]; -int rc; - -rma = ft_find_node(devtree, /[EMAIL PROTECTED]); -if (rma == NULL) { -DPRINTF(couldn't find /[EMAIL PROTECTED]); -return 0; -} -rc = ft_get_prop(devtree, rma, reg, rma_reg, sizeof(rma_reg)); -if (rc 0) { -DPRINTF(couldn't get /[EMAIL PROTECTED]/reg\n); -return 0; -} -if (rma_reg[0] != 0) { -DPRINTF(RMA did not start at 0\n); -return 0; -} -return rma_reg[1] PAGE_SHIFT; -} int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array, unsigned long nr_pages) diff -r e3b9f4ea49c0 -r 7a979077afc8 tools/libxc/powerpc64/utils.h --- a/tools/libxc/powerpc64/utils.h Fri Jan 19 17:18:59 2007 -0600 +++ b/tools/libxc/powerpc64/utils.h Fri Jan 19 17:18:59 2007 -0600 @@ -13,13 +13,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jimi Xenidis [EMAIL PROTECTED] */ -extern unsigned long get_rma_pages(void *devtree); extern int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array, unsigned long nr_pages); extern int install_image(int xc_handle, int domid, xen_pfn_t *page_array, diff -r e3b9f4ea49c0 -r 7a979077afc8 tools/libxc/powerpc64/xc_prose_build.c --- a/tools/libxc/powerpc64/xc_prose_build.cFri Jan 19 17:18:59 2007 -0600 +++ b/tools/libxc/powerpc64/xc_prose_build.cFri Jan 19 17:18:59 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jonathan Appavoo [EMAIL PROTECTED] @@ -34,18 +34,14 @@ #include xg_private.h #include xenctrl.h -#include flatdevtree_env.h -#include flatdevtree.h #include utils.h #define INITRD_ADDR (24UL 20) -#define DEVTREE_ADDR (16UL 20) static int init_boot_vcpu( int xc_handle, int domid, struct domain_setup_info *dsi, -unsigned long devtree_addr, unsigned long kern_addr) { vcpu_guest_context_t ctxt; @@ -55,7 +51,7 @@ static int init_boot_vcpu( ctxt.user_regs.pc = dsi-v_kernentry; ctxt.user_regs.msr = 0; ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */ -ctxt.user_regs.gprs[3] = devtree_addr; +ctxt.user_regs.gprs[3] = 0; ctxt.user_regs.gprs[4] = kern_addr; ctxt.user_regs.gprs[5] = 0; /* reserved for specifying OF handler */ /* There is a buggy kernel that does not zero the local_paca, so @@ -79,85 +75,6 @@ static int init_boot_vcpu( return rc; } -static int load_devtree( -int xc_handle, -int domid, -xen_pfn_t *page_array, -void *devtree, -unsigned long devtree_addr, -uint64_t initrd_base, -unsigned long initrd_len, -start_info_t *start_info __attribute__((unused)), -unsigned long start_info_addr) -{ -uint32_t si[4] = {0, start_info_addr, 0, 0x1000}; -struct boot_param_header *header; -void *chosen; -void *xen; -uint64_t initrd_end = initrd_base + initrd_len; -unsigned int devtree_size; -int rc = 0; - -DPRINTF(adding initrd props\n); - -chosen = ft_find_node(devtree, /chosen
[XenPPC] [PATCH 4 of 4] [PATCH] Sync tools/python/xen/lowlevel/xc/xc.c with xen-unstable.hg
1 files changed, 57 insertions(+), 106 deletions(-) tools/python/xen/lowlevel/xc/xc.c | 163 - # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1169248739 21600 # Node ID 6e93a244722d7ee5bedbce4d2ee9e3ca46bea7ea # Parent 8a5446bed383ac438f20137189f627ae9c4e771c [PATCH] Sync tools/python/xen/lowlevel/xc/xc.c with xen-unstable.hg Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 8a5446bed383 -r 6e93a244722d tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 17:18:59 2007 -0600 +++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 17:18:59 2007 -0600 @@ -360,7 +360,6 @@ static PyObject *pyxc_linux_build(XcObje unsigned int mem_mb; unsigned long store_mfn = 0; unsigned long console_mfn = 0; -int unused; static char *kwd_list[] = { domid, store_evtchn, memsize, console_evtchn, image, @@ -368,12 +367,12 @@ static PyObject *pyxc_linux_build(XcObje ramdisk, cmdline, flags, features, NULL }; -if ( !PyArg_ParseTupleAndKeywords(args, kwds, s|ssis#, kwd_list, +if ( !PyArg_ParseTupleAndKeywords(args, kwds, s|ssis, kwd_list, dom, store_evtchn, mem_mb, console_evtchn, image, /* optional */ ramdisk, cmdline, flags, - features, unused) ) + features) ) return NULL; if ( xc_linux_build(self-xc_handle, dom, mem_mb, image, @@ -442,6 +441,47 @@ static PyObject *pyxc_hvm_build(XcObject return Py_BuildValue({s:i}, store_mfn, store_mfn); } +#ifdef __powerpc__ +static PyObject *pyxc_prose_build(XcObject *self, + PyObject *args, + PyObject *kwds) +{ +uint32_t dom; +char *image, *ramdisk = NULL, *cmdline = , *features = NULL; +int flags = 0; +int store_evtchn, console_evtchn; +unsigned int mem_mb; +unsigned long store_mfn = 0; +unsigned long console_mfn = 0; + +static char *kwd_list[] = { dom, store_evtchn, +console_evtchn, image, memsize, +/* optional */ +ramdisk, cmdline, flags, +features, NULL }; + +if ( !PyArg_ParseTupleAndKeywords(args, kwds, iiis|ssis, kwd_list, + dom, store_evtchn, + console_evtchn, image, mem_mb, + /* optional */ + ramdisk, cmdline, flags, + features) ) +return NULL; + +if ( xc_prose_build(self-xc_handle, dom, mem_mb, image, +ramdisk, cmdline, features, flags, +store_evtchn, store_mfn, +console_evtchn, console_mfn) != 0 ) { +if (!errno) + errno = EINVAL; +return pyxc_error_to_exception(); +} +return Py_BuildValue({s:i,s:i}, + store_mfn, store_mfn, + console_mfn, console_mfn); +} +#endif /* powerpc */ + static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self, PyObject *args, PyObject *kwds) @@ -915,68 +955,6 @@ static PyObject *dom_op(XcObject *self, Py_INCREF(zero); return zero; } - -#ifdef __powerpc__ -static PyObject *pyxc_alloc_real_mode_area(XcObject *self, - PyObject *args, - PyObject *kwds) -{ -uint32_t dom; -unsigned int log; - -static char *kwd_list[] = { dom, log, NULL }; - -if ( !PyArg_ParseTupleAndKeywords(args, kwds, ii, kwd_list, - dom, log) ) -return NULL; - -if ( xc_alloc_real_mode_area(self-xc_handle, dom, log) ) -return pyxc_error_to_exception(); - -Py_INCREF(zero); -return zero; -} - -static PyObject *pyxc_prose_build(XcObject *self, - PyObject *args, - PyObject *kwds) -{ -uint32_t dom; -char *image, *ramdisk = NULL, *cmdline = , *features = NULL; -int flags = 0; -int store_evtchn, console_evtchn; -unsigned int mem_mb; -unsigned long store_mfn = 0; -unsigned long console_mfn = 0; -int unused; - -static char *kwd_list[] = { dom, store_evtchn, -console_evtchn, image, memsize, -/* optional */ -ramdisk, cmdline, flags, -features, NULL
Re: [XenPPC] [PATCH 3 of 4] [PATCH] Move flat device tree construction from python to libxc for xc_linux_build()
* Jimi Xenidis [EMAIL PROTECTED] [2007-01-11 16:53]: Ok there are a few things here. Respun with fixes: - preserve and return errno where approriate - using open/close and read/write instead of f* - dropped vcpu argument, only fill out one cpu in devtree - dropped regexp requirment, use a null-terminated list of filters - made sure to call closedir() - fixed double-free of bph on error path - fixed static function names - renamed find_first_cpu to find_cpu, we don't care which cpu we find -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: b/tools/libxc/powerpc64/mk_flatdevtree.c | 567 +++ b/tools/libxc/powerpc64/mk_flatdevtree.h | 44 ++ tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/xc_linux_build.c | 30 + tools/libxc/xenguest.h |4 tools/python/xen/lowlevel/xc/xc.c| 12 tools/python/xen/xend/image.py |5 7 files changed, 646 insertions(+), 17 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- [PATCH] Move flat device tree construction from python to libxc for xc_linux_build(). Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 3edbfb956864 tools/libxc/powerpc64/Makefile --- a/tools/libxc/powerpc64/MakefileFri Jan 12 15:16:42 2007 -0600 +++ b/tools/libxc/powerpc64/MakefileFri Jan 12 15:16:42 2007 -0600 @@ -1,4 +1,5 @@ GUEST_SRCS-y += powerpc64/flatdevtree.c GUEST_SRCS-y += powerpc64/flatdevtree.c +GUEST_SRCS-y += powerpc64/mk_flatdevtree.c GUEST_SRCS-y += powerpc64/xc_linux_build.c GUEST_SRCS-y += powerpc64/xc_prose_build.c GUEST_SRCS-y += powerpc64/utils.c diff -r 3edbfb956864 tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cFri Jan 12 15:16:42 2007 -0600 +++ b/tools/libxc/powerpc64/xc_linux_build.cFri Jan 12 16:00:33 2007 -0600 @@ -13,9 +13,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006, 2007 * * Authors: Hollis Blanchard [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #include stdio.h @@ -36,6 +37,7 @@ #include flatdevtree_env.h #include flatdevtree.h #include utils.h +#include mk_flatdevtree.h #define INITRD_ADDR (24UL 20) #define DEVTREE_ADDR (16UL 20) @@ -238,8 +240,7 @@ int xc_linux_build(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - void *devtree) + unsigned long *console_mfn) { start_info_t start_info; struct domain_setup_info dsi; @@ -251,12 +252,34 @@ int xc_linux_build(int xc_handle, unsigned long initrd_len = 0; unsigned long start_info_addr; unsigned long rma_pages; +unsigned long shadow_mb; int rc = 0; +int op; +struct ft_cxt root; +void *devtree; DPRINTF(%s\n, __func__); nr_pages = mem_mb (20 - PAGE_SHIFT); DPRINTF(nr_pages 0x%lx\n, nr_pages); + +/* fetch the current shadow_memory value for this domain */ +op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION; +if (xc_shadow_control(xc_handle, domid, op, NULL, 0, shadow_mb, 0, NULL) 0 ) { +rc = -1; +goto out; +} + +/* build the devtree here */ +DPRINTF(constructing devtree\n); +if (make_devtree(root, domid, mem_mb, shadow_mb, cmdline) 0) { +DPRINTF(failed to create flattened device tree\n); +rc = -1; +goto out; +} + +/* point devtree at bph blob */ +devtree = root.bph; rma_pages = get_rma_pages(devtree); if (rma_pages == 0) { @@ -314,6 +337,7 @@ int xc_linux_build(int xc_handle, } out: +free_devtree(root); free_page_array(page_array); return rc; } diff -r 3edbfb956864 tools/libxc/xenguest.h --- a/tools/libxc/xenguest.hFri Jan 12 15:16:42 2007 -0600 +++ b/tools/libxc/xenguest.hFri Jan 12 17:08:40 2007 -0600 @@ -57,7 +57,6 @@ int xc_linux_restore(int xc_handle, int * @parm store_mfn returned with the mfn of the store page * @parm console_evtchn the console event channel for this domain to use * @parm console_mfn returned with the mfn of the console page - * @parm arch_args architecture-specific data * @return 0 on success, -1 on failure */ int xc_linux_build(int xc_handle, @@ -71,8 +70,7 @@ int xc_linux_build(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - void *arch_args); + unsigned long *console_mfn); /** * This function will create a domain for a paravirtualized
[XenPPC] [PATCH 3 of 4] [PATCH] Move flat device tree construction from python to libxc for xc_linux_build()
7 files changed, 617 insertions(+), 17 deletions(-) tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/mk_flatdevtree.c | 520 tools/libxc/powerpc64/mk_flatdevtree.h | 48 ++ tools/libxc/powerpc64/xc_linux_build.c | 44 ++ tools/libxc/xenguest.h |4 tools/python/xen/lowlevel/xc/xc.c | 12 tools/python/xen/xend/image.py |5 # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1168544367 21600 # Node ID e4fda6c5e7a907b5e4726c4f4d5f117c0f4d6f50 # Parent 0279229b68453a4a1b3613ac02c8b8ca9a965875 [PATCH] Move flat device tree construction from python to libxc for xc_linux_build(). Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 0279229b6845 -r e4fda6c5e7a9 tools/libxc/powerpc64/Makefile --- a/tools/libxc/powerpc64/MakefileThu Jan 11 13:39:27 2007 -0600 +++ b/tools/libxc/powerpc64/MakefileThu Jan 11 13:39:27 2007 -0600 @@ -1,4 +1,5 @@ GUEST_SRCS-y += powerpc64/flatdevtree.c GUEST_SRCS-y += powerpc64/flatdevtree.c +GUEST_SRCS-y += powerpc64/mk_flatdevtree.c GUEST_SRCS-y += powerpc64/xc_linux_build.c GUEST_SRCS-y += powerpc64/xc_prose_build.c GUEST_SRCS-y += powerpc64/utils.c diff -r 0279229b6845 -r e4fda6c5e7a9 tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.cThu Jan 11 13:39:27 2007 -0600 +++ b/tools/libxc/powerpc64/xc_linux_build.cThu Jan 11 13:39:27 2007 -0600 @@ -13,9 +13,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006 * * Authors: Hollis Blanchard [EMAIL PROTECTED] + * Ryan Harper [EMAIL PROTECTED] */ #include stdio.h @@ -36,6 +37,7 @@ #include flatdevtree_env.h #include flatdevtree.h #include utils.h +#include mk_flatdevtree.h #define INITRD_ADDR (24UL 20) #define DEVTREE_ADDR (16UL 20) @@ -238,8 +240,7 @@ int xc_linux_build(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - void *devtree) + unsigned long *console_mfn) { start_info_t start_info; struct domain_setup_info dsi; @@ -251,12 +252,48 @@ int xc_linux_build(int xc_handle, unsigned long initrd_len = 0; unsigned long start_info_addr; unsigned long rma_pages; +unsigned long shadow_mb; int rc = 0; +int op; +uint32_t nr_vcpus; +xc_dominfo_t info; +struct ft_cxt root; +void *devtree; DPRINTF(%s\n, __func__); nr_pages = mem_mb (20 - PAGE_SHIFT); DPRINTF(nr_pages 0x%lx\n, nr_pages); + +/* XXX: fetch the number of vcpus configured for this domain + checking that xc_domain_getinfo returns info for exactly 1 + dom */ +if (xc_domain_getinfo(xc_handle, domid, 1, info) != 1) { +DPRINTF(xc_domain_getinfo() failed, can't determine max_vcpu_id\n); +rc = -1; +goto out; +} + +/* NB: max_vcpu_id is zero-based */ +nr_vcpus = info.max_vcpu_id + 1; + +/* XXX: fetch the current shadow_memory value for this domain */ +op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION; +if (xc_shadow_control(xc_handle, domid, op, NULL, 0, shadow_mb, 0, NULL) 0 ) { +rc = -1; +goto out; +} + +/* build the devtree here */ +DPRINTF(constructing devtree\n); +if (make_devtree(root, domid, mem_mb, nr_vcpus, shadow_mb, cmdline) 0) { +DPRINTF(failed to create flattened device tree\n); +rc = -1; +goto out; +} + +/* point devtree at bph blob */ +devtree = root.bph; rma_pages = get_rma_pages(devtree); if (rma_pages == 0) { @@ -314,6 +351,7 @@ int xc_linux_build(int xc_handle, } out: +free_devtree(root.bph); free_page_array(page_array); return rc; } diff -r 0279229b6845 -r e4fda6c5e7a9 tools/libxc/xenguest.h --- a/tools/libxc/xenguest.hThu Jan 11 13:39:27 2007 -0600 +++ b/tools/libxc/xenguest.hThu Jan 11 13:39:27 2007 -0600 @@ -57,7 +57,6 @@ int xc_linux_restore(int xc_handle, int * @parm store_mfn returned with the mfn of the store page * @parm console_evtchn the console event channel for this domain to use * @parm console_mfn returned with the mfn of the console page - * @parm arch_args architecture-specific data * @return 0 on success, -1 on failure */ int xc_linux_build(int xc_handle, @@ -71,8 +70,7 @@ int xc_linux_build(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - void *arch_args); + unsigned long *console_mfn); /** * This function will create a domain for a paravirtualized Linux diff
[XenPPC] [PATCH 2 of 4] [PATCH] Fix pointer math in ft_add_rsvmap(), rename string block to match DTC spec
2 files changed, 6 insertions(+), 3 deletions(-) tools/libxc/powerpc64/flatdevtree.c |7 +-- tools/libxc/powerpc64/flatdevtree.h |2 +- # HG changeset patch # User Ryan Harper [EMAIL PROTECTED] # Date 1168544367 21600 # Node ID 0279229b68453a4a1b3613ac02c8b8ca9a965875 # Parent 301aa30e95e2a7a76f98c4fbad5f3da4c4aaab42 [PATCH] Fix pointer math in ft_add_rsvmap(), rename string block to match DTC spec. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r 301aa30e95e2 -r 0279229b6845 tools/libxc/powerpc64/flatdevtree.c --- a/tools/libxc/powerpc64/flatdevtree.c Thu Jan 11 13:39:27 2007 -0600 +++ b/tools/libxc/powerpc64/flatdevtree.c Thu Jan 11 13:39:27 2007 -0600 @@ -14,7 +14,7 @@ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright Pantelis Antoniou 2006 - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006 * 2006 (c) MontaVista, Software, Inc. * * Authors: Pantelis Antoniou [EMAIL PROTECTED] @@ -209,7 +209,7 @@ void ft_add_rsvmap(struct ft_cxt *cxt, u ((u64 *) cxt-pres)[0] = cpu_to_be64(physaddr); /* phys = 0, size = 0, terminate */ ((u64 *) cxt-pres)[1] = cpu_to_be64(size); - cxt-pres += 18;/* advance */ + cxt-pres += 16;/* advance two u64s worth */ ((u64 *) cxt-pres)[0] = 0; /* phys = 0, size = 0, terminate */ ((u64 *) cxt-pres)[1] = 0; @@ -317,6 +317,9 @@ int ft_end_tree(struct ft_cxt *cxt) /* the new strings start */ cxt-pstr_begin = cxt-p_begin + cxt-struct_size; cxt-pstr = cxt-pstr_begin + cxt-strings_size; + + /* mark the size of string structure in bph */ + bph-size_dt_strings = cxt-strings_size; return 0; } diff -r 301aa30e95e2 -r 0279229b6845 tools/libxc/powerpc64/flatdevtree.h --- a/tools/libxc/powerpc64/flatdevtree.h Thu Jan 11 13:39:27 2007 -0600 +++ b/tools/libxc/powerpc64/flatdevtree.h Thu Jan 11 13:39:27 2007 -0600 @@ -40,7 +40,7 @@ struct boot_param_header { /* version 2 fields below */ u32 boot_cpuid_phys;/* Physical CPU id we're booting on */ /* version 3 fields below */ - u32 dt_strings_size;/* size of the DT strings block */ + u32 size_dt_strings;/* size of the DT strings block */ }; struct ft_cxt { ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
[XenPPC] [PATCH 0 of 4] [PATCH] move devtree creation to libxc
This patchset moves the construction of the flat OF tree from python into libxc. whitespace_cleanup.patch - whitespace clean-up in xc_linux_build.c fix_up_flatdevtree.patch - fix copyright notice in flatdevtree.c - fix pointer math in ft_add_rsvmap() - rename bph string block field to match spec dd_make_devtree.patch- fix copyright notice in xc_linux_build.c - remove arch_arg from python down to libxc - remove call to Flatdevtree in image.py - add mk_flatdevtree for construction of flat OF trees - modify xc_linux_build to use mk_flatdevtree remove_python_flatdevtree.patch - remove FlatDeviceTree.py - remove arch_arg for prose builder - remove call to Flatdevtree for prose builder - modify prose builder to use mk_flatdevtree I've test booted using the xc_linux_build, but I've not tested the changes to the prose builder. Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- 11 files changed, 675 insertions(+), 400 deletions(-) tools/python/xen/xend/FlatDeviceTree.py | 359 - tools/libxc/powerpc64/Makefile |1 tools/libxc/powerpc64/flatdevtree.c |7 tools/libxc/powerpc64/flatdevtree.h |2 tools/libxc/powerpc64/mk_flatdevtree.c | 520 +++ tools/libxc/powerpc64/mk_flatdevtree.h | 48 ++ tools/libxc/powerpc64/xc_linux_build.c | 52 ++- tools/libxc/powerpc64/xc_prose_build.c | 44 ++ tools/libxc/xenguest.h |7 tools/python/xen/lowlevel/xc/xc.c | 24 - tools/python/xen/xend/image.py | 11 ___ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel
Re: [XenPPC] [PATCH 4 of 4] [PATCH] Remove FlatDeviceTree.py, move prose builder to libxc devtree construction
* Jimi Xenidis [EMAIL PROTECTED] [2007-01-11 15:11]: Straight off, prose should have no flat tree reference at all. Respun with devtree refs excised. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 [EMAIL PROTECTED] diffstat output: a/tools/python/xen/xend/FlatDeviceTree.py | 359 -- tools/libxc/powerpc64/xc_prose_build.c| 125 -- tools/libxc/xenguest.h|3 tools/python/xen/lowlevel/xc/xc.c | 12 - tools/python/xen/xend/image.py|6 5 files changed, 17 insertions(+), 488 deletions(-) Signed-off-by: Ryan Harper [EMAIL PROTECTED] --- [PATCH] Remove FlatDeviceTree.py, eliminate devtree from prose builder. Signed-off-by: Ryan Harper [EMAIL PROTECTED] diff -r e4fda6c5e7a9 tools/libxc/powerpc64/xc_prose_build.c --- a/tools/libxc/powerpc64/xc_prose_build.cThu Jan 11 13:39:27 2007 -0600 +++ b/tools/libxc/powerpc64/xc_prose_build.cThu Jan 11 15:15:50 2007 -0600 @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Copyright (C) IBM Corporation 2006 + * Copyright IBM Corporation 2006 * * Authors: Hollis Blanchard [EMAIL PROTECTED] * Jonathan Appavoo [EMAIL PROTECTED] @@ -34,18 +34,14 @@ #include xg_private.h #include xenctrl.h -#include flatdevtree_env.h -#include flatdevtree.h #include utils.h #define INITRD_ADDR (24UL 20) -#define DEVTREE_ADDR (16UL 20) static int init_boot_vcpu( int xc_handle, int domid, struct domain_setup_info *dsi, -unsigned long devtree_addr, unsigned long kern_addr) { vcpu_guest_context_t ctxt; @@ -55,7 +51,7 @@ static int init_boot_vcpu( ctxt.user_regs.pc = dsi-v_kernentry; ctxt.user_regs.msr = 0; ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */ -ctxt.user_regs.gprs[3] = devtree_addr; +ctxt.user_regs.gprs[3] = 0; ctxt.user_regs.gprs[4] = kern_addr; ctxt.user_regs.gprs[5] = 0; /* reserved for specifying OF handler */ /* There is a buggy kernel that does not zero the local_paca, so @@ -79,85 +75,6 @@ static int init_boot_vcpu( return rc; } -static int load_devtree( -int xc_handle, -int domid, -xen_pfn_t *page_array, -void *devtree, -unsigned long devtree_addr, -uint64_t initrd_base, -unsigned long initrd_len, -start_info_t *start_info __attribute__((unused)), -unsigned long start_info_addr) -{ -uint32_t si[4] = {0, start_info_addr, 0, 0x1000}; -struct boot_param_header *header; -void *chosen; -void *xen; -uint64_t initrd_end = initrd_base + initrd_len; -unsigned int devtree_size; -int rc = 0; - -DPRINTF(adding initrd props\n); - -chosen = ft_find_node(devtree, /chosen); -if (chosen == NULL) { -DPRINTF(couldn't find /chosen\n); -return -1; -} - -xen = ft_find_node(devtree, /xen); -if (xen == NULL) { -DPRINTF(couldn't find /xen\n); -return -1; -} - -/* initrd-start */ -rc = ft_set_prop(devtree, chosen, linux,initrd-start, -initrd_base, sizeof(initrd_base)); -if (rc 0) { -DPRINTF(couldn't set /chosen/linux,initrd-start\n); -return rc; -} - -/* initrd-end */ -rc = ft_set_prop(devtree, chosen, linux,initrd-end, -initrd_end, sizeof(initrd_end)); -if (rc 0) { -DPRINTF(couldn't set /chosen/linux,initrd-end\n); -return rc; -} - -rc = ft_set_rsvmap(devtree, 1, initrd_base, initrd_len); -if (rc 0) { -DPRINTF(couldn't set initrd reservation\n); -return ~0UL; -} - -/* start-info (XXX being removed soon) */ -rc = ft_set_prop(devtree, xen, start-info, si, sizeof(si)); -if (rc 0) { -DPRINTF(couldn't set /xen/start-info\n); -return rc; -} - -header = devtree; -devtree_size = header-totalsize; -{ -static const char dtb[] = /tmp/xc_domU.dtb; -int dfd = creat(dtb, 0666); -if (dfd != -1) { -write(dfd, devtree, devtree_size); -close(dfd); -} else -DPRINTF(could not open(\%s\)\n, dtb); -} - -DPRINTF(copying device tree to 0x%lx[0x%x]\n, DEVTREE_ADDR, devtree_size); -return install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR, - devtree_size); -} - static int load_initrd( int xc_handle, int domid, @@ -188,7 +105,7 @@ out: } static unsigned long create_start_info( - void *devtree, start_info_t *start_info, + start_info_t *start_info, unsigned int console_evtchn, unsigned int store_evtchn, unsigned long nr_pages, unsigned long rma_pages, const char *cmdline) { @@ -213,12 +130,6 @@ static unsigned long create_start_info( /* just in case we truncated cmdline with strncpy add 0