diff mbox

[v12,26/28] qmp: add query-sev-capabilities command

Message ID 20180308124901.83533-27-brijesh.singh@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brijesh Singh March 8, 2018, 12:48 p.m. UTC
The command can be used by libvirt to query the SEV capabilities.

Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 monitor.c             |  7 +++++++
 qapi/misc.json        | 42 ++++++++++++++++++++++++++++++++++++++++++
 target/i386/monitor.c |  6 ++++++
 3 files changed, 55 insertions(+)

Comments

Daniel P. Berrangé March 8, 2018, 5:05 p.m. UTC | #1
On Thu, Mar 08, 2018 at 06:48:59AM -0600, Brijesh Singh wrote:
> The command can be used by libvirt to query the SEV capabilities.
> 
> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>  monitor.c             |  7 +++++++
>  qapi/misc.json        | 42 ++++++++++++++++++++++++++++++++++++++++++
>  target/i386/monitor.c |  6 ++++++
>  3 files changed, 55 insertions(+)
> 
> diff --git a/monitor.c b/monitor.c
> index d53ecc5ddab3..29ce695a80d5 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -985,6 +985,7 @@ static void qmp_unregister_commands_hack(void)
>      qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
>      qmp_unregister_command(&qmp_commands, "query-sev");
>      qmp_unregister_command(&qmp_commands, "query-sev-launch-measure");
> +    qmp_unregister_command(&qmp_commands, "query-sev-capabilities");
>  #endif
>  #ifndef TARGET_S390X
>      qmp_unregister_command(&qmp_commands, "dump-skeys");
> @@ -4117,6 +4118,12 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
>      error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure");
>      return NULL;
>  }
> +
> +SevCapability *qmp_query_sev_capabilities(Error **errp)
> +{
> +    error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-capabilities");
> +    return NULL;
> +}
>  #endif
>  
>  #ifndef TARGET_S390X
> diff --git a/qapi/misc.json b/qapi/misc.json
> index a39c43aa64b1..37c89663d8f4 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -3306,3 +3306,45 @@
>  #
>  ##
>  { 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' }
> +
> +##
> +# @SevCapability:
> +#
> +# The struct describes capability for a Secure Encrypted Virtualization
> +# feature.
> +#
> +# @pdh:  Platform Diffie-Hellman key
> +#
> +# @cert-chain:  PDH certificate chain

Are either of these base64 encoded ? If so nice to document that.

> +#
> +# @cbitpos: C-bit location in page table entry
> +#
> +# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> +#                     enabled
> +#
> +# Since: 2.12
> +##
> +{ 'struct': 'SevCapability',
> +  'data': { 'pdh': 'str',
> +            'cert-chain': 'str',
> +            'cbitpos': 'int',
> +            'reduced-phys-bits': 'int'} }

Regardless of answer to above Q, 

  Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
Brijesh Singh March 8, 2018, 10:52 p.m. UTC | #2
On 3/8/18 11:05 AM, Daniel P. Berrangé wrote:
> On Thu, Mar 08, 2018 at 06:48:59AM -0600, Brijesh Singh wrote:
>> The command can be used by libvirt to query the SEV capabilities.
>>
>> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
>> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>> Cc: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
>> ---
>>  monitor.c             |  7 +++++++
>>  qapi/misc.json        | 42 ++++++++++++++++++++++++++++++++++++++++++
>>  target/i386/monitor.c |  6 ++++++
>>  3 files changed, 55 insertions(+)
>>
>> diff --git a/monitor.c b/monitor.c
>> index d53ecc5ddab3..29ce695a80d5 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -985,6 +985,7 @@ static void qmp_unregister_commands_hack(void)
>>      qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
>>      qmp_unregister_command(&qmp_commands, "query-sev");
>>      qmp_unregister_command(&qmp_commands, "query-sev-launch-measure");
>> +    qmp_unregister_command(&qmp_commands, "query-sev-capabilities");
>>  #endif
>>  #ifndef TARGET_S390X
>>      qmp_unregister_command(&qmp_commands, "dump-skeys");
>> @@ -4117,6 +4118,12 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
>>      error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure");
>>      return NULL;
>>  }
>> +
>> +SevCapability *qmp_query_sev_capabilities(Error **errp)
>> +{
>> +    error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-capabilities");
>> +    return NULL;
>> +}
>>  #endif
>>  
>>  #ifndef TARGET_S390X
>> diff --git a/qapi/misc.json b/qapi/misc.json
>> index a39c43aa64b1..37c89663d8f4 100644
>> --- a/qapi/misc.json
>> +++ b/qapi/misc.json
>> @@ -3306,3 +3306,45 @@
>>  #
>>  ##
>>  { 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' }
>> +
>> +##
>> +# @SevCapability:
>> +#
>> +# The struct describes capability for a Secure Encrypted Virtualization
>> +# feature.
>> +#
>> +# @pdh:  Platform Diffie-Hellman key
>> +#
>> +# @cert-chain:  PDH certificate chain
> Are either of these base64 encoded ? If so nice to document that.

Yep, they are base64 encoded, I will update the doc.


>
>> +#
>> +# @cbitpos: C-bit location in page table entry
>> +#
>> +# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
>> +#                     enabled
>> +#
>> +# Since: 2.12
>> +##
>> +{ 'struct': 'SevCapability',
>> +  'data': { 'pdh': 'str',
>> +            'cert-chain': 'str',
>> +            'cbitpos': 'int',
>> +            'reduced-phys-bits': 'int'} }
> Regardless of answer to above Q, 
>
>   Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
>
> Regards,
> Daniel
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index d53ecc5ddab3..29ce695a80d5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -985,6 +985,7 @@  static void qmp_unregister_commands_hack(void)
     qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
     qmp_unregister_command(&qmp_commands, "query-sev");
     qmp_unregister_command(&qmp_commands, "query-sev-launch-measure");
+    qmp_unregister_command(&qmp_commands, "query-sev-capabilities");
 #endif
 #ifndef TARGET_S390X
     qmp_unregister_command(&qmp_commands, "dump-skeys");
@@ -4117,6 +4118,12 @@  SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
     error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure");
     return NULL;
 }
