Message ID | 8390c20d2f7e638d166f7b771c3e11363a7852f6.1598382343.git.thomas.lendacky@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | SEV-ES guest support | expand |
On 8/25/20 2:05 PM, Tom Lendacky wrote: > From: Tom Lendacky <thomas.lendacky@amd.com> > > Update the sev_es_enabled() function return value to be based on the SEV > policy that has been specified. SEV-ES is enabled if SEV is enabled and > the SEV-ES policy bit is set in the policy object. > > Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> > --- > target/i386/sev.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/target/i386/sev.c b/target/i386/sev.c > index 5146b788fb..153c2cba2c 100644 > --- a/target/i386/sev.c > +++ b/target/i386/sev.c > @@ -70,6 +70,8 @@ struct SevGuestState { > #define DEFAULT_GUEST_POLICY 0x1 /* disable debug */ > #define DEFAULT_SEV_DEVICE "/dev/sev" > > +#define GUEST_POLICY_SEV_ES_BIT (1 << 2) > + > /* SEV Information Block GUID = 00f771de-1a7e-4fcb-890e-68c77e2fb44e */ > #define SEV_INFO_BLOCK_GUID "\xde\x71\xf7\x00\x7e\x1a\xcb\x4f\x89\x0e\x68\xc7\x7e\x2f\xb4\x4e" > > @@ -374,7 +376,7 @@ sev_enabled(void) > bool > sev_es_enabled(void) > { > - return false; > + return (sev_enabled() && (sev_guest->policy & GUEST_POLICY_SEV_ES_BIT)); checkpatch wants these outer parentheses removed :-) > } > > uint64_t >
diff --git a/target/i386/sev.c b/target/i386/sev.c index 5146b788fb..153c2cba2c 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -70,6 +70,8 @@ struct SevGuestState { #define DEFAULT_GUEST_POLICY 0x1 /* disable debug */ #define DEFAULT_SEV_DEVICE "/dev/sev" +#define GUEST_POLICY_SEV_ES_BIT (1 << 2) + /* SEV Information Block GUID = 00f771de-1a7e-4fcb-890e-68c77e2fb44e */ #define SEV_INFO_BLOCK_GUID "\xde\x71\xf7\x00\x7e\x1a\xcb\x4f\x89\x0e\x68\xc7\x7e\x2f\xb4\x4e" @@ -374,7 +376,7 @@ sev_enabled(void) bool sev_es_enabled(void) { - return false; + return (sev_enabled() && (sev_guest->policy & GUEST_POLICY_SEV_ES_BIT)); } uint64_t