sgx: add bits from other 3.12 branch

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>