Skip to content

Commit 668afda

Browse files
allenpaischessturo
authored andcommitted
arm64: hyperv: Fix build breakage for non-ARM64 architectures
Commit [arm64: hyperv: Enable Hyper-V synthetic clocks/timers] introduced changes to enable Hyper-V synthetic clocks and timers on ARM64. However, these upstream changes led to build breakage on ARM64 architectures due to the use of the '__bss_decrypted' section, which is not available on ARM64. To address this issue, this commit adds conditional compilation to use '__bss_decrypted' only on non-ARM64 architectures. The introduced '#ifdef CONFIG_ARM64' ensures that the code involving '__bss_decrypted' is not included when building for ARM64, preventing build failures. This modification allows the Hyper-V support code to be selectively applied, ensuring compatibility with both ARM64 and non-ARM64 architectures. Signed-off-by: Allen Pais <apais@microsoft.com> [ Fix merge conflicts with fe11f97 ("hyperv-tlfs: Change prefix of generic HV_REGISTER_* MSRs to HV_MSR_*"), reword commit message ] Signed-off-by: Mitchell Levy <levymitchell0@gmail.com>
1 parent f2f9bb7 commit 668afda

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_ARM64_HYPERV_TIMER_H
3+
#define _ASM_ARM64_HYPERV_TIMER_H
4+
5+
#include <asm/mshyperv.h>
6+
7+
#endif

drivers/clocksource/hyperv_timer.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,15 @@ static __always_inline u64 read_hv_clock_msr(void)
388388
* is set to 0 when the partition is created and is incremented in 100
389389
* nanosecond units.
390390
*
391-
* Use hv_raw_get_msr() because this function is used from
392-
* noinstr. Notable; while HV_MSR_TIME_REF_COUNT is a synthetic
393-
* register it doesn't need the GHCB path.
391+
* Use hv_raw_get_msr() on x86 because this function is used from noinstr
392+
* on x86. Notable; while HV_MSR_TIME_REF_COUNT is a synthetic register
393+
* it doesn't need the GHCB path.
394394
*/
395-
return hv_raw_get_msr(HV_MSR_TIME_REF_COUNT);
395+
#ifdef CONFIG_ARM64
396+
return hv_get_msr(HV_REGISTER_TIME_REF_COUNT);
397+
#else
398+
return hv_raw_get_msr(HV_REGISTER_TIME_REF_COUNT);
399+
#endif
396400
}
397401

398402
/*
@@ -406,7 +410,12 @@ static __always_inline u64 read_hv_clock_msr(void)
406410
static union {
407411
struct ms_hyperv_tsc_page page;
408412
u8 reserved[PAGE_SIZE];
409-
} tsc_pg __bss_decrypted __aligned(PAGE_SIZE);
413+
} tsc_pg
414+
#ifdef CONFIG_ARM64
415+
__aligned(PAGE_SIZE);
416+
#else
417+
__bss_decrypted __aligned(PAGE_SIZE);
418+
#endif
410419

411420
static struct ms_hyperv_tsc_page *tsc_page = &tsc_pg.page;
412421
static unsigned long tsc_pfn;

0 commit comments

Comments
 (0)