[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v4 06/36] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPA
From: |
Gerd Hoffmann |
Subject: |
Re: [RFC PATCH v4 06/36] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES |
Date: |
Mon, 23 May 2022 10:45:30 +0200 |
Hi,
> + do {
> + size = sizeof(struct kvm_tdx_capabilities) +
> + max_ent * sizeof(struct kvm_tdx_cpuid_config);
> + caps = g_malloc0(size);
> + caps->nr_cpuid_configs = max_ent;
> +
> + r = tdx_platform_ioctl(KVM_TDX_CAPABILITIES, 0, caps);
> + if (r == -E2BIG) {
> + g_free(caps);
> + max_ent *= 2;
> + } else if (r < 0) {
> + error_report("KVM_TDX_CAPABILITIES failed: %s\n", strerror(-r));
> + exit(1);
> + }
> + }
> + while (r == -E2BIG);
This should have a limit for the number of loop runs.
take care,
Gerd
- [RFC PATCH v4 02/36] i386: Introduce tdx-guest object, (continued)
- [RFC PATCH v4 02/36] i386: Introduce tdx-guest object, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 03/36] target/i386: Implement mc->kvm_type() to get VM type, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 04/36] target/i386: Introduce kvm_confidential_guest_init(), Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 05/36] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 06/36] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 07/36] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object, Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 09/36] KVM: Introduce kvm_arch_pre_create_vcpu(), Xiaoyao Li, 2022/05/11
- [RFC PATCH v4 08/36] i386/tdx: Adjust get_supported_cpuid() for TDX VM, Xiaoyao Li, 2022/05/11