Skip to contentSkip to conversation

qapi, target/i386/sev: Add cpu0-id to query-sev-capabilities

PATCH Superseded Dov Murik 2 participants 3 messages Feb 21, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dov Murik

author
#0 lore raw

PATCH 1/1 qapi, target/i386/sev: Add cpu0-id to query-sev-capabilities

Add a new field 'cpu0-id' to the response of query-sev-capabilities QMP command. The value of the field is the hex-encoded 64-byte unique ID of the CPU0 (socket 0), which can be used to retrieve the signed CEK of the CPU from AMD's Key Distribution Service (KDS).

---
 qapi/misc-target.json |  4 ++++
 target/i386/sev.c     | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
qapi/misc-target.json +4 -0
index 4bc45d2474..d9b4991c86 100644
@@ -177,6 +177,8 @@
 #
 # @cert-chain:  PDH certificate chain (base64 encoded)
 #
+# @cpu0-id: 64-byte unique ID of CPU0 (hex encoded) (since 7.0)
+#
 # @cbitpos: C-bit location in page table entry
 #
 # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
@@ -187,6 +189,7 @@
 { 'struct': 'SevCapability',
   'data': { 'pdh': 'str',
             'cert-chain': 'str',
+            'cpu0-id': 'str',
             'cbitpos': 'int',
             'reduced-phys-bits': 'int'},
   'if': 'TARGET_I386' }
@@ -205,6 +208,7 @@
 #
 # -> { "execute": "query-sev-capabilities" }
 # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
+#                  "cpu0-id": "5ea2e1...90ea39",
 #                  "cbitpos": 47, "reduced-phys-bits": 5}}
 #
 ##
target/i386/sev.c +43 -0

69 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 16 lines · Dov Murik

Add a new field 'cpu0-id' to the response of query-sev-capabilities QMP command. The value of the field is the hex-encoded 64-byte unique ID of the CPU0 (socket 0), which can be used to retrieve the signed CEK of the CPU from AMD's Key Distribution Service (KDS).

---
 qapi/misc-target.json |  4 ++++
 target/i386/sev.c     | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
qapi/misc-target.json +0 -0
index 4bc45d2474..d9b4991c86 100644

qapi/misc-target.json line 180

Quoted 4 lines
qapi/misc-target.json +1 -0
@@ -177,6 +177,8 @@
 #
 # @cert-chain:  PDH certificate chain (base64 encoded)
 #
+# @cpu0-id: 64-byte unique ID of CPU0 (hex encoded) (since 7.0)

For binary data in QAPI we've pretty much standardized on using base64 encoding. I think we should stick with that encoding.

Quoted 13 lines
qapi/misc-target.json +2 -0
+#
 # @cbitpos: C-bit location in page table entry
 #
 # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
@@ -187,6 +189,7 @@
 { 'struct': 'SevCapability',
   'data': { 'pdh': 'str',
             'cert-chain': 'str',
+            'cpu0-id': 'str',
             'cbitpos': 'int',
             'reduced-phys-bits': 'int'},
   'if': 'TARGET_I386' }

qapi/misc-target.json line 214

Quoted 7 lines
qapi/misc-target.json +1 -0
@@ -205,6 +208,7 @@
 #
 # -> { "execute": "query-sev-capabilities" }
 # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
+#                  "cpu0-id": "5ea2e1...90ea39",
 #                  "cbitpos": 47, "reduced-phys-bits": 5}}
 #
 ##

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
author
#2 lore raw

Thanks Daniel for reviewing.

Quoted 12 lines · Daniel P. Berrangé
Quoted 11 lines · Dov Murik

Add a new field 'cpu0-id' to the response of query-sev-capabilities QMP command. The value of the field is the hex-encoded 64-byte unique ID of the CPU0 (socket 0), which can be used to retrieve the signed CEK of the CPU from AMD's Key Distribution Service (KDS).

---
 qapi/misc-target.json |  4 ++++
 target/i386/sev.c     | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
Quoted 13 lines

qapi/misc-target.json line 180

Quoted 9 lines
qapi/misc-target.json +1 -0
index 4bc45d2474..d9b4991c86 100644
@@ -177,6 +177,8 @@
 #
 # @cert-chain:  PDH certificate chain (base64 encoded)
 #
+# @cpu0-id: 64-byte unique ID of CPU0 (hex encoded) (since 7.0)

For binary data in QAPI we've pretty much standardized on using base64 encoding. I think we should stick with that encoding.

OK, I'll change that to base64.

I thought about the cpu0-id as some kind of "address string", like mac addresses or IPv6 addresses which are usually represented as hex strings and not as base64-encoded. But I guess that the AMD CPU unique ID doesn't have the same legacy (and accepted notation) as mac addresses or IPv6 addresses, so we might as well treat it as "regular" binary data.

Going with base64 also saves some code because QEMU doesn't have a ready-made hex_encode() function (I copied mine from a static function in crypto/hash.c).

-Dov

Quoted 23 lines
Quoted 13 lines
qapi/misc-target.json +2 -0
+#
 # @cbitpos: C-bit location in page table entry
 #
 # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
@@ -187,6 +189,7 @@
 { 'struct': 'SevCapability',
   'data': { 'pdh': 'str',
             'cert-chain': 'str',
+            'cpu0-id': 'str',
             'cbitpos': 'int',
             'reduced-phys-bits': 'int'},
   'if': 'TARGET_I386' }

qapi/misc-target.json line 214

Quoted 7 lines
qapi/misc-target.json +1 -0
@@ -205,6 +208,7 @@
 #
 # -> { "execute": "query-sev-capabilities" }
 # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
+#                  "cpu0-id": "5ea2e1...90ea39",
 #                  "cbitpos": 47, "reduced-phys-bits": 5}}
 #
 ##

Regards,
Daniel