|
From: | Xiaoyao Li |
Subject: | Re: [RFC PATCH v4 06/36] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES |
Date: | Mon, 23 May 2022 23:30:21 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.9.0 |
On 5/23/2022 4:45 PM, Gerd Hoffmann wrote:
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.
Actually, this logic is copied from get_supported_cpuid().Anyway, I can put a maximum limit as 256 (it should be large enough) or maybe re-use KVM_MAX_CPUID_ENTRIES. When it gets hit, we know we need to update QEMU to fit with TDX on new platform.
take care, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |