Skip to content

Commit f2a725b

Browse files
committed
drivers: hv: mshv_vtl: Advertise TDX timer service extension
Add an extension for the TDX timer service, so that the userspace can query the support before use. Signed-off-by: Isaku Yamahata <[email protected]>
1 parent c9806a9 commit f2a725b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

drivers/hv/mshv_vtl_main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,19 @@ static int mshv_tdx_set_cpumask_from_apicid(int apicid, struct cpumask *cpu_mask
298298
}
299299
#endif
300300

301+
static long mshv_tdx_vtl_ioctl_check_extension(u32 arg)
302+
{
303+
if (!IS_ENABLED(CONFIG_INTEL_TDX_GUEST))
304+
return -EOPNOTSUPP;
305+
306+
switch (arg) {
307+
case MSHV_CAP_LOWER_VTL_TIMER_VIRT:
308+
return 1;
309+
default:
310+
return -EOPNOTSUPP;
311+
}
312+
}
313+
301314
static long __mshv_vtl_ioctl_check_extension(u32 arg)
302315
{
303316
switch (arg) {
@@ -307,6 +320,10 @@ static long __mshv_vtl_ioctl_check_extension(u32 arg)
307320
return mshv_vsm_capabilities.return_action_available;
308321
case MSHV_CAP_DR6_SHARED:
309322
return mshv_vsm_capabilities.dr6_shared;
323+
case MSHV_CAP_LOWER_VTL_TIMER_VIRT:
324+
if (hv_isolation_type_tdx())
325+
return mshv_tdx_vtl_ioctl_check_extension(arg);
326+
break;
310327
}
311328

312329
return -EOPNOTSUPP;

include/uapi/linux/mshv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define MSHV_CAP_REGISTER_PAGE 0x1
1616
#define MSHV_CAP_VTL_RETURN_ACTION 0x2
1717
#define MSHV_CAP_DR6_SHARED 0x3
18+
#define MSHV_CAP_LOWER_VTL_TIMER_VIRT 0x4
1819

1920
#define MSHV_VP_MMAP_REGISTERS_OFFSET (HV_VP_STATE_PAGE_REGISTERS * 0x1000)
2021
#define MAX_RUN_MSG_SIZE 256

0 commit comments

Comments
 (0)