In SGX, after setting up the elrange in Enclave Creation Phase, do the SGX copy all pages from non-epc region to epc-region (belongs to the elrange)? Or do they copy the elrange pages only dynamically, as per demand paging?
The pages are copied dynamically as needed. Note that paging is handled by system software, not by SGX. You can find more info in these slides, which I highly recommend reading, and this whitepaper. The Intel SGX Life Cycle blog and PDFs at the bottom are also quite useful if you want to get a better understanding.
Intel Customer Support