On 28/09/2015 07:38, Haozhong Zhang wrote:
>
> -static u64 __scale_tsc(u64 ratio, u64 tsc)
> -{
> - u64 mult, frac, _tsc;
> -
> - mult = ratio >> 32;
> - frac = ratio & ((1ULL << 32) - 1);
> -
> - _tsc = tsc;
> - _tsc *= mult;
> - _tsc += (tsc >> 32) * frac;
> -
On Mon, Sep 28, 2015 at 10:12:37PM +0200, Paolo Bonzini wrote:
>
>
> On 28/09/2015 07:38, Haozhong Zhang wrote:
> >
> > -static u64 __scale_tsc(u64 ratio, u64 tsc)
> > -{
> > - u64 mult, frac, _tsc;
> > -
> > - mult = ratio >> 32;
> > - frac = ratio & ((1ULL << 32) - 1);
> > -
> > -
VMX and SVM calculate the TSC scaling ratio in a similar logic, so this
patch generalizes it to a common TSC scaling function.
Signed-off-by: Haozhong Zhang
---
arch/x86/kvm/svm.c | 48 +++--
arch/x86/kvm/x86.c | 70