Certain SEAMCALL leaf functions may return error due to running out of
entropy, in which case the SEAMCALL should be retried as suggested by
the TDX spec.
Handle this case in SEAMCALL common function. Mimic the existing
rdrand_long() to retry RDRAND_RETRY_LOOPS times.
Signed-off-by: Kai Huang <kai.huang@xxxxxxxxx>
---
v10 -> v11:
- New patch
---
arch/x86/virt/vmx/tdx/tdx.c | 15 ++++++++++++++-
arch/x86/virt/vmx/tdx/tdx.h | 17 +++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/arch/x86/virt/vmx/tdx/tdx.h b/arch/x86/virt/vmx/tdx/tdx.h
index 48ad1a1ba737..55dbb1b8c971 100644
--- a/arch/x86/virt/vmx/tdx/tdx.h
+++ b/arch/x86/virt/vmx/tdx/tdx.h
@@ -4,6 +4,23 @@
#include <linux/types.h>
+/*
+ * This file contains both macros and data structures defined by the TDX
+ * architecture and Linux defined software data structures and functions.
+ * The two should not be mixed together for better readability. The
+ * architectural definitions come first.
+ */
+
+/*
+ * TDX SEAMCALL error codes
+ */
+#define TDX_RND_NO_ENTROPY 0x8000020300000000ULL