Message ID | 20180228211028.83970-27-brijesh.singh@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 02/28/2018 03:10 PM, 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-schema.json | 42 ++++++++++++++++++++++++++++++++++++++++++ > target/i386/monitor.c | 5 +++++ > 3 files changed, 54 insertions(+) And another rebase victim. > +## > +# @query-sev-capabilities: > +# > +# This command is used to get the SEV capabilities and supported on AMD grammar suggestion: s/capabilities and/capabilities, and is/ > +# X86 platform only. s/platform/platforms/ > +# > +# Returns: a list of SevCapability objects. This says it returns a list of objects... > +# > +# Since: 2.12 > +# > +# Example: > +# > +# -> { "execute": "query-sev-capabilities" } ...but this says it returns a single object. > +# <- { "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 577d50eebaaa..1b55dd0fff88 100644 > --- a/target/i386/monitor.c > +++ b/target/i386/monitor.c > @@ -737,3 +737,8 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) > > return info; > } > + > +SevCapability *qmp_query_sev_capabilities(Error **errp) > +{ > + return NULL; Should call error_setg() before returning NULL. > +} >
On 03/01/2018 02:13 PM, Eric Blake wrote: > On 02/28/2018 03:10 PM, 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-schema.json | 42 ++++++++++++++++++++++++++++++++++++++++++ >> target/i386/monitor.c | 5 +++++ >> 3 files changed, 54 insertions(+) > > And another rebase victim. > > I will wait for couple of days for more feedback then rebase the series. >> +## >> +# @query-sev-capabilities: >> +# >> +# This command is used to get the SEV capabilities and supported on AMD > > grammar suggestion: s/capabilities and/capabilities, and is/ > >> +# X86 platform only. > > s/platform/platforms/ > Will fix it. >> +# >> +# Returns: a list of SevCapability objects. > > This says it returns a list of objects... > Earlier I thought we may need list but we really need one element. I will fix it. >> +# >> +# Since: 2.12 >> +# >> +# Example: >> +# >> +# -> { "execute": "query-sev-capabilities" } > > ...but this says it returns a single object. > >> +# <- { "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 577d50eebaaa..1b55dd0fff88 100644 >> --- a/target/i386/monitor.c >> +++ b/target/i386/monitor.c >> @@ -737,3 +737,8 @@ SevLaunchMeasureInfo >> *qmp_query_sev_launch_measure(Error **errp) >> return info; >> } >> + >> +SevCapability *qmp_query_sev_capabilities(Error **errp) >> +{ >> + return NULL; > > Should call error_setg() before returning NULL. > Later in the patches this function gets filled with capability call and we set the error before returning NULL.
diff --git a/monitor.c b/monitor.c index d0ebd5906d9d..26d86685a9f9 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"); @@ -4171,6 +4172,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-schema.json b/qapi-schema.json index facf2138df6b..9a50d9b8017e 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3279,3 +3279,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 supported on AMD +# X86 platform only. +# +# Returns: a list of 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 577d50eebaaa..1b55dd0fff88 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -737,3 +737,8 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) return info; } + +SevCapability *qmp_query_sev_capabilities(Error **errp) +{ + return NULL; +}
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-schema.json | 42 ++++++++++++++++++++++++++++++++++++++++++ target/i386/monitor.c | 5 +++++ 3 files changed, 54 insertions(+)