Re: [RFC PATCH 6/7] target/i386: SEV: Add support for setting TSC frequency for Secure TSC

Markus Armbruster
2025-09-12T11:22:31Z

"Naveen N Rao (AMD)" <naveen@kernel.org> writes:

> Add support for configuring the TSC frequency when Secure TSC is enabled
> in SEV-SNP guests through a new "tsc-frequency" property on SEV-SNP
> guest objects, similar to the vCPU-specific property used by regular
> guests and TDX. A new property is needed since SEV-SNP guests require
> the TSC frequency to be specified during early SNP_LAUNCH_START command
> before any vCPUs are created.
>
> The user-provided TSC frequency is set through KVM_SET_TSC_KHZ before
> issuing KVM_SEV_SNP_LAUNCH_START.
>
> Co-developed-by: Ketan Chaturvedi <Ketan.Chaturvedi@amd.com>
> Signed-off-by: Ketan Chaturvedi <Ketan.Chaturvedi@amd.com>
> Co-developed-by: Nikunj A Dadhania <nikunj@amd.com>
> Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
> Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>

[...]

> diff --git a/qapi/qom.json b/qapi/qom.json
> index b05a475ef499..5b99148cb790 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -1102,6 +1102,9 @@
> #
> # @secure-tsc: enable Secure TSC (default: false) (since 10.2)
> #
> +# @tsc-frequency: set secure TSC frequency. Only valid if Secure TSC
> +# is enabled (default: zero) (since 10.2)

Two spaces between sentences for consistency, please.

> +#
> # Since: 9.1
> ##
> { 'struct': 'SevSnpGuestProperties',
> @@ -1114,7 +1117,8 @@
> '*author-key-enabled': 'bool',
> '*host-data': 'str',
> '*vcek-disabled': 'bool',
> - '*secure-tsc': 'bool' } }
> + '*secure-tsc': 'bool',
> + '*tsc-frequency': 'uint32' } }
>
> ##