Re: [PATCH v2 2/2] x86/sgx: Add SGX_MemTotal to /proc/meminfo

From: Jarkko Sakkinen
Date: Thu Aug 19 2021 - 08:52:55 EST


On Thu, 2021-08-19 at 15:48 +0300, Jarkko Sakkinen wrote:
> 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@xxxxxxxxxx>

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