On 2/29/2024 2:36 PM, Xiaoyao Li wrote:
> Current KVM doesn't support PMU for TD guest. It returns error if TD is
> created with PMU bit being set in attributes.
>
> Disable PMU for TD guest on QEMU side.
>
> Signed-off-by: Xiaoyao Li <xiaoyao...@intel.com>
> ---
> target/i386/kvm/tdx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
> index 262e86fd2c67..1c12cda002b8 100644
> --- a/target/i386/kvm/tdx.c
> +++ b/target/i386/kvm/tdx.c
> @@ -496,6 +496,8 @@ int tdx_pre_create_vcpu(CPUState *cpu, Error **errp)
> g_autofree struct kvm_tdx_init_vm *init_vm = NULL;
> int r = 0;
>
> + object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort);
Is it necessary to output some prompt if the user wants to enable pmu by
"-cpu host,pmu=on"? As in patch 27, it mentions PMU is configured by
x86cpu->enable_pmu, but PMU is actually not support in this series and
will be disabled silently.
> +
> QEMU_LOCK_GUARD(&tdx_guest->lock);
> if (tdx_guest->initialized) {
> return r;