Skip to content

Commit b35c4bb

Browse files
NunoDasNevesjinankjain
authored andcommitted
ioctls: update ioctl numbers
The ioctl numbers are reorganized. Update to reflect that. Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
1 parent e7cbfca commit b35c4bb

File tree

1 file changed

+79
-73
lines changed

1 file changed

+79
-73
lines changed

mshv-ioctls/src/mshv_ioctls.rs

Lines changed: 79 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -16,123 +16,129 @@ ioctl_iow_nr!(
1616

1717
// partition fd
1818
ioctl_io_nr!(MSHV_INITIALIZE_PARTITION, MSHV_IOCTL, 0x00);
19-
ioctl_iow_nr!(MSHV_CREATE_VP, MSHV_IOCTL, 0x04, mshv_create_vp);
20-
ioctl_iowr_nr!(MSHV_GET_VP_REGISTERS, MSHV_IOCTL, 0x05, mshv_vp_registers);
21-
ioctl_iow_nr!(MSHV_SET_VP_REGISTERS, MSHV_IOCTL, 0x06, mshv_vp_registers);
22-
ioctl_ior_nr!(MSHV_RUN_VP, MSHV_IOCTL, 0x00, mshv_run_vp);
23-
#[cfg(target_arch = "x86_64")]
24-
ioctl_iowr_nr!(MSHV_GET_VP_STATE, MSHV_IOCTL, 0x0A, mshv_get_set_vp_state);
25-
#[cfg(target_arch = "x86_64")]
26-
ioctl_iowr_nr!(MSHV_SET_VP_STATE, MSHV_IOCTL, 0x0B, mshv_get_set_vp_state);
19+
ioctl_iow_nr!(MSHV_CREATE_VP, MSHV_IOCTL, 0x01, mshv_create_vp);
2720
ioctl_iow_nr!(
28-
MSHV_SET_PARTITION_PROPERTY,
21+
MSHV_SET_GUEST_MEMORY,
2922
MSHV_IOCTL,
30-
0x0C,
31-
mshv_partition_property
23+
0x02,
24+
mshv_user_mem_region
3225
);
26+
ioctl_iow_nr!(MSHV_IRQFD, MSHV_IOCTL, 0x03, mshv_user_irqfd);
27+
ioctl_iow_nr!(MSHV_IOEVENTFD, MSHV_IOCTL, 0x4, mshv_user_ioeventfd);
28+
ioctl_iow_nr!(MSHV_SET_MSI_ROUTING, MSHV_IOCTL, 0x05, mshv_user_irq_table);
3329
ioctl_iowr_nr!(
34-
MSHV_GET_PARTITION_PROPERTY,
30+
MSHV_GET_GPAP_ACCESS_BITMAP,
3531
MSHV_IOCTL,
36-
0x0D,
37-
mshv_partition_property
32+
0x06,
33+
mshv_gpap_access_bitmap
3834
);
39-
ioctl_iow_nr!(MSHV_IRQFD, MSHV_IOCTL, 0x0E, mshv_user_irqfd);
40-
ioctl_iow_nr!(MSHV_IOEVENTFD, MSHV_IOCTL, 0xF, mshv_user_ioeventfd);
41-
ioctl_iow_nr!(MSHV_SET_MSI_ROUTING, MSHV_IOCTL, 0x11, mshv_user_irq_table);
35+
ioctl_iowr_nr!(MSHV_ROOT_HVCALL, MSHV_IOCTL, 0x07, mshv_root_hvcall);
36+
ioctl_iowr_nr!(MSHV_CREATE_DEVICE, MSHV_IOCTL, 0x08, mshv_create_device);
4237
ioctl_iow_nr!(
43-
MSHV_SET_GUEST_MEMORY,
38+
MSHV_MODIFY_GPA_HOST_ACCESS,
4439
MSHV_IOCTL,
45-
0x02,
46-
mshv_user_mem_region
40+
0x09,
41+
mshv_modify_gpa_host_access
4742
);
43+
ioctl_iow_nr!(
44+
MSHV_IMPORT_ISOLATED_PAGES,
45+
MSHV_IOCTL,
46+
0x0A,
47+
mshv_import_isolated_pages
48+
);
49+
50+
// deprecated
4851
ioctl_iow_nr!(
4952
MSHV_INSTALL_INTERCEPT,
5053
MSHV_IOCTL,
51-
0x08,
54+
0xF0,
5255
mshv_install_intercept
5356
);
5457
ioctl_iow_nr!(
5558
MSHV_ASSERT_INTERRUPT,
5659
MSHV_IOCTL,
57-
0x09,
60+
0xF1,
5861
mshv_assert_interrupt
5962
);
60-
ioctl_iowr_nr!(MSHV_VP_TRANSLATE_GVA, MSHV_IOCTL, 0x0E, mshv_translate_gva);
61-
ioctl_iowr_nr!(
62-
MSHV_GET_GPAP_ACCESS_BITMAP,
63-
MSHV_IOCTL,
64-
0x07,
65-
mshv_gpap_access_bitmap
66-
);
67-
68-
ioctl_iowr_nr!(MSHV_CREATE_DEVICE, MSHV_IOCTL, 0x13, mshv_create_device);
69-
ioctl_iow_nr!(MSHV_SET_DEVICE_ATTR, MSHV_IOCTL, 0x14, mshv_device_attr);
70-
ioctl_iow_nr!(MSHV_GET_DEVICE_ATTR, MSHV_IOCTL, 0x15, mshv_device_attr);
71-
ioctl_iow_nr!(MSHV_HAS_DEVICE_ATTR, MSHV_IOCTL, 0x16, mshv_device_attr);
72-
73-
#[cfg(target_arch = "x86_64")]
7463
ioctl_iow_nr!(
75-
MSHV_VP_REGISTER_INTERCEPT_RESULT,
64+
MSHV_SET_PARTITION_PROPERTY,
7665
MSHV_IOCTL,
77-
0x17,
78-
mshv_register_intercept_result
66+
0xF2,
67+
mshv_partition_property
7968
);
80-
8169
ioctl_iowr_nr!(
82-
MSHV_SIGNAL_EVENT_DIRECT,
70+
MSHV_GET_PARTITION_PROPERTY,
8371
MSHV_IOCTL,
84-
0x18,
85-
mshv_signal_event_direct
72+
0xF3,
73+
mshv_partition_property
8674
);
8775
ioctl_iow_nr!(
88-
MSHV_POST_MESSAGE_DIRECT,
76+
MSHV_COMPLETE_ISOLATED_IMPORT,
8977
MSHV_IOCTL,
90-
0x19,
91-
mshv_post_message_direct
78+
0xF4,
79+
mshv_complete_isolated_import
9280
);
9381
ioctl_iow_nr!(
94-
MSHV_REGISTER_DELIVERABILITY_NOTIFICATIONS,
82+
MSHV_ISSUE_PSP_GUEST_REQUEST,
9583
MSHV_IOCTL,
96-
0x1A,
97-
mshv_register_deliverabilty_notifications
84+
0xF5,
85+
mshv_issue_psp_guest_request
9886
);
99-
ioctl_iowr_nr!(
100-
MSHV_GET_VP_CPUID_VALUES,
87+
ioctl_iow_nr!(
88+
MSHV_SEV_SNP_AP_CREATE,
10189
MSHV_IOCTL,
102-
0x1B,
103-
mshv_get_vp_cpuid_values
90+
0xF6,
91+
mshv_sev_snp_ap_create
10492
);
105-
ioctl_iow_nr!(
106-
MSHV_MODIFY_GPA_HOST_ACCESS,
93+
ioctl_iowr_nr!(
94+
MSHV_SIGNAL_EVENT_DIRECT,
10795
MSHV_IOCTL,
108-
0x28,
109-
mshv_modify_gpa_host_access
96+
0xF7,
97+
mshv_signal_event_direct
11098
);
11199
ioctl_iow_nr!(
112-
MSHV_IMPORT_ISOLATED_PAGES,
100+
MSHV_POST_MESSAGE_DIRECT,
113101
MSHV_IOCTL,
114-
0x29,
115-
mshv_import_isolated_pages
102+
0xF8,
103+
mshv_post_message_direct
116104
);
117105
ioctl_iow_nr!(
118-
MSHV_COMPLETE_ISOLATED_IMPORT,
106+
MSHV_REGISTER_DELIVERABILITY_NOTIFICATIONS,
119107
MSHV_IOCTL,
120-
0x30,
121-
mshv_complete_isolated_import
108+
0xF9,
109+
mshv_register_deliverabilty_notifications
122110
);
111+
112+
// VP fd
113+
ioctl_ior_nr!(MSHV_RUN_VP, MSHV_IOCTL, 0x00, mshv_run_vp);
114+
#[cfg(target_arch = "x86_64")]
115+
ioctl_iowr_nr!(MSHV_GET_VP_STATE, MSHV_IOCTL, 0x01, mshv_get_set_vp_state);
116+
#[cfg(target_arch = "x86_64")]
117+
ioctl_iowr_nr!(MSHV_SET_VP_STATE, MSHV_IOCTL, 0x02, mshv_get_set_vp_state);
118+
// NOTE: defined above, also used with VP fd:
119+
// ioctl_iowr_nr!(MSHV_ROOT_HVCALL, MSHV_IOCTL, 0x07, mshv_root_hvcall);
120+
121+
// deprecated
122+
ioctl_iowr_nr!(MSHV_GET_VP_REGISTERS, MSHV_IOCTL, 0xF0, mshv_vp_registers);
123+
ioctl_iow_nr!(MSHV_SET_VP_REGISTERS, MSHV_IOCTL, 0xF1, mshv_vp_registers);
124+
ioctl_iowr_nr!(MSHV_VP_TRANSLATE_GVA, MSHV_IOCTL, 0xF2, mshv_translate_gva);
125+
#[cfg(target_arch = "x86_64")]
123126
ioctl_iow_nr!(
124-
MSHV_ISSUE_PSP_GUEST_REQUEST,
127+
MSHV_VP_REGISTER_INTERCEPT_RESULT,
125128
MSHV_IOCTL,
126-
0x31,
127-
mshv_issue_psp_guest_request
129+
0xF3,
130+
mshv_register_intercept_result
128131
);
129-
ioctl_iowr_nr!(MSHV_READ_GPA, MSHV_IOCTL, 0x32, mshv_read_write_gpa);
130-
ioctl_iow_nr!(MSHV_WRITE_GPA, MSHV_IOCTL, 0x33, mshv_read_write_gpa);
131-
ioctl_iow_nr!(
132-
MSHV_SEV_SNP_AP_CREATE,
132+
ioctl_iowr_nr!(
133+
MSHV_GET_VP_CPUID_VALUES,
133134
MSHV_IOCTL,
134-
0x34,
135-
mshv_sev_snp_ap_create
135+
0xF4,
136+
mshv_get_vp_cpuid_values
136137
);
138+
ioctl_iowr_nr!(MSHV_READ_GPA, MSHV_IOCTL, 0xF5, mshv_read_write_gpa);
139+
ioctl_iow_nr!(MSHV_WRITE_GPA, MSHV_IOCTL, 0xF6, mshv_read_write_gpa);
137140

138-
ioctl_iowr_nr!(MSHV_ROOT_HVCALL, MSHV_IOCTL, 0x35, mshv_root_hvcall);
141+
// device fd
142+
ioctl_iow_nr!(MSHV_SET_DEVICE_ATTR, MSHV_IOCTL, 0x00, mshv_device_attr);
143+
ioctl_iow_nr!(MSHV_GET_DEVICE_ATTR, MSHV_IOCTL, 0x01, mshv_device_attr);
144+
ioctl_iow_nr!(MSHV_HAS_DEVICE_ATTR, MSHV_IOCTL, 0x02, mshv_device_attr);

0 commit comments

Comments
 (0)