Re: [PATCH] KVM: x86: Update Xen TSC leaves during CPUID emulation
From: David Woodhouse
Date: Thu Jan 23 2025 - 15:34:34 EST
On Thu, 2025-01-23 at 19:02 +0000, Fred Griffoul wrote:
> +static inline void kvm_xen_may_update_tsc_info(struct kvm_vcpu *vcpu,
> + u32 function, u32 index,
> + u32 *eax, u32 *ecx, u32 *edx)
Should this be called kvm_xen_maybe_update_tsc_info() ?
Is it worth adding if (static_branch_unlikely(&kvm_xen_enabled.key))?
> +{
> + u32 base = vcpu->arch.xen.cpuid.base;
> +
> + if (base && (function == (base | XEN_CPUID_LEAF(3)))) {
> + if (index == 1) {
> + *ecx = vcpu->arch.hv_clock.tsc_to_system_mul;
> + *edx = vcpu->arch.hv_clock.tsc_shift;
Are these fields in vcpu->arch.hv_clock definitely going to be set? If
so, can we have a comment to that effect? And perhaps a warning to
assert the truth of that claim?
Before this patch, if the hv_clock isn't yet set then the guest would
see the original content of the leaves as set by userspace? Now it gets
zeroes if that happens?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature