On 04/05/21 02:09, Sean Christopherson wrote:
Is there a way to process "-device sgx-epc..." before vCPUs are realized? The ordering problem was the only reason I added a dedicated option.
If it's just CPUID, one possibility could be to mark the EPC sections specially in KVM_SET_USER_MEMORY_REGION and synthesize the leaves within KVM; or even look inside the VMA structs and detect EPC regions that way.
Otherwise, the -M solution would work. Paolo
From the changelog: Because SGX EPC is enumerated through CPUID, EPC "devices" need to be realized prior to realizing the vCPUs themselves, i.e. long before generic devices are parsed and realized. So even though EPC sections could be realized through the generic -devices command, they need to be created much earlier for them to actually be usable by the guest.