Skip to content

Conversation

@yamahata
Copy link
Contributor

Add ifdef and define to fix arm64 build.

drivers/hv/mshv_vtl_main.c: In function ‘mshv_tdx_setup_halt_timer’: drivers/hv/mshv_vtl_main.c:1163:15: error: implicit declaration of function ‘rdtsc’ [-Werror=implicit-function-declaration]
1163 | now = rdtsc();
| ^~~~~
drivers/hv/mshv_vtl_main.c:1170:73: error: ‘tsc_khz’ undeclared (first use in this function)
1170 | time = mul_u64_u64_div_u64(deadline - now, 1000 * 1000, tsc_khz);
| ^~~~~~~
drivers/hv/mshv_vtl_main.c:1170:73: note: each undeclared identifier is reported only once for each function it appears in
drivers/hv/mshv_vtl_main.c: In function ‘mshv_vtl_switch_to_vtl0_irqoff’:
drivers/hv/mshv_vtl_main.c:1242:49: error: ‘MSHV_VTL_RUN_FLAG_HALTED’ undeclared (first use in this function)
1242 | armed = mshv_tdx_halt_timer_pre(flags & MSHV_VTL_RUN_FLAG_HALTED);
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

@yamahata yamahata force-pushed the ohcl-tdx-timer-service-arm64-fix-2025-12-10 branch from 1e4671d to c23d055 Compare December 10, 2025 22:55
@hargar19 hargar19 requested a review from dcui December 10, 2025 23:00
Add ifdef and define to fix arm64 build.

drivers/hv/mshv_vtl_main.c: In function ‘mshv_tdx_setup_halt_timer’:
drivers/hv/mshv_vtl_main.c:1163:15: error: implicit declaration of function ‘rdtsc’ [-Werror=implicit-function-declaration]
 1163 |         now = rdtsc();
      |               ^~~~~
drivers/hv/mshv_vtl_main.c:1170:73: error: ‘tsc_khz’ undeclared (first use in this function)
 1170 |                 time = mul_u64_u64_div_u64(deadline - now, 1000 * 1000, tsc_khz);
      |                                                                         ^~~~~~~
drivers/hv/mshv_vtl_main.c:1170:73: note: each undeclared identifier is reported only once for each function it appears in
drivers/hv/mshv_vtl_main.c: In function ‘mshv_vtl_switch_to_vtl0_irqoff’:
drivers/hv/mshv_vtl_main.c:1242:49: error: ‘MSHV_VTL_RUN_FLAG_HALTED’ undeclared (first use in this function)
 1242 |         armed = mshv_tdx_halt_timer_pre(flags & MSHV_VTL_RUN_FLAG_HALTED);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Fixes: fc1601f ("mshv_vtl/tdx: Arm per-cpu timer to wake up from L0 HLT emulation")
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
In case of !CONFIG_INTEL_TDX_GUEST, gcc complains as
"parameter name omitted".  Add missing parameter names.

Fixes: 151bf98 ("mshv_vtl/tdx: Handle some APIC functionality in kernel")
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
@yamahata yamahata force-pushed the ohcl-tdx-timer-service-arm64-fix-2025-12-10 branch from c23d055 to e52cdcd Compare December 11, 2025 00:04
Move up one of define(CONFIG_X86_64) && defined(CONFIG_INTEL_TDX_GUEST)
for consistency.

Fixes: 1bf0706 ("mshv_vtl/tdx: Set TSC deadline if userspace requests")
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Copy link
Contributor

@dcui dcui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I did some quick build testing and it also worked for me.

@hargar19 hargar19 merged commit 28e74f6 into microsoft:product/hcl-main/6.12 Dec 11, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants