On 12/2/22 03:19, Huang, Kai wrote: > Probably I forgot to mention the "r9" in practice always returns 32, so there > will be empty CMRs at the tail of the cmr_array[]. Right, so the r9 value is basically useless. I bet the code gets simpler if you just ignore it. >> But we can also do nothing here, but just skip empty CMRs when comparing the >> memory region to it (in next patch). >> >> Or, we don't even need to explicitly check memory region against CMRs. If the >> memory regions that we provided in the TDMR doesn't fall into CMR, then >> TDH.SYS.CONFIG will fail. We can just depend on the SEAMCALL to do that. > > Sorry to ping, but do you have any comments here? > > How about we just don't do any check of TDX memory regions against CMRs, but > just let the TDH.SYS.CONFIG SEAMCALL to determine? Right, if we screw it up TDH.SYS.CONFIG SEAMCALL will fail. We don't need to add more code to detect that failure ourselves. TDX is screwed either way.