Re: [PATCH v7 10/16] x86/sev: Add Secure TSC support for SNP guests

From: Paolo Bonzini
Date: Thu Feb 01 2024 - 10:46:39 EST


On Wed, Dec 20, 2023 at 4:16 PM Nikunj A Dadhania <nikunj@xxxxxxx> wrote:

> + /* Setting Secure TSC parameters */
> + if (cpu_feature_enabled(X86_FEATURE_SNP_SECURE_TSC)) {
> + vmsa->tsc_scale = snp_tsc_scale;
> + vmsa->tsc_offset = snp_tsc_offset;
> + }

This needs to use guest_cpu_has, otherwise updating the hypervisor or
processor will change the initial VMSA and any measurement derived
from there.

In fact, the same issue exists for DEBUG_SWAP and I will shortly post
a series to allow enabling/disabling DEBUG_SWAP per-VM, so that
updating the kernel does not break existing measurements.

Paolo