Message ID | 20191220195135.20130-3-liuwe@microsoft.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Clean up viridian code | expand |
> -----Original Message----- > From: Wei Liu <wei.liu.xen@gmail.com> On Behalf Of Wei Liu > Sent: 20 December 2019 19:52 > To: Xen Development List <xen-devel@lists.xenproject.org> > Cc: Michael Kelley <mikelley@microsoft.com>; Durrant, Paul > <pdurrant@amazon.com>; Wei Liu <liuwe@microsoft.com>; Paul Durrant > <paul@xen.org>; Jan Beulich <jbeulich@suse.com>; Andrew Cooper > <andrew.cooper3@citrix.com>; Wei Liu <wl@xen.org>; Roger Pau Monné > <roger.pau@citrix.com> > Subject: [PATCH 2/4] x86/viridian: drop private copy of > HV_REFERENCE_TSC_PAGE in time.c > > Use the one defined in hyperv-tlfs.h instead. No functional change > intended. > > Signed-off-by: Wei Liu <liuwe@microsoft.com> Reviewed-by: Paul Durrant <paul@xen.org> > --- > xen/arch/x86/hvm/viridian/time.c | 20 ++++++-------------- > 1 file changed, 6 insertions(+), 14 deletions(-) > > diff --git a/xen/arch/x86/hvm/viridian/time.c > b/xen/arch/x86/hvm/viridian/time.c > index 6ddca29b29..32e79bbcc4 100644 > --- a/xen/arch/x86/hvm/viridian/time.c > +++ b/xen/arch/x86/hvm/viridian/time.c > @@ -13,19 +13,11 @@ > > #include <asm/apic.h> > #include <asm/event.h> > +#include <asm/guest/hyperv-tlfs.h> > #include <asm/hvm/support.h> > > #include "private.h" > > -typedef struct _HV_REFERENCE_TSC_PAGE > -{ > - uint32_t TscSequence; > - uint32_t Reserved1; > - uint64_t TscScale; > - int64_t TscOffset; > - uint64_t Reserved2[509]; > -} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE; > - > static void update_reference_tsc(const struct domain *d, bool initialize) > { > struct viridian_domain *vd = d->arch.hvm.viridian; > @@ -61,7 +53,7 @@ static void update_reference_tsc(const struct domain *d, > bool initialize) > * violate the spec. and rely on a value of 0 to indicate that > this > * enlightenment should no longer be used. > */ > - p->TscSequence = 0; > + p->tsc_sequence = 0; > > printk(XENLOG_G_INFO "d%d: VIRIDIAN REFERENCE_TSC: > invalidated\n", > d->domain_id); > @@ -79,15 +71,15 @@ static void update_reference_tsc(const struct domain > *d, bool initialize) > * The offset value is calculated on restore after migration and > * ensures that Windows will not see a large jump in ReferenceTime. > */ > - p->TscScale = ((10000ul << 32) / d->arch.tsc_khz) << 32; > - p->TscOffset = trc->off; > + p->tsc_scale = ((10000ul << 32) / d->arch.tsc_khz) << 32; > + p->tsc_offset = trc->off; > smp_wmb(); > > - seq = p->TscSequence + 1; > + seq = p->tsc_sequence + 1; > if ( seq == 0xFFFFFFFF || seq == 0 ) /* Avoid both 'invalid' values > */ > seq = 1; > > - p->TscSequence = seq; > + p->tsc_sequence = seq; > } > > /* > -- > 2.20.1
diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c index 6ddca29b29..32e79bbcc4 100644 --- a/xen/arch/x86/hvm/viridian/time.c +++ b/xen/arch/x86/hvm/viridian/time.c @@ -13,19 +13,11 @@ #include <asm/apic.h> #include <asm/event.h> +#include <asm/guest/hyperv-tlfs.h> #include <asm/hvm/support.h> #include "private.h" -typedef struct _HV_REFERENCE_TSC_PAGE -{ - uint32_t TscSequence; - uint32_t Reserved1; - uint64_t TscScale; - int64_t TscOffset; - uint64_t Reserved2[509]; -} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE; - static void update_reference_tsc(const struct domain *d, bool initialize) { struct viridian_domain *vd = d->arch.hvm.viridian; @@ -61,7 +53,7 @@ static void update_reference_tsc(const struct domain *d, bool initialize) * violate the spec. and rely on a value of 0 to indicate that this * enlightenment should no longer be used. */ - p->TscSequence = 0; + p->tsc_sequence = 0; printk(XENLOG_G_INFO "d%d: VIRIDIAN REFERENCE_TSC: invalidated\n", d->domain_id); @@ -79,15 +71,15 @@ static void update_reference_tsc(const struct domain *d, bool initialize) * The offset value is calculated on restore after migration and * ensures that Windows will not see a large jump in ReferenceTime. */ - p->TscScale = ((10000ul << 32) / d->arch.tsc_khz) << 32; - p->TscOffset = trc->off; + p->tsc_scale = ((10000ul << 32) / d->arch.tsc_khz) << 32; + p->tsc_offset = trc->off; smp_wmb(); - seq = p->TscSequence + 1; + seq = p->tsc_sequence + 1; if ( seq == 0xFFFFFFFF || seq == 0 ) /* Avoid both 'invalid' values */ seq = 1; - p->TscSequence = seq; + p->tsc_sequence = seq; } /*
Use the one defined in hyperv-tlfs.h instead. No functional change intended. Signed-off-by: Wei Liu <liuwe@microsoft.com> --- xen/arch/x86/hvm/viridian/time.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)