[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Simple global lVHPT support



ChangeSet 1.1369.1.1, 2005/03/29 17:31:47-07:00, djm@xxxxxxxxxxxxxxx

        Simple global lVHPT support



 arch/ia64/Rules.mk        |    4 ++--
 arch/ia64/regionreg.c     |    2 +-
 arch/ia64/vcpu.c          |   23 +++++++++++++++++++++++
 arch/ia64/vhpt.c          |   35 ++++++++++++++++++++++++++++++++++-
 arch/ia64/xenasm.S        |   13 +++++++++++++
 arch/ia64/xensetup.c      |    3 ++-
 include/asm-ia64/config.h |    1 +
 include/asm-ia64/vhpt.h   |    3 ++-
 8 files changed, 78 insertions(+), 6 deletions(-)


diff -Nru a/xen/arch/ia64/Rules.mk b/xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk    2005-04-01 19:02:56 -05:00
+++ b/xen/arch/ia64/Rules.mk    2005-04-01 19:02:56 -05:00
@@ -5,8 +5,8 @@
 OBJCOPY = objcopy
 endif
 ifneq ($(COMPILE_ARCH),$(TARGET_ARCH))
-CC = /usr/local/sp_env/v2.2/i686/bin/ia64-unknown-linux-gcc
-LD = /usr/local/sp_env/v2.2/i686/bin/ia64-unknown-linux-ld
+CC = /usr/local/sp_env/v2.2.3/i686/bin/ia64-unknown-linux-gcc
+LD = /usr/local/sp_env/v2.2.3/i686/bin/ia64-unknown-linux-ld
 OBJCOPY = /usr/local/sp_env/v2.2/i686/bin/ia64-unknown-linux-objcopy
 endif
 HOSTCC := gcc
diff -Nru a/xen/arch/ia64/regionreg.c b/xen/arch/ia64/regionreg.c
--- a/xen/arch/ia64/regionreg.c 2005-04-01 19:02:56 -05:00
+++ b/xen/arch/ia64/regionreg.c 2005-04-01 19:02:57 -05:00
@@ -189,7 +189,7 @@
 //  it should be unmangled
 
 //This appears to work in Xen... turn it on later so no complications yet
-//#define CONFIG_MANGLE_RIDS
+#define CONFIG_MANGLE_RIDS
 #ifdef CONFIG_MANGLE_RIDS
 static inline unsigned long
 vmMangleRID(unsigned long RIDVal)
diff -Nru a/xen/arch/ia64/vcpu.c b/xen/arch/ia64/vcpu.c
--- a/xen/arch/ia64/vcpu.c      2005-04-01 19:02:56 -05:00
+++ b/xen/arch/ia64/vcpu.c      2005-04-01 19:02:56 -05:00
@@ -1491,10 +1491,27 @@
 
        // FIXME: validate ifa here (not in Xen space), COULD MACHINE CHECK!
        // FIXME, must be inlined or potential for nested fault here!
+       if ((vcpu->domain==dom0) && (logps < PAGE_SHIFT)) {
+               printf("vcpu_itc_no_srlz: domain0 use of smaller page size!\n");
+               //FIXME: kill domain here
+               while(1);
+       }
        psr = ia64_clear_ic();
        ia64_itc(IorD,vaddr,pte,ps); // FIXME: look for bigger mappings
        ia64_set_psr(psr);
        // ia64_srlz_i(); // no srls req'd, will rfi later
+#ifdef VHPT_GLOBAL
+       if (vcpu->domain==dom0 && ((vaddr >> 61) == 7)) {
+               // FIXME: this is dangerous... vhpt_flush_address ensures these
+               // addresses never get flushed.  More work needed if this
+               // ever happens.
+//printf("vhpt_insert(%p,%p,%p)\n",vaddr,pte,1L<<logps);
+               vhpt_insert(vaddr,pte,logps<<2);
+       }
+       // even if domain pagesize is larger than PAGE_SIZE, just put
+       // PAGE_SIZE mapping in the vhpt for now, else purging is complicated
+       else vhpt_insert(vaddr,pte,PAGE_SHIFT<<2);
+#endif
        if (IorD & 0x4) return;  // don't place in 1-entry TLB
        if (IorD & 0x1) {
                vcpu_set_tr_entry(&PSCB(vcpu,itlb),pte,ps<<2,vaddr);
@@ -1613,6 +1630,9 @@
        //  base = stride1 = stride2 = 0, count0 = count 1 = 1
 
        // FIXME: When VHPT is in place, flush that too!
+#ifdef VHPT_GLOBAL
+       vhpt_flush();   // FIXME: This is overdoing it
+#endif
        local_flush_tlb_all();
        // just invalidate the "whole" tlb
        vcpu_purge_tr_entry(&PSCB(vcpu,dtlb));
@@ -1632,6 +1652,9 @@
        // FIXME: validate not flushing Xen addresses
        // if (Xen address) return(IA64_ILLOP_FAULT);
        // FIXME: ??breaks if domain PAGE_SIZE < Xen PAGE_SIZE
+#ifdef VHPT_GLOBAL
+       vhpt_flush_address(vadr,addr_range);
+#endif
        ia64_global_tlb_purge(vadr,vadr+addr_range,PAGE_SHIFT);
        vcpu_purge_tr_entry(&PSCB(vcpu,dtlb));
        vcpu_purge_tr_entry(&PSCB(vcpu,itlb));
diff -Nru a/xen/arch/ia64/vhpt.c b/xen/arch/ia64/vhpt.c
--- a/xen/arch/ia64/vhpt.c      2005-04-01 19:02:56 -05:00
+++ b/xen/arch/ia64/vhpt.c      2005-04-01 19:02:56 -05:00
@@ -20,7 +20,7 @@
 void vhpt_flush(void)
 {
        struct vhpt_lf_entry *v = (void *)VHPT_ADDR;
-       int i;
+       int i, cnt = 0;
 
        for (i = 0; i < VHPT_NUM_ENTRIES; i++, v++) {
                v->itir = 0;
@@ -30,6 +30,39 @@
        }
        // initialize cache too???
 }
+
+#ifdef VHPT_GLOBAL
+void vhpt_flush_address(unsigned long vadr, unsigned long addr_range)
+{
+       unsigned long ps;
+       struct vhpt_lf_entry *vlfe;
+
+       if ((vadr >> 61) == 7) {
+               // no vhpt for region 7 yet, see vcpu_itc_no_srlz
+               printf("vhpt_flush_address: region 7, spinning...\n");
+               while(1);
+       }
+#if 0
+       // this only seems to occur at shutdown, but it does occur
+       if ((!addr_range) || addr_range & (addr_range - 1)) {
+               printf("vhpt_flush_address: weird range, spinning...\n");
+               while(1);
+       }
+//printf("************** vhpt_flush_address(%p,%p)\n",vadr,addr_range);
+#endif
+       while ((long)addr_range > 0) {
+               vlfe = (struct vhpt_lf_entry *)ia64_thash(vadr);
+               // FIXME: for now, just blow it away even if it belongs to
+               // another domain.  Later, use ttag to check for match
+//if (!(vlfe->ti_tag & INVALID_TI_TAG)) {
+//printf("vhpt_flush_address: blowing away valid tag for vadr=%p\n",vadr);
+//}
+               vlfe->ti_tag |= INVALID_TI_TAG;
+               addr_range -= PAGE_SIZE;
+               vadr += PAGE_SIZE;
+       }
+}
+#endif
 
 void vhpt_map(void)
 {
diff -Nru a/xen/arch/ia64/xenasm.S b/xen/arch/ia64/xenasm.S
--- a/xen/arch/ia64/xenasm.S    2005-04-01 19:02:56 -05:00
+++ b/xen/arch/ia64/xenasm.S    2005-04-01 19:02:56 -05:00
@@ -465,3 +465,16 @@
 stacked:
        br.ret.sptk.few rp
 END(pal_emulator_static)
+
+GLOBAL_ENTRY(vhpt_insert)
+//     alloc loc0 = ar.pfs, 3, 1, 0, 0
+       mov r16=r32
+       mov r26=r33
+       mov r27=r34
+       ;;
+       VHPT_INSERT()
+//     VHPT_INSERT1()  ... add collision chains later
+//     mov ar.pfs = loc0
+       br.ret.sptk.few rp
+       ;;
+END(vhpt_insert)
diff -Nru a/xen/arch/ia64/xensetup.c b/xen/arch/ia64/xensetup.c
--- a/xen/arch/ia64/xensetup.c  2005-04-01 19:02:57 -05:00
+++ b/xen/arch/ia64/xensetup.c  2005-04-01 19:02:57 -05:00
@@ -309,7 +309,8 @@
     /* The stash space for the initial kernel image can now be freed up. */
     init_domheap_pages(ia64_boot_param->initrd_start,
                       ia64_boot_param->initrd_start + 
ia64_boot_param->initrd_size);
-    scrub_heap_pages();
+    if (!running_on_sim)  // slow on ski and pages are pre-initialized to zero
+       scrub_heap_pages();
 
 printk("About to call init_trace_bufs()\n");
     init_trace_bufs();
diff -Nru a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     2005-04-01 19:02:56 -05:00
+++ b/xen/include/asm-ia64/config.h     2005-04-01 19:02:56 -05:00
@@ -2,6 +2,7 @@
 #undef CLONE_DOMAIN0
 //#define CLONE_DOMAIN0 5
 #define DOMU_BUILD_STAGING
+#define VHPT_GLOBAL
 
 // manufactured from component pieces
 
diff -Nru a/xen/include/asm-ia64/vhpt.h b/xen/include/asm-ia64/vhpt.h
--- a/xen/include/asm-ia64/vhpt.h       2005-04-01 19:02:56 -05:00
+++ b/xen/include/asm-ia64/vhpt.h       2005-04-01 19:02:56 -05:00
@@ -19,6 +19,7 @@
 //#define      VHPT_NUM_ENTRIES                131072
 //#define      VHPT_CACHE_MASK                 131071
 //#define      VHPT_SIZE_LOG2                  22      //????
+#define        VHPT_CACHE_ENTRY_SIZE           64
 #define        VHPT_CACHE_NUM_ENTRIES          8192
 #define        VHPT_NUM_ENTRIES                524288
 #define        VHPT_CACHE_MASK                 524287
@@ -353,7 +354,7 @@
                and r23 = r23, r24;\
 \
 \
-               movl r17 = G_VHPT_Cache;\
+               movl r17 = VHPT_ADDR;\
                ;;\
 \
 \

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.