Skip to content

Commit e83b589

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. 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 cf6305b commit e83b589

2 files changed

Lines changed: 20 additions & 4 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: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,15 @@ static __always_inline u64 read_hv_clock_msr(void)
373373
* is set to 0 when the partition is created and is incremented in 100
374374
* nanosecond units.
375375
*
376-
* Use hv_raw_get_msr() because this function is used from
377-
* noinstr. Notable; while HV_MSR_TIME_REF_COUNT is a synthetic
378-
* register it doesn't need the GHCB path.
376+
* Use hv_raw_get_msr() on x86 because this function is used from noinstr
377+
* on x86. Notable; while HV_MSR_TIME_REF_COUNT is a synthetic register
378+
* it doesn't need the GHCB path.
379379
*/
380+
#ifdef CONFIG_ARM64
381+
return hv_get_msr(HV_MSR_TIME_REF_COUNT);
382+
#else
380383
return hv_raw_get_msr(HV_MSR_TIME_REF_COUNT);
384+
#endif
381385
}
382386

383387
/*
@@ -391,7 +395,12 @@ static __always_inline u64 read_hv_clock_msr(void)
391395
static union {
392396
struct ms_hyperv_tsc_page page;
393397
u8 reserved[PAGE_SIZE];
394-
} tsc_pg __bss_decrypted __aligned(PAGE_SIZE);
398+
} tsc_pg
399+
#ifdef CONFIG_ARM64
400+
__aligned(PAGE_SIZE);
401+
#else
402+
__bss_decrypted __aligned(PAGE_SIZE);
403+
#endif
395404

396405
static struct ms_hyperv_tsc_page *tsc_page = &tsc_pg.page;
397406
static unsigned long tsc_pfn;

0 commit comments

Comments
 (0)