On Wed, Sep 08, 2021 at 10:55:13AM +0200, Paolo Bonzini wrote: > On 08/09/21 10:19, Yang Zhong wrote: > >+ if (x86ms->sgx_epc_list) { > >+ PCMachineState *pcms = PC_MACHINE(ms); > >+ SGXEPCState *sgx_epc = &pcms->sgx_epc; > >+ info = g_new0(SGXInfo, 1); > >+ > >+ info->sgx = true; > >+ info->sgx1 = true; > >+ info->sgx2 = true; > >+ info->flc = true; > > Since this is querying the actual machine, it should check the CPUID > bits of the first CPU, instead of just returning true. >
Paolo, this interface is only for checking SGX info from VM side by motinor or QMP tools, the SGXInfo *sgx_get_capabilities(Error **errp) in the patch5 check the host cpuid info to get the SGX related CPU bit info, like sgx,flc,sgx1,and sgx2 bit info. so here, if x86ms->sgx_epc_list is setting, those bits info in the VM side are all ture. thanks! Yang > Paolo