Skip to content

Commit b632632

Browse files
allenpaiskelsey-steele
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 changes led to build breakage on non-ARM64 architectures due to the use of the '__bss_decrypted' section, which is notavailable on those platforms. To address this issue, this commit adds conditional compilation to use'__bss_decrypted' only on ARM64 architectures. The introduced '#ifdefCONFIG_ARM64' ensures that the code involving '__bss_decrypted' is included only when building for ARM64, preventing build failures on other platforms. 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>
1 parent f7434a1 commit b632632

2 files changed

Lines changed: 17 additions & 1 deletion

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: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ static __always_inline u64 read_hv_clock_msr(void)
376376
* noinstr. Notable; while HV_REGISTER_TIME_REF_COUNT is a synthetic
377377
* register it doesn't need the GHCB path.
378378
*/
379+
#ifdef CONFIG_ARM64
380+
return hv_get_register(HV_REGISTER_TIME_REF_COUNT);
381+
#else
379382
return hv_raw_get_register(HV_REGISTER_TIME_REF_COUNT);
383+
#endif
380384
}
381385

382386
/*
@@ -390,7 +394,12 @@ static __always_inline u64 read_hv_clock_msr(void)
390394
static union {
391395
struct ms_hyperv_tsc_page page;
392396
u8 reserved[PAGE_SIZE];
393-
} tsc_pg __bss_decrypted __aligned(PAGE_SIZE);
397+
} tsc_pg
398+
#ifdef CONFIG_ARM64
399+
__aligned(PAGE_SIZE);
400+
#else
401+
__bss_decrypted __aligned(PAGE_SIZE);
402+
#endif
394403

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

0 commit comments

Comments
 (0)