Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146497
b: refs/heads/master
c: ce17c64
h: refs/heads/master
i:
  146495: 3a9e2ad
v: v3
  • Loading branch information
Jes Sorensen authored and Avi Kivity committed Jun 10, 2009
1 parent 5d41deb commit 0a017cd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c6c9fcdf0fff7da77c088be11e3c4d0181b36941
refs/heads/master: ce17c643738bebcacf8d19d8cab7dd3eb96f9f32
28 changes: 27 additions & 1 deletion trunk/arch/ia64/kvm/kvm_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#include <linux/kvm_host.h>
#include <linux/smp.h>
#include <asm/sn/addrs.h>
#include <asm/sn/clksupport.h>
#include <asm/sn/shub_mmr.h>

#include "vti.h"
#include "misc.h"
Expand Down Expand Up @@ -188,12 +191,35 @@ static struct ia64_pal_retval pal_freq_base(struct kvm_vcpu *vcpu)
return result;
}

static struct ia64_pal_retval pal_freq_ratios(struct kvm_vcpu *vcpu)
/*
* On the SGI SN2, the ITC isn't stable. Emulation backed by the SN2
* RTC is used instead. This function patches the ratios from SAL
* to match the RTC before providing them to the guest.
*/
static void sn2_patch_itc_freq_ratios(struct ia64_pal_retval *result)
{
struct pal_freq_ratio *ratio;
unsigned long sal_freq, sal_drift, factor;

result->status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
&sal_freq, &sal_drift);
ratio = (struct pal_freq_ratio *)&result->v2;
factor = ((sal_freq * 3) + (sn_rtc_cycles_per_second / 2)) /
sn_rtc_cycles_per_second;

ratio->num = 3;
ratio->den = factor;
}

static struct ia64_pal_retval pal_freq_ratios(struct kvm_vcpu *vcpu)
{
struct ia64_pal_retval result;

PAL_CALL(result, PAL_FREQ_RATIOS, 0, 0, 0);

if (vcpu->kvm->arch.is_sn2)
sn2_patch_itc_freq_ratios(&result);

return result;
}

Expand Down

0 comments on commit 0a017cd

Please sign in to comment.