WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

WARNING! Xen Link location change Was: [XenPPC] [xenppc-unstable] [POWER

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: WARNING! Xen Link location change Was: [XenPPC] [xenppc-unstable] [POWERPC] memory cleanup (phase 2), destroy (et. al) now work
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Mon, 14 Aug 2006 10:09:48 -0400
Delivery-date: Mon, 14 Aug 2006 07:10:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <E1GCd1N-0006fH-1h@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1GCd1N-0006fH-1h@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
This patch changes the link location of Xen to 4MiB.
This is the same value used by Linux zImage binaries so we know its good, we can use it now because our heap initialization is fixed now.
-JX
On Aug 14, 2006, at 10:02 AM, Xen patchbot-xenppc-unstable wrote:

# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID a1b47efc03df15203be97a788b66650db90e7bfa
# Parent  2329c5315dd1edfe4b1d557f0249fffa049fb305
[POWERPC] memory cleanup (phase 2), destroy (et. al) now work

The patch fixes the following problems:
  - Fix initializing the heaps so we can Link anywhere < RMA.  We not
    link xen at 4MiB, which is way saner.
  - We track and allocate pages (especially RMA) based on order.
  - free domain memory as a resource not as domain
  - clarify "order" arithmetic
  - update stale def of fix IS_XEN_HEAP_FRAME()
---
 xen/arch/powerpc/Makefile           |    2 -
 xen/arch/powerpc/domain.c           |   16 +++++++--------
 xen/arch/powerpc/htab.c             |    8 ++-----
 xen/arch/powerpc/mm.c               |    1
 xen/arch/powerpc/powerpc64/ppc970.c |    3 +-
xen/arch/powerpc/setup.c | 37 +++++++++++++++++++++ +--------------
 xen/include/asm-powerpc/domain.h    |    2 -
 xen/include/asm-powerpc/htab.h      |    3 +-
 xen/include/asm-powerpc/mm.h        |    2 -
 9 files changed, 41 insertions(+), 33 deletions(-)

diff -r 2329c5315dd1 -r a1b47efc03df xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/arch/powerpc/Makefile Mon Aug 14 09:53:46 2006 -0400
@@ -49,7 +49,7 @@ PPC_C_WARNINGS += -Wundef -Wmissing-prot
 PPC_C_WARNINGS += -Wundef -Wmissing-prototypes -Wmissing-declarations
 CFLAGS += $(PPC_C_WARNINGS)

-LINK=0x3000000
+LINK=0x400000
 boot32_link_base = $(LINK)
 xen_link_offset  = 100
 xen_link_base    = $(patsubst %000,%$(xen_link_offset),$(LINK))
diff -r 2329c5315dd1 -r a1b47efc03df xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/arch/powerpc/domain.c Mon Aug 14 09:53:46 2006 -0400
@@ -74,7 +74,7 @@ int arch_domain_create(struct domain *d)
 int arch_domain_create(struct domain *d)
 {
     unsigned long rma_base;
-    unsigned long rma_size;
+    unsigned long rma_sz;
     uint htab_order;

     if (d->domain_id == IDLE_DOMAIN_ID) {
@@ -85,19 +85,20 @@ int arch_domain_create(struct domain *d)
     }

     d->arch.rma_order = cpu_rma_order();
-    rma_size = 1UL << d->arch.rma_order << PAGE_SHIFT;
+    rma_sz = rma_size(d->arch.rma_order);

     /* allocate the real mode area */
     d->max_pages = 1UL << d->arch.rma_order;
+    d->tot_pages = 0;
     d->arch.rma_page = alloc_domheap_pages(d, d->arch.rma_order, 0);
     if (NULL == d->arch.rma_page)
         return 1;
     rma_base = page_to_maddr(d->arch.rma_page);

-    BUG_ON(rma_base & (rma_size-1)); /* check alignment */
-
-    printk("clearing RMO: 0x%lx[0x%lx]\n", rma_base, rma_size);
-    memset((void *)rma_base, 0, rma_size);
+    BUG_ON(rma_base & (rma_sz - 1)); /* check alignment */
+
+    printk("clearing RMO: 0x%lx[0x%lx]\n", rma_base, rma_sz);
+    memset((void *)rma_base, 0, rma_sz);

     d->shared_info = (shared_info_t *)
         (rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base);
@@ -120,7 +121,6 @@ int arch_domain_create(struct domain *d)

 void arch_domain_destroy(struct domain *d)
 {
-    free_domheap_pages(d->arch.rma_page, d->arch.rma_order);
     htab_free(d);
 }

@@ -263,7 +263,7 @@ void sync_vcpu_execstate(struct vcpu *v)

 void domain_relinquish_resources(struct domain *d)
 {
-    /* nothing to do? */
+    free_domheap_pages(d->arch.rma_page, d->arch.rma_order);
 }

 void arch_dump_domain_info(struct domain *d)
diff -r 2329c5315dd1 -r a1b47efc03df xen/arch/powerpc/htab.c
--- a/xen/arch/powerpc/htab.c   Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/arch/powerpc/htab.c   Mon Aug 14 09:53:46 2006 -0400
@@ -44,27 +44,25 @@ void htab_alloc(struct domain *d, uint o
     htab_raddr = (ulong)alloc_xenheap_pages(order);
     ASSERT(htab_raddr != 0);
     /* XXX check alignment guarantees */
-    ASSERT((htab_raddr & (htab_bytes-1)) == 0);
+    ASSERT((htab_raddr & (htab_bytes - 1)) == 0);

     /* XXX slow. move memset out to service partition? */
     memset((void *)htab_raddr, 0, htab_bytes);

+    d->arch.htab.order = order;
     d->arch.htab.log_num_ptes = log_htab_bytes - LOG_PTE_SIZE;
     d->arch.htab.sdr1 = htab_calc_sdr1(htab_raddr, log_htab_bytes);
     d->arch.htab.map = (union pte *)htab_raddr;
     d->arch.htab.shadow = xmalloc_array(ulong,
1UL << d- >arch.htab.log_num_ptes);
     ASSERT(d->arch.htab.shadow != NULL);
-
- printf("%s: dom%x sdr1: %lx\n", __func__, d->domain_id, d- >arch.htab.sdr1);
 }

 void htab_free(struct domain *d)
 {
     ulong htab_raddr = GET_HTAB(d);

-    free_xenheap_pages((void *)htab_raddr,
- (1UL << d->arch.htab.log_num_ptes) << LOG_PTE_SIZE);
+    free_xenheap_pages((void *)htab_raddr, d->arch.htab.order);
     xfree(d->arch.htab.shadow);
 }

diff -r 2329c5315dd1 -r a1b47efc03df xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/arch/powerpc/mm.c     Mon Aug 14 09:53:46 2006 -0400
@@ -154,5 +154,4 @@ void shadow_drop_references(
 void shadow_drop_references(
     struct domain *d, struct page_info *page)
 {
-    panic("%s\n", __func__);
 }
diff -r 2329c5315dd1 -r a1b47efc03df xen/arch/powerpc/powerpc64/ ppc970.c --- a/xen/arch/powerpc/powerpc64/ppc970.c Sun Aug 13 19:19:37 2006 -0400 +++ b/xen/arch/powerpc/powerpc64/ppc970.c Mon Aug 14 09:53:46 2006 -0400
@@ -34,7 +34,8 @@ unsigned int cpu_rma_order(void)
 unsigned int cpu_rma_order(void)
 {
     /* XXX what about non-HV mode? */
-    return 14; /* 1<<14<<PAGE_SIZE = 64M */
+    uint rma_log_size = 6 + 20; /* 64M */
+    return rma_log_size - PAGE_SHIFT;
 }

 void cpu_initialize(void)
diff -r 2329c5315dd1 -r a1b47efc03df xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Mon Aug 14 09:53:46 2006 -0400
@@ -273,11 +273,25 @@ static void __init __start_xen(multiboot

     printk("System RAM: %luMB (%lukB)\n", eomem >> 20, eomem >> 10);

+    /* top of memory */
     max_page = PFN_DOWN(ALIGN_DOWN(eomem, PAGE_SIZE));
     total_pages = max_page;

-    /* skip the exception handlers */
+    /* Architecturally the first 4 pages are exception hendlers, we
+     * will also be copying down some code there */
     heap_start = init_boot_allocator(4 << PAGE_SHIFT);
+
+    /* we give the first RMA to the hypervisor */
+    xenheap_phys_end = rma_size(cpu_rma_order());
+
+    /* allow everything else to be allocated */
+    init_boot_pages(xenheap_phys_end, eomem);
+    init_frametable();
+    end_boot_allocator();
+
+    /* Add memory between the beginning of the heap and the beginning
+     * of out text */
+    init_xenheap_pages(heap_start, (ulong)_start);

     /* move the modules to just after _end */
     if (modules_start) {
@@ -293,26 +307,21 @@ static void __init __start_xen(multiboot
                 modules_start + modules_size);
     }

+    /* the rest of the xenheap, starting at the end of modules */
+    init_xenheap_pages(freemem, xenheap_phys_end);
+
+
 #ifdef OF_DEBUG
     printk("ofdump:\n");
     /* make sure the OF devtree is good */
     ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
 #endif

+    heap_size = xenheap_phys_end - heap_start;
+
+ printk("Xen heap: %luMB (%lukB)\n", heap_size >> 20, heap_size >> 10);
+
     percpu_init_areas();
-
-    /* mark all memory from modules onward as unused */
-    init_boot_pages(freemem, eomem);
-
-    init_frametable();
-    end_boot_allocator();
-
-    /* place the heap from after the allocator bitmap to _start */
-    xenheap_phys_end = (ulong)_start;
-    init_xenheap_pages(heap_start, xenheap_phys_end);
-    heap_size = xenheap_phys_end - heap_start;
-
- printk("Xen heap: %luMB (%lukB)\n", heap_size >> 20, heap_size >> 10);

     cpu_initialize();

diff -r 2329c5315dd1 -r a1b47efc03df xen/include/asm-powerpc/domain.h
--- a/xen/include/asm-powerpc/domain.h  Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/include/asm-powerpc/domain.h  Mon Aug 14 09:53:46 2006 -0400
@@ -107,7 +107,7 @@ extern void load_float(struct vcpu *);
 #define RMA_CONSOLE 3
 #define RMA_LAST_DOMU 3

-#define rma_size(rma_order) (1UL << (rma_order) << PAGE_SHIFT)
+#define rma_size(rma_order) (1UL << ((rma_order) + PAGE_SHIFT))

 static inline ulong rma_addr(struct arch_domain *ad, int type)
 {
diff -r 2329c5315dd1 -r a1b47efc03df xen/include/asm-powerpc/htab.h
--- a/xen/include/asm-powerpc/htab.h    Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/include/asm-powerpc/htab.h    Mon Aug 14 09:53:46 2006 -0400
@@ -128,7 +128,8 @@ union ptel {

 struct domain_htab {
     ulong sdr1;
-    ulong log_num_ptes; /* log number of PTEs in HTAB. */
+    uint log_num_ptes;  /* log number of PTEs in HTAB. */
+    uint order;         /* order for freeing. */
     union pte *map;     /* access the htab like an array */
     ulong *shadow;      /* idx -> logical translation array */
 };
diff -r 2329c5315dd1 -r a1b47efc03df xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h      Sun Aug 13 19:19:37 2006 -0400
+++ b/xen/include/asm-powerpc/mm.h      Mon Aug 14 09:53:46 2006 -0400
@@ -33,7 +33,7 @@
 #define memguard_unguard_range(_p,_l)    ((void)0)

 extern unsigned long xenheap_phys_end;
-#define IS_XEN_HEAP_FRAME(_pfn) (page_to_mfn(_pfn) < xenheap_phys_end) +#define IS_XEN_HEAP_FRAME(_pfn) (page_to_maddr(_pfn) < xenheap_phys_end)

 /*
  * Per-page-frame information.

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel