Skip to content

Commit 7357b1d

Browse files
kelleymhliuw
authored andcommitted
KVM: x86: hyperv: Remove duplicate definitions of Reference TSC Page
The Hyper-V Reference TSC Page structure is defined twice. struct ms_hyperv_tsc_page has padding out to a full 4 Kbyte page size. But the padding is not needed because the declaration includes a union with HV_HYP_PAGE_SIZE. KVM uses the second definition, which is struct _HV_REFERENCE_TSC_PAGE, because it does not have the padding. Fix the duplication by removing the padding from ms_hyperv_tsc_page. Fix up the KVM code to use it. Remove the no longer used struct _HV_REFERENCE_TSC_PAGE. There is no functional change. Signed-off-by: Michael Kelley <[email protected]> Acked-by: Paolo Bonzini <[email protected]> Reviewed-by: Vitaly Kuznetsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent 677b0ce commit 7357b1d

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

arch/x86/include/asm/hyperv-tlfs.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ struct ms_hyperv_tsc_page {
303303
u32 reserved1;
304304
volatile u64 tsc_scale;
305305
volatile s64 tsc_offset;
306-
u64 reserved2[509];
307306
} __packed;
308307

309308
/*
@@ -433,13 +432,6 @@ enum HV_GENERIC_SET_FORMAT {
433432
*/
434433
#define HV_CLOCK_HZ (NSEC_PER_SEC/100)
435434

436-
typedef struct _HV_REFERENCE_TSC_PAGE {
437-
__u32 tsc_sequence;
438-
__u32 res1;
439-
__u64 tsc_scale;
440-
__s64 tsc_offset;
441-
} __packed HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE;
442-
443435
/* Define the number of synthetic interrupt sources. */
444436
#define HV_SYNIC_SINT_COUNT (16)
445437
/* Define the expected SynIC version. */

arch/x86/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ struct kvm_hv {
865865
u64 hv_crash_param[HV_X64_MSR_CRASH_PARAMS];
866866
u64 hv_crash_ctl;
867867

868-
HV_REFERENCE_TSC_PAGE tsc_ref;
868+
struct ms_hyperv_tsc_page tsc_ref;
869869

870870
struct idr conn_to_evt;
871871

arch/x86/kvm/hyperv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static int kvm_hv_msr_set_crash_data(struct kvm_vcpu *vcpu,
900900
* These two equivalencies are implemented in this function.
901901
*/
902902
static bool compute_tsc_page_parameters(struct pvclock_vcpu_time_info *hv_clock,
903-
HV_REFERENCE_TSC_PAGE *tsc_ref)
903+
struct ms_hyperv_tsc_page *tsc_ref)
904904
{
905905
u64 max_mul;
906906

@@ -941,7 +941,7 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm,
941941
u64 gfn;
942942

943943
BUILD_BUG_ON(sizeof(tsc_seq) != sizeof(hv->tsc_ref.tsc_sequence));
944-
BUILD_BUG_ON(offsetof(HV_REFERENCE_TSC_PAGE, tsc_sequence) != 0);
944+
BUILD_BUG_ON(offsetof(struct ms_hyperv_tsc_page, tsc_sequence) != 0);
945945

946946
if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE))
947947
return;

0 commit comments

Comments
 (0)