Merge branch 'topic/ice1724-pm' into for-linus
[pandora-kernel.git] / arch / ia64 / kvm / vcpu.c
index a18ee17..cc406d0 100644 (file)
@@ -406,7 +406,7 @@ void getreg(unsigned long regnum, unsigned long *val,
         * Now look at registers in [0-31] range and init correct UNAT
         */
        addr = (unsigned long)regs;
-       unat = &regs->eml_unat;;
+       unat = &regs->eml_unat;
 
        addr += gr_info[regnum];
 
@@ -461,7 +461,7 @@ void setreg(unsigned long regnum, unsigned long val,
 u64 vcpu_get_gr(struct kvm_vcpu *vcpu, unsigned long reg)
 {
        struct kvm_pt_regs *regs = vcpu_regs(vcpu);
-       u64 val;
+       unsigned long val;
 
        if (!reg)
                return 0;
@@ -469,7 +469,7 @@ u64 vcpu_get_gr(struct kvm_vcpu *vcpu, unsigned long reg)
        return val;
 }
 
-void vcpu_set_gr(struct kvm_vcpu *vcpu, u64 reg, u64 value, int nat)
+void vcpu_set_gr(struct kvm_vcpu *vcpu, unsigned long reg, u64 value, int nat)
 {
        struct kvm_pt_regs *regs = vcpu_regs(vcpu);
        long sof = (regs->cr_ifs) & 0x7f;
@@ -788,13 +788,29 @@ void vcpu_set_fpreg(struct kvm_vcpu *vcpu, unsigned long reg,
                setfpreg(reg, val, regs);   /* FIXME: handle NATs later*/
 }
 
+/*
+ * The Altix RTC is mapped specially here for the vmm module
+ */
+#define SN_RTC_BASE    (u64 *)(KVM_VMM_BASE+(1UL<<KVM_VMM_SHIFT))
+static long kvm_get_itc(struct kvm_vcpu *vcpu)
+{
+#if defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
+       struct kvm *kvm = (struct kvm *)KVM_VM_BASE;
+
+       if (kvm->arch.is_sn2)
+               return (*SN_RTC_BASE);
+       else
+#endif
+               return ia64_getreg(_IA64_REG_AR_ITC);
+}
+
 /************************************************************************
  * lsapic timer
  ***********************************************************************/
 u64 vcpu_get_itc(struct kvm_vcpu *vcpu)
 {
        unsigned long guest_itc;
-       guest_itc = VMX(vcpu, itc_offset) + ia64_getreg(_IA64_REG_AR_ITC);
+       guest_itc = VMX(vcpu, itc_offset) + kvm_get_itc(vcpu);
 
        if (guest_itc >= VMX(vcpu, last_itc)) {
                VMX(vcpu, last_itc) = guest_itc;
@@ -809,7 +825,7 @@ static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val)
        struct kvm_vcpu *v;
        struct kvm *kvm;
        int i;
-       long itc_offset = val - ia64_getreg(_IA64_REG_AR_ITC);
+       long itc_offset = val - kvm_get_itc(vcpu);
        unsigned long vitv = VCPU(vcpu, itv);
 
        kvm = (struct kvm *)KVM_VM_BASE;
@@ -1056,7 +1072,7 @@ void kvm_ttag(struct kvm_vcpu *vcpu, INST64 inst)
        vcpu_set_gr(vcpu, inst.M46.r1, tag, 0);
 }
 
-int vcpu_tpa(struct kvm_vcpu *vcpu, u64 vadr, u64 *padr)
+int vcpu_tpa(struct kvm_vcpu *vcpu, u64 vadr, unsigned long *padr)
 {
        struct thash_data *data;
        union ia64_isr visr, pt_isr;