[IA64] cleanup
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 16 Jun 2006 15:06:40 +0000 (09:06 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 16 Jun 2006 15:06:40 +0000 (09:06 -0600)
Disable a privify path.
Cleanup: warnings and static.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
xen/arch/ia64/linux-xen/time.c
xen/arch/ia64/vmx/vmmu.c
xen/arch/ia64/xen/faults.c
xen/arch/ia64/xen/privop.c
xen/include/asm-ia64/config.h

index 972a6a51170942018a7c100c17756bef50acd305..c84513ed64de8296a8c5f07d1e32b0192df63559 100644 (file)
@@ -204,7 +204,12 @@ ia64_init_itm (void)
        printk(KERN_DEBUG "CPU %d: base freq=%lu.%03luMHz, ITC ratio=%lu/%lu, "
               "ITC freq=%lu.%03luMHz", smp_processor_id(),
               platform_base_freq / 1000000, (platform_base_freq / 1000) % 1000,
+#ifdef XEN
+              (u64)itc_ratio.num, (u64)itc_ratio.den,
+              itc_freq / 1000000, (itc_freq / 1000) % 1000);
+#else
               itc_ratio.num, itc_ratio.den, itc_freq / 1000000, (itc_freq / 1000) % 1000);
+#endif
 
        if (platform_base_drift != -1) {
                itc_drift = platform_base_drift*itc_ratio.num/itc_ratio.den;
index c6ec77f1e4a38e2fd43c319bd521c3e9d99a12dd..dd058cafd435c2fb090cbe39cbadadf482c5046f 100644 (file)
@@ -504,16 +504,18 @@ struct ptc_ga_args {
 static void ptc_ga_remote_func (void *varg)
 {
     u64 oldrid, moldrid;
-    VCPU *v;
     struct ptc_ga_args *args = (struct ptc_ga_args *)varg;
-    v = args->vcpu;
+    VCPU *v = args->vcpu;
+
     oldrid = VMX(v, vrr[0]);
     VMX(v, vrr[0]) = args->rid;
     moldrid = ia64_get_rr(0x0);
     ia64_set_rr(0x0,vrrtomrr(v,args->rid));
+    ia64_srlz_d();
     vmx_vcpu_ptc_l(v, args->vadr, args->ps);
     VMX(v, vrr[0]) = oldrid; 
     ia64_set_rr(0x0,moldrid);
+    ia64_dv_serialize_data();
 }
 
 
index 7b436975725239705a33f69ea17662cd15b8bce6..7e74c0130708c22ad7f3663bb488d0d445eeae0d 100644 (file)
@@ -372,14 +372,16 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
 {
        struct pt_regs *regs = (struct pt_regs *) &stack;
        unsigned long code;
-       static const char *reason[] = {
+       static const char * const reason[] = {
                "IA-64 Illegal Operation fault",
                "IA-64 Privileged Operation fault",
                "IA-64 Privileged Register fault",
                "IA-64 Reserved Register/Field fault",
                "Disabled Instruction Set Transition fault",
-               "Unknown fault 5", "Unknown fault 6", "Unknown fault 7", "Illegal Hazard fault",
-               "Unknown fault 9", "Unknown fault 10", "Unknown fault 11", "Unknown fault 12",
+               "Unknown fault 5", "Unknown fault 6",
+               "Unknown fault 7", "Illegal Hazard fault",
+               "Unknown fault 9", "Unknown fault 10",
+               "Unknown fault 11", "Unknown fault 12",
                "Unknown fault 13", "Unknown fault 14", "Unknown fault 15"
        };
 
@@ -566,10 +568,6 @@ ia64_handle_privop (unsigned long ifa, struct pt_regs *regs, unsigned long isr,
        }
 }
 
-/* Used in vhpt.h.  */
-#define INTR_TYPE_MAX  10
-UINT64 int_counts[INTR_TYPE_MAX];
-
 void
 ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long isr, unsigned long iim, unsigned long vector)
 {
@@ -578,7 +576,7 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i
        unsigned long psr = regs->cr_ipsr;
 
        /* Following faults shouldn'g be seen from Xen itself */
-       if (!(psr & IA64_PSR_CPL)) BUG();
+       BUG_ON (!(psr & IA64_PSR_CPL));
 
        switch(vector) {
            case 8:
@@ -601,6 +599,7 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i
                break;
            case 26:
                if (((isr >> 4L) & 0xfL) == 1) {
+                       /* Fault is due to a register NaT consumption fault. */
                        //regs->eml_unat = 0;  FIXME: DO WE NEED THIS??
                        printf("ia64_handle_reflection: handling regNaT fault\n");
                        vector = IA64_NAT_CONSUMPTION_VECTOR; break;
@@ -612,6 +611,9 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i
                        vector = IA64_NAT_CONSUMPTION_VECTOR; break;
                }
 #endif
+#ifdef CONFIG_PRIVIFY
+               /* Some privified operations are coded using reg+64 instead
+                  of reg.  */
                printf("*** NaT fault... attempting to handle as privop\n");
                printf("isr=%016lx, ifa=%016lx, iip=%016lx, ipsr=%016lx\n",
                       isr, ifa, regs->cr_iip, psr);
@@ -622,6 +624,7 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i
                        printf("*** Handled privop masquerading as NaT fault\n");
                        return;
                }
+#endif
                vector = IA64_NAT_CONSUMPTION_VECTOR; break;
            case 27:
                //printf("*** Handled speculation vector, itc=%lx!\n",ia64_get_itc());
index 60739872abf1a7f8324b747f438027f37e5de048..7a1d9f427c8d9abf11b4f8a476d0914e4593bf71 100644 (file)
@@ -12,7 +12,6 @@
 #include <asm/delay.h> // Debug only
 #include <asm/dom_fw.h>
 #include <asm/vhpt.h>
-//#include <debug.h>
 
 /* FIXME: where these declarations should be there ? */
 extern int dump_reflect_counts(char *);
@@ -21,13 +20,16 @@ extern void zero_reflect_counts(void);
 long priv_verbose=0;
 
 /* Set to 1 to handle privified instructions from the privify tool. */
+#ifndef CONFIG_PRIVIFY
 static const int privify_en = 0;
+#else
+static const int privify_en = 1;
+#endif
 
 /**************************************************************************
 Hypercall bundle creation
 **************************************************************************/
 
-
 void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, UINT64 ret)
 {
        INST64_A5 slot0;
@@ -106,27 +108,27 @@ void build_pal_hypercall_bundles(UINT64 *imva, UINT64 brkimm, UINT64 hypnum)
 Privileged operation emulation routines
 **************************************************************************/
 
-IA64FAULT priv_rfi(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_rfi(VCPU *vcpu, INST64 inst)
 {
        return vcpu_rfi(vcpu);
 }
 
-IA64FAULT priv_bsw0(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_bsw0(VCPU *vcpu, INST64 inst)
 {
        return vcpu_bsw0(vcpu);
 }
 
-IA64FAULT priv_bsw1(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_bsw1(VCPU *vcpu, INST64 inst)
 {
        return vcpu_bsw1(vcpu);
 }
 
-IA64FAULT priv_cover(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_cover(VCPU *vcpu, INST64 inst)
 {
        return vcpu_cover(vcpu);
 }
 
-IA64FAULT priv_ptc_l(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ptc_l(VCPU *vcpu, INST64 inst)
 {
        UINT64 vadr = vcpu_get_gr(vcpu,inst.M45.r3);
        UINT64 log_range;
@@ -135,7 +137,7 @@ IA64FAULT priv_ptc_l(VCPU *vcpu, INST64 inst)
        return vcpu_ptc_l(vcpu,vadr,log_range);
 }
 
-IA64FAULT priv_ptc_e(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ptc_e(VCPU *vcpu, INST64 inst)
 {
        UINT src = inst.M28.r3;
 
@@ -145,7 +147,7 @@ IA64FAULT priv_ptc_e(VCPU *vcpu, INST64 inst)
        return vcpu_ptc_e(vcpu,vcpu_get_gr(vcpu,src));
 }
 
-IA64FAULT priv_ptc_g(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ptc_g(VCPU *vcpu, INST64 inst)
 {
        UINT64 vadr = vcpu_get_gr(vcpu,inst.M45.r3);
        UINT64 addr_range;
@@ -154,7 +156,7 @@ IA64FAULT priv_ptc_g(VCPU *vcpu, INST64 inst)
        return vcpu_ptc_g(vcpu,vadr,addr_range);
 }
 
-IA64FAULT priv_ptc_ga(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ptc_ga(VCPU *vcpu, INST64 inst)
 {
        UINT64 vadr = vcpu_get_gr(vcpu,inst.M45.r3);
        UINT64 addr_range;
@@ -163,7 +165,7 @@ IA64FAULT priv_ptc_ga(VCPU *vcpu, INST64 inst)
        return vcpu_ptc_ga(vcpu,vadr,addr_range);
 }
 
-IA64FAULT priv_ptr_d(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ptr_d(VCPU *vcpu, INST64 inst)
 {
        UINT64 vadr = vcpu_get_gr(vcpu,inst.M45.r3);
        UINT64 log_range;
@@ -172,7 +174,7 @@ IA64FAULT priv_ptr_d(VCPU *vcpu, INST64 inst)
        return vcpu_ptr_d(vcpu,vadr,log_range);
 }
 
-IA64FAULT priv_ptr_i(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ptr_i(VCPU *vcpu, INST64 inst)
 {
        UINT64 vadr = vcpu_get_gr(vcpu,inst.M45.r3);
        UINT64 log_range;
@@ -181,7 +183,7 @@ IA64FAULT priv_ptr_i(VCPU *vcpu, INST64 inst)
        return vcpu_ptr_i(vcpu,vadr,log_range);
 }
 
-IA64FAULT priv_tpa(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_tpa(VCPU *vcpu, INST64 inst)
 {
        UINT64 padr;
        UINT fault;
@@ -196,7 +198,7 @@ IA64FAULT priv_tpa(VCPU *vcpu, INST64 inst)
        else return fault;
 }
 
-IA64FAULT priv_tak(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_tak(VCPU *vcpu, INST64 inst)
 {
        UINT64 key;
        UINT fault;
@@ -215,7 +217,7 @@ IA64FAULT priv_tak(VCPU *vcpu, INST64 inst)
  * Insert translation register/cache
 ************************************/
 
-IA64FAULT priv_itr_d(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_itr_d(VCPU *vcpu, INST64 inst)
 {
        UINT64 fault, itir, ifa, pte, slot;
 
@@ -230,7 +232,7 @@ IA64FAULT priv_itr_d(VCPU *vcpu, INST64 inst)
        return (vcpu_itr_d(vcpu,slot,pte,itir,ifa));
 }
 
-IA64FAULT priv_itr_i(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_itr_i(VCPU *vcpu, INST64 inst)
 {
        UINT64 fault, itir, ifa, pte, slot;
 
@@ -245,7 +247,7 @@ IA64FAULT priv_itr_i(VCPU *vcpu, INST64 inst)
        return (vcpu_itr_i(vcpu,slot,pte,itir,ifa));
 }
 
-IA64FAULT priv_itc_d(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_itc_d(VCPU *vcpu, INST64 inst)
 {
        UINT64 fault, itir, ifa, pte;
 
@@ -259,7 +261,7 @@ IA64FAULT priv_itc_d(VCPU *vcpu, INST64 inst)
        return (vcpu_itc_d(vcpu,pte,itir,ifa));
 }
 
-IA64FAULT priv_itc_i(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_itc_i(VCPU *vcpu, INST64 inst)
 {
        UINT64 fault, itir, ifa, pte;
 
@@ -277,7 +279,7 @@ IA64FAULT priv_itc_i(VCPU *vcpu, INST64 inst)
  * Moves to semi-privileged registers
 *************************************/
 
-IA64FAULT priv_mov_to_ar_imm(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_ar_imm(VCPU *vcpu, INST64 inst)
 {
        // I27 and M30 are identical for these fields
        UINT64 ar3 = inst.M30.ar3;
@@ -285,7 +287,7 @@ IA64FAULT priv_mov_to_ar_imm(VCPU *vcpu, INST64 inst)
        return (vcpu_set_ar(vcpu,ar3,imm));
 }
 
-IA64FAULT priv_mov_to_ar_reg(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_ar_reg(VCPU *vcpu, INST64 inst)
 {
        // I26 and M29 are identical for these fields
        UINT64 ar3 = inst.M29.ar3;
@@ -307,42 +309,42 @@ IA64FAULT priv_mov_to_ar_reg(VCPU *vcpu, INST64 inst)
  * Moves to privileged registers
 ********************************/
 
-IA64FAULT priv_mov_to_pkr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_pkr(VCPU *vcpu, INST64 inst)
 {
        UINT64 r3 = vcpu_get_gr(vcpu,inst.M42.r3);
        UINT64 r2 = vcpu_get_gr(vcpu,inst.M42.r2);
        return (vcpu_set_pkr(vcpu,r3,r2));
 }
 
-IA64FAULT priv_mov_to_rr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_rr(VCPU *vcpu, INST64 inst)
 {
        UINT64 r3 = vcpu_get_gr(vcpu,inst.M42.r3);
        UINT64 r2 = vcpu_get_gr(vcpu,inst.M42.r2);
        return (vcpu_set_rr(vcpu,r3,r2));
 }
 
-IA64FAULT priv_mov_to_dbr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_dbr(VCPU *vcpu, INST64 inst)
 {
        UINT64 r3 = vcpu_get_gr(vcpu,inst.M42.r3);
        UINT64 r2 = vcpu_get_gr(vcpu,inst.M42.r2);
        return (vcpu_set_dbr(vcpu,r3,r2));
 }
 
-IA64FAULT priv_mov_to_ibr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_ibr(VCPU *vcpu, INST64 inst)
 {
        UINT64 r3 = vcpu_get_gr(vcpu,inst.M42.r3);
        UINT64 r2 = vcpu_get_gr(vcpu,inst.M42.r2);
        return (vcpu_set_ibr(vcpu,r3,r2));
 }
 
-IA64FAULT priv_mov_to_pmc(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_pmc(VCPU *vcpu, INST64 inst)
 {
        UINT64 r3 = vcpu_get_gr(vcpu,inst.M42.r3);
        UINT64 r2 = vcpu_get_gr(vcpu,inst.M42.r2);
        return (vcpu_set_pmc(vcpu,r3,r2));
 }
 
-IA64FAULT priv_mov_to_pmd(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_pmd(VCPU *vcpu, INST64 inst)
 {
        UINT64 r3 = vcpu_get_gr(vcpu,inst.M42.r3);
        UINT64 r2 = vcpu_get_gr(vcpu,inst.M42.r2);
@@ -351,7 +353,7 @@ IA64FAULT priv_mov_to_pmd(VCPU *vcpu, INST64 inst)
 
 unsigned long to_cr_cnt[128] = { 0 };
 
-IA64FAULT priv_mov_to_cr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_cr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val = vcpu_get_gr(vcpu, inst.M32.r2);
        to_cr_cnt[inst.M32.cr3]++;
@@ -386,13 +388,13 @@ IA64FAULT priv_mov_to_cr(VCPU *vcpu, INST64 inst)
        }
 }
 
-IA64FAULT priv_rsm(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_rsm(VCPU *vcpu, INST64 inst)
 {
        UINT64 imm24 = (inst.M44.i<<23)|(inst.M44.i2<<21)|inst.M44.imm;
        return vcpu_reset_psr_sm(vcpu,imm24);
 }
 
-IA64FAULT priv_ssm(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_ssm(VCPU *vcpu, INST64 inst)
 {
        UINT64 imm24 = (inst.M44.i<<23)|(inst.M44.i2<<21)|inst.M44.imm;
        return vcpu_set_psr_sm(vcpu,imm24);
@@ -401,7 +403,7 @@ IA64FAULT priv_ssm(VCPU *vcpu, INST64 inst)
 /**
  * @todo Check for reserved bits and return IA64_RSVDREG_FAULT.
  */
-IA64FAULT priv_mov_to_psr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_to_psr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val = vcpu_get_gr(vcpu, inst.M35.r2);
        return vcpu_set_psr_l(vcpu,val);
@@ -411,7 +413,7 @@ IA64FAULT priv_mov_to_psr(VCPU *vcpu, INST64 inst)
  * Moves from privileged registers
  **********************************/
 
-IA64FAULT priv_mov_from_rr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_rr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val;
        IA64FAULT fault;
@@ -432,7 +434,7 @@ IA64FAULT priv_mov_from_rr(VCPU *vcpu, INST64 inst)
        return fault;
 }
 
-IA64FAULT priv_mov_from_pkr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_pkr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val;
        IA64FAULT fault;
@@ -443,7 +445,7 @@ IA64FAULT priv_mov_from_pkr(VCPU *vcpu, INST64 inst)
        else return fault;
 }
 
-IA64FAULT priv_mov_from_dbr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_dbr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val;
        IA64FAULT fault;
@@ -454,7 +456,7 @@ IA64FAULT priv_mov_from_dbr(VCPU *vcpu, INST64 inst)
        else return fault;
 }
 
-IA64FAULT priv_mov_from_ibr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_ibr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val;
        IA64FAULT fault;
@@ -465,7 +467,7 @@ IA64FAULT priv_mov_from_ibr(VCPU *vcpu, INST64 inst)
        else return fault;
 }
 
-IA64FAULT priv_mov_from_pmc(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_pmc(VCPU *vcpu, INST64 inst)
 {
        UINT64 val;
        IA64FAULT fault;
@@ -492,7 +494,7 @@ unsigned long from_cr_cnt[128] = { 0 };
        ((fault = vcpu_get_##cr(vcpu,&val)) == IA64_NO_FAULT) ? \
                vcpu_set_gr(vcpu, tgt, val, 0) : fault;
        
-IA64FAULT priv_mov_from_cr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_cr(VCPU *vcpu, INST64 inst)
 {
        UINT64 tgt = inst.M33.r1;
        UINT64 val;
@@ -531,7 +533,7 @@ IA64FAULT priv_mov_from_cr(VCPU *vcpu, INST64 inst)
        return IA64_ILLOP_FAULT;
 }
 
-IA64FAULT priv_mov_from_psr(VCPU *vcpu, INST64 inst)
+static IA64FAULT priv_mov_from_psr(VCPU *vcpu, INST64 inst)
 {
        UINT64 tgt = inst.M33.r1;
        UINT64 val;
@@ -601,7 +603,7 @@ struct {
 
 unsigned long privop_trace = 0;
 
-IA64FAULT
+static IA64FAULT
 priv_handle_op(VCPU *vcpu, REGS *regs, int privlvl)
 {
        IA64_BUNDLE bundle;
index 51b05e600bc939acfe51f5a7f6f8a7d1ac39e1a2..2749db731861d3a713d9e839503437c3a86401f2 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef        _IA64_CONFIG_H_
 #define _IA64_CONFIG_H_
 
-#undef USE_PAL_EMULATOR
-// control flags for turning on/off features under test
-#undef DOMU_BUILD_STAGING
 #define VHPT_GLOBAL
 
 #undef DEBUG_PFMON
@@ -170,12 +167,6 @@ void sort_extable(struct exception_table_entry *start,
                  struct exception_table_entry *finish);
 void sort_main_extable(void);
 
-#if 0 /* Already defined in xen/lib.h */
-#define printk printf
-#endif
-
-#undef  __ARCH_IRQ_STAT
-
 #define find_first_set_bit(x)  (ffs(x)-1)      // FIXME: Is this right???
 
 // see drivers/char/console.c
@@ -278,4 +269,7 @@ struct screen_info { };
    Old as doesn't handle this.  */
 #define HAVE_SERIALIZE_DIRECTIVE
 
+/* Define CONFIG_PRIVIFY to support privified OS (deprecated).  */
+#undef CONFIG_PRIVIFY
+
 #endif /* _IA64_CONFIG_H_ */