File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2008,6 +2008,13 @@ If the KVM_CAP_VM_TSC_CONTROL capability is advertised, this can also
20082008be used as a vm ioctl to set the initial tsc frequency of subsequently
20092009created vCPUs.
20102010
2011+ For TSC protected Confidential Computing (CoCo) VMs where TSC frequency
2012+ is configured once at VM scope and remains unchanged during VM's
2013+ lifetime, the vm ioctl should be used to configure the TSC frequency
2014+ and the vcpu ioctl is not supported.
2015+
2016+ Example of such CoCo VMs: TDX guests.
2017+
201120184.56 KVM_GET_TSC_KHZ
20122019--------------------
20132020
@@ -7230,8 +7237,8 @@ inputs and outputs of the TDVMCALL. Currently the following values of
72307237 placed in fields from ``r11 `` to ``r14 `` of the ``get_tdvmcall_info ``
72317238 field of the union.
72327239
7233- * ``TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT ``: the guest has requested to
7234- set up a notification interrupt for vector ``vector ``.
7240+ * ``TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT ``: the guest has requested to
7241+ set up a notification interrupt for vector ``vector ``.
72357242
72367243KVM may add support for more values in the future that may cause a userspace
72377244exit, even without calls to ``KVM_ENABLE_CAP `` or similar. In this case,
Original file line number Diff line number Diff line change @@ -2269,25 +2269,26 @@ static int tdx_get_capabilities(struct kvm_tdx_cmd *cmd)
22692269 const struct tdx_sys_info_td_conf * td_conf = & tdx_sysinfo -> td_conf ;
22702270 struct kvm_tdx_capabilities __user * user_caps ;
22712271 struct kvm_tdx_capabilities * caps = NULL ;
2272+ u32 nr_user_entries ;
22722273 int ret = 0 ;
22732274
22742275 /* flags is reserved for future use */
22752276 if (cmd -> flags )
22762277 return - EINVAL ;
22772278
2278- caps = kmalloc (sizeof (* caps ) +
2279+ caps = kzalloc (sizeof (* caps ) +
22792280 sizeof (struct kvm_cpuid_entry2 ) * td_conf -> num_cpuid_config ,
22802281 GFP_KERNEL );
22812282 if (!caps )
22822283 return - ENOMEM ;
22832284
22842285 user_caps = u64_to_user_ptr (cmd -> data );
2285- if (copy_from_user ( caps , user_caps , sizeof ( * caps ) )) {
2286+ if (get_user ( nr_user_entries , & user_caps -> cpuid . nent )) {
22862287 ret = - EFAULT ;
22872288 goto out ;
22882289 }
22892290
2290- if (caps -> cpuid . nent < td_conf -> num_cpuid_config ) {
2291+ if (nr_user_entries < td_conf -> num_cpuid_config ) {
22912292 ret = - E2BIG ;
22922293 goto out ;
22932294 }
Original file line number Diff line number Diff line change @@ -6188,6 +6188,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
61886188 u32 user_tsc_khz ;
61896189
61906190 r = - EINVAL ;
6191+
6192+ if (vcpu -> arch .guest_tsc_protected )
6193+ goto out ;
6194+
61916195 user_tsc_khz = (u32 )arg ;
61926196
61936197 if (kvm_caps .has_tsc_control &&
You can’t perform that action at this time.
0 commit comments