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

[Xen-changelog] Re-enable improved PAL code (time and perfmon work again). PAL code remapped



# HG changeset patch
# User djm@xxxxxxxxxxxxxxx
# Node ID 0e548ff36960d7a25e5d4b4b6ed3d4a08afe5bd5
# Parent  aecdccb1a35026aee872c5a0a7235bd6d74244ca
Re-enable improved PAL code (time and perfmon work again).  PAL code remapped
_lazily_ only when PAL called after rr7 changes.  Old PAL emulator can
be re-enabled with #define USE_PAL_EMULATOR in config.h.
Signed-off by: Dan Magenheimer <dan.magenheimer@xxxxxx>

diff -r aecdccb1a350 -r 0e548ff36960 xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c     Fri Sep 16 22:54:53 2005
+++ b/xen/arch/ia64/linux-xen/efi.c     Sun Sep 18 16:30:57 2005
@@ -525,7 +525,7 @@
 
 
 #ifdef XEN
-void *pal_vaddr;
+void *pal_vaddr = 0;
 #endif
 
 void
@@ -533,14 +533,39 @@
 {
 #ifdef XEN
        u64 psr;
-       pal_vaddr = efi_get_pal_addr ();
+       static unsigned long last_rr7 = 0;
+       unsigned long current_rr7 = ia64_get_rr(7L<<61);
+
+       // this routine is called only once in Linux but may be called
+       // multiple times in Xen.  However, we only need to flush and
+       // reset itr[IA64_TR_PALCODE] if rr7 changes
+       if (!pal_vaddr) {
+               pal_vaddr = efi_get_pal_addr ();
+               last_rr7 = current_rr7;
+       }
+       else if (last_rr7 == current_rr7) return;
+       else {
+               last_rr7 = current_rr7;
+               printk("efi_map_pal_code,remapping pal w/rr7=%lx\n",last_rr7);
+       }
+
+       printf("efi_map_pal_code: about to ia64_ptr(%d,%p,%p)\n",
+               0x1, GRANULEROUNDDOWN((unsigned long) pal_vaddr),
+                IA64_GRANULE_SHIFT);
+       ia64_ptr(0x1, GRANULEROUNDDOWN((unsigned long) pal_vaddr),
+                IA64_GRANULE_SHIFT);
+       ia64_srlz_i();
+       printf("efi_map_pal_code: about to ia64_itr(%p,%p,%p,%p,%p)\n",
+               0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) 
pal_vaddr),
+                pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
+                IA64_GRANULE_SHIFT);
 #else
        void *pal_vaddr = efi_get_pal_addr ();
        u64 psr;
-#endif
 
        if (!pal_vaddr)
                return;
+#endif
 
        /*
         * Cannot write to CRx with PSR.ic=1
diff -r aecdccb1a350 -r 0e548ff36960 xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c        Fri Sep 16 22:54:53 2005
+++ b/xen/arch/ia64/xen/dom_fw.c        Sun Sep 18 16:30:57 2005
@@ -291,16 +291,18 @@
        long r11 = 0;
        long status = -1;
 
-#define USE_PAL_EMULATOR
-#ifdef USE_PAL_EMULATOR
-       return pal_emulator_static(index);
-#endif
        if (running_on_sim) return pal_emulator_static(index);
        if (index >= PAL_COPY_PAL) {
-               printk("xen_pal_emulator: UNIMPLEMENTED PAL CALL %d!!!!\n",
-                               index);
-       }
-       else switch (index) {
+               // build_hypercall_bundle needs to be modified to generate
+               // a second bundle that conditionally does a br.ret
+               panic("xen_pal_emulator: stacked calls not supported!!\n");
+       }
+       printk("xen_pal_emulator: index=%d\n",index);
+       // pal code must be mapped by a TR when pal is called, however
+       // calls are rare enough that we will map it lazily rather than
+       // at every context switch
+       efi_map_pal_code();
+       switch (index) {
            case PAL_MEM_ATTRIB:
                status = ia64_pal_mem_attrib(&r9);
                break;
@@ -514,11 +516,12 @@
 */
        memset(fw_mem, 0, fw_mem_size);
 
-#ifdef XEN
+#ifdef USE_PAL_EMULATOR
+       pal_desc = (unsigned long *) &pal_emulator_static;
 #else
-       pal_desc = (unsigned long *) &pal_emulator_static;
+       pal_desc = (unsigned long *) &xen_pal_emulator;
+#endif
        sal_desc = (unsigned long *) &sal_emulator;
-#endif
 
        cp = fw_mem;
        efi_systab  = (void *) cp; cp += sizeof(*efi_systab);
diff -r aecdccb1a350 -r 0e548ff36960 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     Fri Sep 16 22:54:53 2005
+++ b/xen/include/asm-ia64/config.h     Sun Sep 18 16:30:57 2005
@@ -1,6 +1,7 @@
 #ifndef        _IA64_CONFIG_H_
 #define _IA64_CONFIG_H_
 
+#undef USE_PAL_EMULATOR
 // control flags for turning on/off features under test
 #undef CLONE_DOMAIN0
 //#define CLONE_DOMAIN0 1

_______________________________________________
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®.