Subject: [PATCH ovmf 2/5] MdePkg: Add AMD SEV features to PcdConfidentialComputingGuestAttr


Lendacky, Thomas
 

Added the subject as somehow it didn't get set.

On 11/30/22 20:35, Alexey Kardashevskiy wrote:
Date: Tue, 22 Nov 2022 16:12:55 +1100
Subject: [PATCH ovmf 2/5] MdePkg: Add AMD SEV features to
PcdConfidentialComputingGuestAttr
PcdConfidentialComputingGuestAttr so far only contained an SEV mode bit
but there are more other features which do not translate to levels
such as DebugSwap or SecureTsc.
This adds the features mask and the DebugSwap feature bit to a PCD.
Signed-off-by: Alexey Kardashevskiy <aik@...>
---
MdePkg/Include/ConfidentialComputingGuestAttr.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/MdePkg/Include/ConfidentialComputingGuestAttr.h b/MdePkg/Include/ConfidentialComputingGuestAttr.h
index 44e6df800207..1fd09a51ea52 100644
--- a/MdePkg/Include/ConfidentialComputingGuestAttr.h
+++ b/MdePkg/Include/ConfidentialComputingGuestAttr.h
@@ -26,12 +26,15 @@ typedef enum {
CCAttrAmdSev = 0x100,
CCAttrAmdSevEs = 0x101,
CCAttrAmdSevSnp = 0x102,
+ CCAttrAmdSevFeatureMask = 0xffff0000,
The PCD for this is 64-bits, should this be 0xffffffffffff0000?

Thanks,
Tom

+ CCAttrAmdSevFeatureDebugSwap = 0x00010000,
/* The guest is running with Intel TDX memory encryption enabled. */
CCAttrIntelTdx = 0x200,
} CONFIDENTIAL_COMPUTING_GUEST_ATTR;
#define CC_GUEST_IS_TDX(x) ((x) == CCAttrIntelTdx)
-#define CC_GUEST_IS_SEV(x) ((x) == CCAttrAmdSev || (x) == CCAttrAmdSevEs || (x) == CCAttrAmdSevSnp)
+#define _CC_GUEST_IS_SEV(x) ((x) == CCAttrAmdSev || (x) == CCAttrAmdSevEs || (x) == CCAttrAmdSevSnp)
+#define CC_GUEST_IS_SEV(x) _CC_GUEST_IS_SEV((x) & ~CCAttrAmdSevFeatureMask)
#endif


Alexey Kardashevskiy
 

On 2/12/22 01:47, Tom Lendacky wrote:
Added the subject as somehow it didn't get set.
On 11/30/22 20:35, Alexey Kardashevskiy wrote:
Date: Tue, 22 Nov 2022 16:12:55 +1100
Subject: [PATCH ovmf 2/5] MdePkg: Add AMD SEV features to
  PcdConfidentialComputingGuestAttr

PcdConfidentialComputingGuestAttr so far only contained an SEV mode bit
but there are more other features which do not translate to levels
such as DebugSwap or SecureTsc.

This adds the features mask and the DebugSwap feature bit to a PCD.

Signed-off-by: Alexey Kardashevskiy <aik@...>
---
  MdePkg/Include/ConfidentialComputingGuestAttr.h | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/ConfidentialComputingGuestAttr.h b/MdePkg/Include/ConfidentialComputingGuestAttr.h
index 44e6df800207..1fd09a51ea52 100644
--- a/MdePkg/Include/ConfidentialComputingGuestAttr.h
+++ b/MdePkg/Include/ConfidentialComputingGuestAttr.h
@@ -26,12 +26,15 @@ typedef enum {
    CCAttrAmdSev    = 0x100,
    CCAttrAmdSevEs  = 0x101,
    CCAttrAmdSevSnp = 0x102,
+  CCAttrAmdSevFeatureMask      = 0xffff0000,
The PCD for this is 64-bits, should this be 0xffffffffffff0000?
True but does not that really depend on how greedy I am? :) For now I like 16bits and leave the rest for everyone else.




--
Alexey


Gerd Hoffmann
 

On Fri, Dec 02, 2022 at 11:26:56PM +1100, Alexey Kardashevskiy wrote:


On 2/12/22 01:47, Tom Lendacky wrote:
Added the subject as somehow it didn't get set.

On 11/30/22 20:35, Alexey Kardashevskiy wrote:
Date: Tue, 22 Nov 2022 16:12:55 +1100
Subject: [PATCH ovmf 2/5] MdePkg: Add AMD SEV features to
  PcdConfidentialComputingGuestAttr

PcdConfidentialComputingGuestAttr so far only contained an SEV mode bit
but there are more other features which do not translate to levels
such as DebugSwap or SecureTsc.

This adds the features mask and the DebugSwap feature bit to a PCD.

Signed-off-by: Alexey Kardashevskiy <aik@...>
---
  MdePkg/Include/ConfidentialComputingGuestAttr.h | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/ConfidentialComputingGuestAttr.h
b/MdePkg/Include/ConfidentialComputingGuestAttr.h
index 44e6df800207..1fd09a51ea52 100644
--- a/MdePkg/Include/ConfidentialComputingGuestAttr.h
+++ b/MdePkg/Include/ConfidentialComputingGuestAttr.h
@@ -26,12 +26,15 @@ typedef enum {
    CCAttrAmdSev    = 0x100,
    CCAttrAmdSevEs  = 0x101,
    CCAttrAmdSevSnp = 0x102,
+  CCAttrAmdSevFeatureMask      = 0xffff0000,
The PCD for this is 64-bits, should this be 0xffffffffffff0000?
True but does not that really depend on how greedy I am? :) For now I like
16bits and leave the rest for everyone else.
If we want add feature bits to that PCD it should IMHO not be
AmdSev-specific, i.e. we should have something along the lines of:

CCAttrTypeMask 0x000000000000ffff
CCAttrFeatureMask 0xffffffffffff0000

Alternatively use another pcd for the feature bits.

take care,
Gerd