File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed 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
2008
2008
be used as a vm ioctl to set the initial tsc frequency of subsequently
2009
2009
created vCPUs.
2010
2010
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
+
2011
2018
4.56 KVM_GET_TSC_KHZ
2012
2019
--------------------
2013
2020
@@ -7230,8 +7237,8 @@ inputs and outputs of the TDVMCALL. Currently the following values of
7230
7237
placed in fields from ``r11 `` to ``r14 `` of the ``get_tdvmcall_info ``
7231
7238
field of the union.
7232
7239
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 ``.
7235
7242
7236
7243
KVM may add support for more values in the future that may cause a userspace
7237
7244
exit, 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)
2269
2269
const struct tdx_sys_info_td_conf * td_conf = & tdx_sysinfo -> td_conf ;
2270
2270
struct kvm_tdx_capabilities __user * user_caps ;
2271
2271
struct kvm_tdx_capabilities * caps = NULL ;
2272
+ u32 nr_user_entries ;
2272
2273
int ret = 0 ;
2273
2274
2274
2275
/* flags is reserved for future use */
2275
2276
if (cmd -> flags )
2276
2277
return - EINVAL ;
2277
2278
2278
- caps = kmalloc (sizeof (* caps ) +
2279
+ caps = kzalloc (sizeof (* caps ) +
2279
2280
sizeof (struct kvm_cpuid_entry2 ) * td_conf -> num_cpuid_config ,
2280
2281
GFP_KERNEL );
2281
2282
if (!caps )
2282
2283
return - ENOMEM ;
2283
2284
2284
2285
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 )) {
2286
2287
ret = - EFAULT ;
2287
2288
goto out ;
2288
2289
}
2289
2290
2290
- if (caps -> cpuid . nent < td_conf -> num_cpuid_config ) {
2291
+ if (nr_user_entries < td_conf -> num_cpuid_config ) {
2291
2292
ret = - E2BIG ;
2292
2293
goto out ;
2293
2294
}
Original file line number Diff line number Diff line change @@ -6188,6 +6188,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
6188
6188
u32 user_tsc_khz ;
6189
6189
6190
6190
r = - EINVAL ;
6191
+
6192
+ if (vcpu -> arch .guest_tsc_protected )
6193
+ goto out ;
6194
+
6191
6195
user_tsc_khz = (u32 )arg ;
6192
6196
6193
6197
if (kvm_caps .has_tsc_control &&
You can’t perform that action at this time.
0 commit comments