On Thu, 19 Aug 2021 15:52:48 +0300 Jarkko Sakkinen wrote:
On Thu, 2021-08-19 at 15:48 +0300, Jarkko Sakkinen wrote:
quoted
The amount of SGX memory on the system is determined by the BIOS and it
varies wildly between systems. It can be from dozens of MB's on desktops
or VM's, up to many GB's on servers. Just like for regular memory, it is
sometimes useful to know the amount of usable SGX memory in the system.
Add SGX_MemTotal field to /proc/meminfo, which shows the total amount of
usable SGX memory in the system. E.g. with 32 MB reserved for SGX from
BIOS, the printout would be:
SGX_MemTotal: 22528 kB
It is less than 32 MB because some of the space is reserved for Enclave
Page Cache Metadata (EPCM), which contains state variables for all the
pages in the Enclave Page Cache (EPC). The latter contains the pages,
which applications can use to create enclaves.
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
While working on this, I noticed that suddenly my i5-9660k desktop fully
supports SGX on Linux. I don't recall that it has worked in the patch.
Maybe this is because of some firmware/ucode update, do not really know,
but definitely not a bad thing.
Perhaps this casts through other 9th gen Core CPU's.
The motherboard I have in this machine is AORUS Elite z390.
/Jarkko
Enabling SGX also requires BIOS support, so perhaps it's BIOS update that makes
SGX available.
Btw, with SGX KVM, EPC will be discovered regardless FLC is available
or not. You need to check whether /dev/sgx_enclave is present or not to truly
know whether SGX driver is usable.