+
+SevCapability *qmp_query_sev_capabilities(Error **errp)
+{
+    error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-capabilities");
+    return NULL;
+}
 #endif
 
 #ifndef TARGET_S390X
diff --git a/qapi/misc.json b/qapi/misc.json
index a39c43aa64b1..37c89663d8f4 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -3306,3 +3306,45 @@ 
 #
 ##
 { 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' }
+
+##
+# @SevCapability:
+#
+# The struct describes capability for a Secure Encrypted Virtualization
+# feature.
+#
+# @pdh:  Platform Diffie-Hellman key
+#
+# @cert-chain:  PDH certificate chain
+#
+# @cbitpos: C-bit location in page table entry
+#
+# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
+#                     enabled
+#
+# Since: 2.12
+##
+{ 'struct': 'SevCapability',
+  'data': { 'pdh': 'str',
+            'cert-chain': 'str',
+            'cbitpos': 'int',
+            'reduced-phys-bits': 'int'} }
+
+##
+# @query-sev-capabilities:
+#
+# This command is used to get the SEV capabilities, and is supported on AMD
+# X86 platforms only.
+#
+# Returns: SevCapability objects.
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev-capabilities" }
+# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
+#                  "cbitpos": 47, "reduced-phys-bits": 5}}
+#
+##
+{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability' }
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index e5596bbc0fc2..33e6bade693b 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -737,3 +737,9 @@  SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
 
     return info;
 }
+
+SevCapability *qmp_query_sev_capabilities(Error **errp)
+{
+    error_setg(errp, "SEV feature is not available");
+    return NULL;
+}