* [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
@ 2013-03-15 17:17 Corey Bryant
2013-03-15 17:54 ` Eric Blake
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Corey Bryant @ 2013-03-15 17:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Corey Bryant, lcapitulino, armbru, stefanb
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
---
qemu-options.hx | 3 ++-
qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 30fb85d..3b3cd0f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2237,7 +2237,8 @@ Backend type must be:
@option{passthrough}.
The specific backend type will determine the applicable options.
-The @code{-tpmdev} option requires a @code{-device} option.
+The @code{-tpmdev} option creates the TPM backend and requires a
+@code{-device} option that specifies the TPM frontend interface model.
Options to each backend are described below.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b370060..4eda5ea 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2721,18 +2721,77 @@ EQMP
.mhandler.cmd_new = qmp_marshal_input_query_tpm,
},
+SQMP
+query-tpm
+---------
+
+Return information about the TPM device.
+
+Arguments: None
+
+Example:
+
+-> { "execute": "query-tpm" }
+<- { "return":
+ [
+ { "model": "tpm-tis",
+ "tpm-options":
+ { "type": "tpm-passthrough-options",
+ "data":
+ { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
+ "path": "/dev/tpm0"
+ }
+ },
+ "type": "passthrough",
+ "id": "tpm0"
+ }
+ ]
+ }
+
+EQMP
+
{
.name = "query-tpm-models",
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_tpm_models,
},
+SQMP
+query-tpm-models
+----------------
+
+Return a list of supported TPM models.
+
+Arguments: None
+
+Example:
+
+-> { "execute": "query-tpm-models" }
+<- { "return": [ "tpm-tis" ] }
+
+EQMP
+
{
.name = "query-tpm-types",
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_tpm_types,
},
+SQMP
+query-tpm-types
+---------------
+
+Return a list of supported TPM types.
+
+Arguments: None
+
+Example:
+
+-> { "execute": "query-tpm-types" }
+<- { "return": [ "passthrough" ] }
+
+EQMP
+
{
.name = "chardev-add",
.args_type = "id:s,backend:q",
--
1.8.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-15 17:17 [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates Corey Bryant
@ 2013-03-15 17:54 ` Eric Blake
2013-03-18 16:16 ` Markus Armbruster
2013-03-20 16:36 ` Corey Bryant
2 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2013-03-15 17:54 UTC (permalink / raw)
To: Corey Bryant; +Cc: armbru, stefanb, qemu-devel, lcapitulino
[-- Attachment #1: Type: text/plain, Size: 434 bytes --]
On 03/15/2013 11:17 AM, Corey Bryant wrote:
> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
> ---
> qemu-options.hx | 3 ++-
> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 61 insertions(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-15 17:17 [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates Corey Bryant
2013-03-15 17:54 ` Eric Blake
@ 2013-03-18 16:16 ` Markus Armbruster
2013-03-18 17:46 ` Stefan Berger
2013-03-20 16:36 ` Corey Bryant
2 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2013-03-18 16:16 UTC (permalink / raw)
To: Corey Bryant; +Cc: stefanb, qemu-devel, lcapitulino
Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
> ---
> qemu-options.hx | 3 ++-
> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 61 insertions(+), 1 deletion(-)
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 30fb85d..3b3cd0f 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2237,7 +2237,8 @@ Backend type must be:
> @option{passthrough}.
>
> The specific backend type will determine the applicable options.
> -The @code{-tpmdev} option requires a @code{-device} option.
> +The @code{-tpmdev} option creates the TPM backend and requires a
> +@code{-device} option that specifies the TPM frontend interface model.
>
> Options to each backend are described below.
>
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index b370060..4eda5ea 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -2721,18 +2721,77 @@ EQMP
> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
> },
>
> +SQMP
> +query-tpm
> +---------
> +
> +Return information about the TPM device.
> +
> +Arguments: None
> +
> +Example:
> +
> +-> { "execute": "query-tpm" }
> +<- { "return":
> + [
> + { "model": "tpm-tis",
> + "tpm-options":
> + { "type": "tpm-passthrough-options",
> + "data":
> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
> + "path": "/dev/tpm0"
> + }
> + },
> + "type": "passthrough",
> + "id": "tpm0"
> + }
> + ]
> + }
> +
> +EQMP
> +
"tpm-options" is a discriminated union. How is its discriminator "type"
(here: "tpm-passthrough-options") related to the outer "type" (here:
"passthrough")?
[...]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-18 16:16 ` Markus Armbruster
@ 2013-03-18 17:46 ` Stefan Berger
2013-03-18 18:35 ` Corey Bryant
2013-03-19 7:26 ` Markus Armbruster
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Berger @ 2013-03-18 17:46 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Corey Bryant, qemu-devel, lcapitulino
On 03/18/2013 12:16 PM, Markus Armbruster wrote:
> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>
>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>> ---
>> qemu-options.hx | 3 ++-
>> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 61 insertions(+), 1 deletion(-)
>>
>> diff --git a/qemu-options.hx b/qemu-options.hx
>> index 30fb85d..3b3cd0f 100644
>> --- a/qemu-options.hx
>> +++ b/qemu-options.hx
>> @@ -2237,7 +2237,8 @@ Backend type must be:
>> @option{passthrough}.
>>
>> The specific backend type will determine the applicable options.
>> -The @code{-tpmdev} option requires a @code{-device} option.
>> +The @code{-tpmdev} option creates the TPM backend and requires a
>> +@code{-device} option that specifies the TPM frontend interface model.
>>
>> Options to each backend are described below.
>>
>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>> index b370060..4eda5ea 100644
>> --- a/qmp-commands.hx
>> +++ b/qmp-commands.hx
>> @@ -2721,18 +2721,77 @@ EQMP
>> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
>> },
>>
>> +SQMP
>> +query-tpm
>> +---------
>> +
>> +Return information about the TPM device.
>> +
>> +Arguments: None
>> +
>> +Example:
>> +
>> +-> { "execute": "query-tpm" }
>> +<- { "return":
>> + [
>> + { "model": "tpm-tis",
>> + "tpm-options":
>> + { "type": "tpm-passthrough-options",
>> + "data":
>> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
>> + "path": "/dev/tpm0"
>> + }
>> + },
>> + "type": "passthrough",
>> + "id": "tpm0"
>> + }
>> + ]
>> + }
>> +
>> +EQMP
>> +
> "tpm-options" is a discriminated union. How is its discriminator "type"
> (here: "tpm-passthrough-options") related to the outer "type" (here:
> "passthrough")?
It gives you similar information twice. So there is a direct
relationship between the two types.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-18 17:46 ` Stefan Berger
@ 2013-03-18 18:35 ` Corey Bryant
2013-03-19 7:26 ` Markus Armbruster
1 sibling, 0 replies; 10+ messages in thread
From: Corey Bryant @ 2013-03-18 18:35 UTC (permalink / raw)
To: Stefan Berger; +Cc: lcapitulino, Markus Armbruster, qemu-devel
On 03/18/2013 01:46 PM, Stefan Berger wrote:
> On 03/18/2013 12:16 PM, Markus Armbruster wrote:
>> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>>
>>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>>> ---
>>> qemu-options.hx | 3 ++-
>>> qmp-commands.hx | 59
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 2 files changed, 61 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>> index 30fb85d..3b3cd0f 100644
>>> --- a/qemu-options.hx
>>> +++ b/qemu-options.hx
>>> @@ -2237,7 +2237,8 @@ Backend type must be:
>>> @option{passthrough}.
>>> The specific backend type will determine the applicable options.
>>> -The @code{-tpmdev} option requires a @code{-device} option.
>>> +The @code{-tpmdev} option creates the TPM backend and requires a
>>> +@code{-device} option that specifies the TPM frontend interface model.
>>> Options to each backend are described below.
>>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>>> index b370060..4eda5ea 100644
>>> --- a/qmp-commands.hx
>>> +++ b/qmp-commands.hx
>>> @@ -2721,18 +2721,77 @@ EQMP
>>> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
>>> },
>>> +SQMP
>>> +query-tpm
>>> +---------
>>> +
>>> +Return information about the TPM device.
>>> +
>>> +Arguments: None
>>> +
>>> +Example:
>>> +
>>> +-> { "execute": "query-tpm" }
>>> +<- { "return":
>>> + [
>>> + { "model": "tpm-tis",
>>> + "tpm-options":
>>> + { "type": "tpm-passthrough-options",
>>> + "data":
>>> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
>>> + "path": "/dev/tpm0"
>>> + }
>>> + },
>>> + "type": "passthrough",
>>> + "id": "tpm0"
>>> + }
>>> + ]
>>> + }
>>> +
>>> +EQMP
>>> +
>> "tpm-options" is a discriminated union. How is its discriminator "type"
>> (here: "tpm-passthrough-options") related to the outer "type" (here:
>> "passthrough")?
>
> It gives you similar information twice. So there is a direct
> relationship between the two types.
>
The sample above could be the result when the following command line
options are in effect:
qemu-system-x86_64
-tpmdev
passthrough,id=tpm0,path=/dev/tpm0,cancel-path=/sys/class/misc/tpm0/device/cancel
-device tpm-tis,tpmdev=tpm0
--
Regards,
Corey Bryant
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-18 17:46 ` Stefan Berger
2013-03-18 18:35 ` Corey Bryant
@ 2013-03-19 7:26 ` Markus Armbruster
2013-03-19 14:59 ` Corey Bryant
1 sibling, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2013-03-19 7:26 UTC (permalink / raw)
To: Stefan Berger; +Cc: Anthony Liguori, Corey Bryant, qemu-devel, lcapitulino
[Note cc: Anthony for QAPI schema expertise]
Stefan Berger <stefanb@linux.vnet.ibm.com> writes:
> On 03/18/2013 12:16 PM, Markus Armbruster wrote:
>> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>>
>>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>>> ---
>>> qemu-options.hx | 3 ++-
>>> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 2 files changed, 61 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>> index 30fb85d..3b3cd0f 100644
>>> --- a/qemu-options.hx
>>> +++ b/qemu-options.hx
>>> @@ -2237,7 +2237,8 @@ Backend type must be:
>>> @option{passthrough}.
>>> The specific backend type will determine the applicable
>>> options.
>>> -The @code{-tpmdev} option requires a @code{-device} option.
>>> +The @code{-tpmdev} option creates the TPM backend and requires a
>>> +@code{-device} option that specifies the TPM frontend interface model.
>>> Options to each backend are described below.
>>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>>> index b370060..4eda5ea 100644
>>> --- a/qmp-commands.hx
>>> +++ b/qmp-commands.hx
>>> @@ -2721,18 +2721,77 @@ EQMP
>>> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
>>> },
>>> +SQMP
>>> +query-tpm
>>> +---------
>>> +
>>> +Return information about the TPM device.
>>> +
>>> +Arguments: None
>>> +
>>> +Example:
>>> +
>>> +-> { "execute": "query-tpm" }
>>> +<- { "return":
>>> + [
>>> + { "model": "tpm-tis",
>>> + "tpm-options":
>>> + { "type": "tpm-passthrough-options",
>>> + "data":
>>> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
>>> + "path": "/dev/tpm0"
>>> + }
>>> + },
>>> + "type": "passthrough",
>>> + "id": "tpm0"
>>> + }
>>> + ]
>>> + }
>>> +
>>> +EQMP
>>> +
>> "tpm-options" is a discriminated union. How is its discriminator "type"
>> (here: "tpm-passthrough-options") related to the outer "type" (here:
>> "passthrough")?
>
> It gives you similar information twice. So there is a direct
> relationship between the two types.
Awkward and undocumented.
Relevant parts of qapi-schema.json:
{ 'enum': 'TpmType', 'data': [ 'passthrough' ] }
{ 'union': 'TpmTypeOptions',
'data': { 'tpm-passthrough-options' : 'TPMPassthroughOptions' } }
{ 'type': 'TPMInfo',
'data': {'id': 'str',
'model': 'TpmModel',
'type': 'TpmType',
'tpm-options': 'TpmTypeOptions' } }
Type Netdev solves the same problem more elegantly:
{ 'union': 'NetClientOptions',
'data': {
'none': 'NetdevNoneOptions',
'nic': 'NetLegacyNicOptions',
'user': 'NetdevUserOptions',
'tap': 'NetdevTapOptions',
'socket': 'NetdevSocketOptions',
'vde': 'NetdevVdeOptions',
'dump': 'NetdevDumpOptions',
'bridge': 'NetdevBridgeOptions',
'hubport': 'NetdevHubPortOptions' } }
{ 'type': 'Netdev',
'data': {
'id': 'str',
'opts': 'NetClientOptions' } }
Uses the union's discriminator. Straightforward.
Following Netdev precedence, we get:
{ 'union': 'TpmTypeOptions',
'data': { 'passthrough' : 'TPMPassthroughOptions' } }
{ 'type': 'TPMInfo',
'data': {'id': 'str',
'model': 'TpmModel',
'opts': 'TpmTypeOptions' } }
Duplication of type is gone. No need for documentation.
Since enum TpmType is used elsewhere, it still gets duplicated in the
union's discriminator. Anthony, is there a way to name the implicit
discriminator enum type for reference elsewhere in the schema?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-19 7:26 ` Markus Armbruster
@ 2013-03-19 14:59 ` Corey Bryant
2013-03-20 12:32 ` Markus Armbruster
0 siblings, 1 reply; 10+ messages in thread
From: Corey Bryant @ 2013-03-19 14:59 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Anthony Liguori, lcapitulino, qemu-devel, Stefan Berger
On 03/19/2013 03:26 AM, Markus Armbruster wrote:
> [Note cc: Anthony for QAPI schema expertise]
>
> Stefan Berger <stefanb@linux.vnet.ibm.com> writes:
>
>> On 03/18/2013 12:16 PM, Markus Armbruster wrote:
>>> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>>>
>>>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>>>> ---
>>>> qemu-options.hx | 3 ++-
>>>> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>> 2 files changed, 61 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>>> index 30fb85d..3b3cd0f 100644
>>>> --- a/qemu-options.hx
>>>> +++ b/qemu-options.hx
>>>> @@ -2237,7 +2237,8 @@ Backend type must be:
>>>> @option{passthrough}.
>>>> The specific backend type will determine the applicable
>>>> options.
>>>> -The @code{-tpmdev} option requires a @code{-device} option.
>>>> +The @code{-tpmdev} option creates the TPM backend and requires a
>>>> +@code{-device} option that specifies the TPM frontend interface model.
>>>> Options to each backend are described below.
>>>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>>>> index b370060..4eda5ea 100644
>>>> --- a/qmp-commands.hx
>>>> +++ b/qmp-commands.hx
>>>> @@ -2721,18 +2721,77 @@ EQMP
>>>> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
>>>> },
>>>> +SQMP
>>>> +query-tpm
>>>> +---------
>>>> +
>>>> +Return information about the TPM device.
>>>> +
>>>> +Arguments: None
>>>> +
>>>> +Example:
>>>> +
>>>> +-> { "execute": "query-tpm" }
>>>> +<- { "return":
>>>> + [
>>>> + { "model": "tpm-tis",
>>>> + "tpm-options":
>>>> + { "type": "tpm-passthrough-options",
>>>> + "data":
>>>> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
>>>> + "path": "/dev/tpm0"
>>>> + }
>>>> + },
>>>> + "type": "passthrough",
>>>> + "id": "tpm0"
>>>> + }
>>>> + ]
>>>> + }
>>>> +
>>>> +EQMP
>>>> +
>>> "tpm-options" is a discriminated union. How is its discriminator "type"
>>> (here: "tpm-passthrough-options") related to the outer "type" (here:
>>> "passthrough")?
>>
>> It gives you similar information twice. So there is a direct
>> relationship between the two types.
>
> Awkward and undocumented.
>
> Relevant parts of qapi-schema.json:
>
> { 'enum': 'TpmType', 'data': [ 'passthrough' ] }
>
> { 'union': 'TpmTypeOptions',
> 'data': { 'tpm-passthrough-options' : 'TPMPassthroughOptions' } }
>
> { 'type': 'TPMInfo',
> 'data': {'id': 'str',
> 'model': 'TpmModel',
> 'type': 'TpmType',
> 'tpm-options': 'TpmTypeOptions' } }
>
> Type Netdev solves the same problem more elegantly:
>
> { 'union': 'NetClientOptions',
> 'data': {
> 'none': 'NetdevNoneOptions',
> 'nic': 'NetLegacyNicOptions',
> 'user': 'NetdevUserOptions',
> 'tap': 'NetdevTapOptions',
> 'socket': 'NetdevSocketOptions',
> 'vde': 'NetdevVdeOptions',
> 'dump': 'NetdevDumpOptions',
> 'bridge': 'NetdevBridgeOptions',
> 'hubport': 'NetdevHubPortOptions' } }
>
> { 'type': 'Netdev',
> 'data': {
> 'id': 'str',
> 'opts': 'NetClientOptions' } }
>
> Uses the union's discriminator. Straightforward.
>
> Following Netdev precedence, we get:
>
> { 'union': 'TpmTypeOptions',
> 'data': { 'passthrough' : 'TPMPassthroughOptions' } }
>
> { 'type': 'TPMInfo',
> 'data': {'id': 'str',
> 'model': 'TpmModel',
> 'opts': 'TpmTypeOptions' } }
>
I can send a patch for this update if you'd like.
> Duplication of type is gone. No need for documentation.
>
> Since enum TpmType is used elsewhere, it still gets duplicated in the
> union's discriminator. Anthony, is there a way to name the implicit
> discriminator enum type for reference elsewhere in the schema?
>
Are you saying it still gets duplicated with this fix? I'm not sure
what you mean.
--
Regards,
Corey Bryant
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-19 14:59 ` Corey Bryant
@ 2013-03-20 12:32 ` Markus Armbruster
2013-03-20 13:26 ` Corey Bryant
0 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2013-03-20 12:32 UTC (permalink / raw)
To: Corey Bryant; +Cc: Anthony Liguori, Stefan Berger, qemu-devel, lcapitulino
Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
> On 03/19/2013 03:26 AM, Markus Armbruster wrote:
>> [Note cc: Anthony for QAPI schema expertise]
>>
>> Stefan Berger <stefanb@linux.vnet.ibm.com> writes:
>>
>>> On 03/18/2013 12:16 PM, Markus Armbruster wrote:
>>>> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>>>>
>>>>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>>>>> ---
>>>>> qemu-options.hx | 3 ++-
>>>>> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>> 2 files changed, 61 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>>>> index 30fb85d..3b3cd0f 100644
>>>>> --- a/qemu-options.hx
>>>>> +++ b/qemu-options.hx
>>>>> @@ -2237,7 +2237,8 @@ Backend type must be:
>>>>> @option{passthrough}.
>>>>> The specific backend type will determine the applicable
>>>>> options.
>>>>> -The @code{-tpmdev} option requires a @code{-device} option.
>>>>> +The @code{-tpmdev} option creates the TPM backend and requires a
>>>>> +@code{-device} option that specifies the TPM frontend interface model.
>>>>> Options to each backend are described below.
>>>>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>>>>> index b370060..4eda5ea 100644
>>>>> --- a/qmp-commands.hx
>>>>> +++ b/qmp-commands.hx
>>>>> @@ -2721,18 +2721,77 @@ EQMP
>>>>> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
>>>>> },
>>>>> +SQMP
>>>>> +query-tpm
>>>>> +---------
>>>>> +
>>>>> +Return information about the TPM device.
>>>>> +
>>>>> +Arguments: None
>>>>> +
>>>>> +Example:
>>>>> +
>>>>> +-> { "execute": "query-tpm" }
>>>>> +<- { "return":
>>>>> + [
>>>>> + { "model": "tpm-tis",
>>>>> + "tpm-options":
>>>>> + { "type": "tpm-passthrough-options",
>>>>> + "data":
>>>>> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
>>>>> + "path": "/dev/tpm0"
>>>>> + }
>>>>> + },
>>>>> + "type": "passthrough",
>>>>> + "id": "tpm0"
>>>>> + }
>>>>> + ]
>>>>> + }
>>>>> +
>>>>> +EQMP
>>>>> +
>>>> "tpm-options" is a discriminated union. How is its discriminator "type"
>>>> (here: "tpm-passthrough-options") related to the outer "type" (here:
>>>> "passthrough")?
>>>
>>> It gives you similar information twice. So there is a direct
>>> relationship between the two types.
>>
>> Awkward and undocumented.
>>
>> Relevant parts of qapi-schema.json:
>>
>> { 'enum': 'TpmType', 'data': [ 'passthrough' ] }
>>
>> { 'union': 'TpmTypeOptions',
>> 'data': { 'tpm-passthrough-options' : 'TPMPassthroughOptions' } }
>>
>> { 'type': 'TPMInfo',
>> 'data': {'id': 'str',
>> 'model': 'TpmModel',
>> 'type': 'TpmType',
>> 'tpm-options': 'TpmTypeOptions' } }
>>
>> Type Netdev solves the same problem more elegantly:
>>
>> { 'union': 'NetClientOptions',
>> 'data': {
>> 'none': 'NetdevNoneOptions',
>> 'nic': 'NetLegacyNicOptions',
>> 'user': 'NetdevUserOptions',
>> 'tap': 'NetdevTapOptions',
>> 'socket': 'NetdevSocketOptions',
>> 'vde': 'NetdevVdeOptions',
>> 'dump': 'NetdevDumpOptions',
>> 'bridge': 'NetdevBridgeOptions',
>> 'hubport': 'NetdevHubPortOptions' } }
>>
>> { 'type': 'Netdev',
>> 'data': {
>> 'id': 'str',
>> 'opts': 'NetClientOptions' } }
>>
>> Uses the union's discriminator. Straightforward.
>>
>> Following Netdev precedence, we get:
>>
>> { 'union': 'TpmTypeOptions',
>> 'data': { 'passthrough' : 'TPMPassthroughOptions' } }
>>
>> { 'type': 'TPMInfo',
>> 'data': {'id': 'str',
>> 'model': 'TpmModel',
>> 'opts': 'TpmTypeOptions' } }
>>
>
> I can send a patch for this update if you'd like.
Yes, please!
>> Duplication of type is gone. No need for documentation.
>>
>> Since enum TpmType is used elsewhere, it still gets duplicated in the
>> union's discriminator. Anthony, is there a way to name the implicit
>> discriminator enum type for reference elsewhere in the schema?
>>
>
> Are you saying it still gets duplicated with this fix? I'm not sure
> what you mean.
A union in the schema implicitely defines an C enumeration type to be
used for its discriminator. For instance, union TpmTypeOptions
implicitely defines this one:
typedef enum TpmTypeOptionsKind
{
TPM_TYPE_OPTIONS_KIND_TPM_PASSTHROUGH_OPTIONS = 0,
TPM_TYPE_OPTIONS_KIND_MAX = 1,
} TpmTypeOptionsKind;
QAPI's discriminated union becomes a C struct containing the
discriminator and the union of the members:
struct TpmTypeOptions
{
TpmTypeOptionsKind kind;
union {
void *data;
TPMPassthroughOptions * tpm_passthrough_options;
};
};
Enum TpmType and type TpmInfo become:
typedef enum TpmType
{
TPM_TYPE_PASSTHROUGH = 0,
TPM_TYPE_MAX = 1,
} TpmType;
struct TPMInfo
{
char * id;
TpmModel model;
TpmType type;
TpmTypeOptions * tpm_options;
};
With the change I propose, TPM_TYPE_OPTIONS_KIND_TPM_PASSTHROUGH_OPTIONS
becomes TPM_TYPE_OPTIONS_KIND_TPM_PASSTHROUGH, and TPMInfo member type
goes away.
Because TpmType is still used elsewhere, it doesn't go away, thus still
duplicates TpmTypeOptionsKind. My question to Anthony was about ways to
avoid that remaining bit of duplication. I don't expect you do answer
it :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-20 12:32 ` Markus Armbruster
@ 2013-03-20 13:26 ` Corey Bryant
0 siblings, 0 replies; 10+ messages in thread
From: Corey Bryant @ 2013-03-20 13:26 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Anthony Liguori, lcapitulino, qemu-devel, Stefan Berger
On 03/20/2013 08:32 AM, Markus Armbruster wrote:
> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>
>> On 03/19/2013 03:26 AM, Markus Armbruster wrote:
>>> [Note cc: Anthony for QAPI schema expertise]
>>>
>>> Stefan Berger <stefanb@linux.vnet.ibm.com> writes:
>>>
>>>> On 03/18/2013 12:16 PM, Markus Armbruster wrote:
>>>>> Corey Bryant <coreyb@linux.vnet.ibm.com> writes:
>>>>>
>>>>>> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
>>>>>> ---
>>>>>> qemu-options.hx | 3 ++-
>>>>>> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>>> 2 files changed, 61 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>>>>> index 30fb85d..3b3cd0f 100644
>>>>>> --- a/qemu-options.hx
>>>>>> +++ b/qemu-options.hx
>>>>>> @@ -2237,7 +2237,8 @@ Backend type must be:
>>>>>> @option{passthrough}.
>>>>>> The specific backend type will determine the applicable
>>>>>> options.
>>>>>> -The @code{-tpmdev} option requires a @code{-device} option.
>>>>>> +The @code{-tpmdev} option creates the TPM backend and requires a
>>>>>> +@code{-device} option that specifies the TPM frontend interface model.
>>>>>> Options to each backend are described below.
>>>>>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>>>>>> index b370060..4eda5ea 100644
>>>>>> --- a/qmp-commands.hx
>>>>>> +++ b/qmp-commands.hx
>>>>>> @@ -2721,18 +2721,77 @@ EQMP
>>>>>> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
>>>>>> },
>>>>>> +SQMP
>>>>>> +query-tpm
>>>>>> +---------
>>>>>> +
>>>>>> +Return information about the TPM device.
>>>>>> +
>>>>>> +Arguments: None
>>>>>> +
>>>>>> +Example:
>>>>>> +
>>>>>> +-> { "execute": "query-tpm" }
>>>>>> +<- { "return":
>>>>>> + [
>>>>>> + { "model": "tpm-tis",
>>>>>> + "tpm-options":
>>>>>> + { "type": "tpm-passthrough-options",
>>>>>> + "data":
>>>>>> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
>>>>>> + "path": "/dev/tpm0"
>>>>>> + }
>>>>>> + },
>>>>>> + "type": "passthrough",
>>>>>> + "id": "tpm0"
>>>>>> + }
>>>>>> + ]
>>>>>> + }
>>>>>> +
>>>>>> +EQMP
>>>>>> +
>>>>> "tpm-options" is a discriminated union. How is its discriminator "type"
>>>>> (here: "tpm-passthrough-options") related to the outer "type" (here:
>>>>> "passthrough")?
>>>>
>>>> It gives you similar information twice. So there is a direct
>>>> relationship between the two types.
>>>
>>> Awkward and undocumented.
>>>
>>> Relevant parts of qapi-schema.json:
>>>
>>> { 'enum': 'TpmType', 'data': [ 'passthrough' ] }
>>>
>>> { 'union': 'TpmTypeOptions',
>>> 'data': { 'tpm-passthrough-options' : 'TPMPassthroughOptions' } }
>>>
>>> { 'type': 'TPMInfo',
>>> 'data': {'id': 'str',
>>> 'model': 'TpmModel',
>>> 'type': 'TpmType',
>>> 'tpm-options': 'TpmTypeOptions' } }
>>>
>>> Type Netdev solves the same problem more elegantly:
>>>
>>> { 'union': 'NetClientOptions',
>>> 'data': {
>>> 'none': 'NetdevNoneOptions',
>>> 'nic': 'NetLegacyNicOptions',
>>> 'user': 'NetdevUserOptions',
>>> 'tap': 'NetdevTapOptions',
>>> 'socket': 'NetdevSocketOptions',
>>> 'vde': 'NetdevVdeOptions',
>>> 'dump': 'NetdevDumpOptions',
>>> 'bridge': 'NetdevBridgeOptions',
>>> 'hubport': 'NetdevHubPortOptions' } }
>>>
>>> { 'type': 'Netdev',
>>> 'data': {
>>> 'id': 'str',
>>> 'opts': 'NetClientOptions' } }
>>>
>>> Uses the union's discriminator. Straightforward.
>>>
>>> Following Netdev precedence, we get:
>>>
>>> { 'union': 'TpmTypeOptions',
>>> 'data': { 'passthrough' : 'TPMPassthroughOptions' } }
>>>
>>> { 'type': 'TPMInfo',
>>> 'data': {'id': 'str',
>>> 'model': 'TpmModel',
>>> 'opts': 'TpmTypeOptions' } }
>>>
>>
>> I can send a patch for this update if you'd like.
>
> Yes, please!
>
Will do.
>>> Duplication of type is gone. No need for documentation.
>>>
>>> Since enum TpmType is used elsewhere, it still gets duplicated in the
>>> union's discriminator. Anthony, is there a way to name the implicit
>>> discriminator enum type for reference elsewhere in the schema?
>>>
>>
>> Are you saying it still gets duplicated with this fix? I'm not sure
>> what you mean.
>
> A union in the schema implicitely defines an C enumeration type to be
> used for its discriminator. For instance, union TpmTypeOptions
> implicitely defines this one:
>
> typedef enum TpmTypeOptionsKind
> {
> TPM_TYPE_OPTIONS_KIND_TPM_PASSTHROUGH_OPTIONS = 0,
> TPM_TYPE_OPTIONS_KIND_MAX = 1,
> } TpmTypeOptionsKind;
>
> QAPI's discriminated union becomes a C struct containing the
> discriminator and the union of the members:
>
> struct TpmTypeOptions
> {
> TpmTypeOptionsKind kind;
> union {
> void *data;
> TPMPassthroughOptions * tpm_passthrough_options;
> };
> };
>
> Enum TpmType and type TpmInfo become:
>
> typedef enum TpmType
> {
> TPM_TYPE_PASSTHROUGH = 0,
> TPM_TYPE_MAX = 1,
> } TpmType;
>
> struct TPMInfo
> {
> char * id;
> TpmModel model;
> TpmType type;
> TpmTypeOptions * tpm_options;
> };
>
> With the change I propose, TPM_TYPE_OPTIONS_KIND_TPM_PASSTHROUGH_OPTIONS
> becomes TPM_TYPE_OPTIONS_KIND_TPM_PASSTHROUGH, and TPMInfo member type
> goes away.
>
> Because TpmType is still used elsewhere, it doesn't go away, thus still
> duplicates TpmTypeOptionsKind. My question to Anthony was about ways to
> avoid that remaining bit of duplication. I don't expect you do answer
> it :)
>
Ok well thanks for the explanation anyway!
--
Regards,
Corey Bryant
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates
2013-03-15 17:17 [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates Corey Bryant
2013-03-15 17:54 ` Eric Blake
2013-03-18 16:16 ` Markus Armbruster
@ 2013-03-20 16:36 ` Corey Bryant
2 siblings, 0 replies; 10+ messages in thread
From: Corey Bryant @ 2013-03-20 16:36 UTC (permalink / raw)
To: lcapitulino, armbru; +Cc: qemu-devel, stefanb
I just resubmitted this patch as part of another series, so please
ignore this one.
--
Regards,
Corey Bryant
On 03/15/2013 01:17 PM, Corey Bryant wrote:
> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
> ---
> qemu-options.hx | 3 ++-
> qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 61 insertions(+), 1 deletion(-)
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 30fb85d..3b3cd0f 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2237,7 +2237,8 @@ Backend type must be:
> @option{passthrough}.
>
> The specific backend type will determine the applicable options.
> -The @code{-tpmdev} option requires a @code{-device} option.
> +The @code{-tpmdev} option creates the TPM backend and requires a
> +@code{-device} option that specifies the TPM frontend interface model.
>
> Options to each backend are described below.
>
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index b370060..4eda5ea 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -2721,18 +2721,77 @@ EQMP
> .mhandler.cmd_new = qmp_marshal_input_query_tpm,
> },
>
> +SQMP
> +query-tpm
> +---------
> +
> +Return information about the TPM device.
> +
> +Arguments: None
> +
> +Example:
> +
> +-> { "execute": "query-tpm" }
> +<- { "return":
> + [
> + { "model": "tpm-tis",
> + "tpm-options":
> + { "type": "tpm-passthrough-options",
> + "data":
> + { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
> + "path": "/dev/tpm0"
> + }
> + },
> + "type": "passthrough",
> + "id": "tpm0"
> + }
> + ]
> + }
> +
> +EQMP
> +
> {
> .name = "query-tpm-models",
> .args_type = "",
> .mhandler.cmd_new = qmp_marshal_input_query_tpm_models,
> },
>
> +SQMP
> +query-tpm-models
> +----------------
> +
> +Return a list of supported TPM models.
> +
> +Arguments: None
> +
> +Example:
> +
> +-> { "execute": "query-tpm-models" }
> +<- { "return": [ "tpm-tis" ] }
> +
> +EQMP
> +
> {
> .name = "query-tpm-types",
> .args_type = "",
> .mhandler.cmd_new = qmp_marshal_input_query_tpm_types,
> },
>
> +SQMP
> +query-tpm-types
> +---------------
> +
> +Return a list of supported TPM types.
> +
> +Arguments: None
> +
> +Example:
> +
> +-> { "execute": "query-tpm-types" }
> +<- { "return": [ "passthrough" ] }
> +
> +EQMP
> +
> {
> .name = "chardev-add",
> .args_type = "id:s,backend:q",
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-03-20 16:36 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15 17:17 [Qemu-devel] [PATCH] QMP: TPM QMP and man page documentation updates Corey Bryant
2013-03-15 17:54 ` Eric Blake
2013-03-18 16:16 ` Markus Armbruster
2013-03-18 17:46 ` Stefan Berger
2013-03-18 18:35 ` Corey Bryant
2013-03-19 7:26 ` Markus Armbruster
2013-03-19 14:59 ` Corey Bryant
2013-03-20 12:32 ` Markus Armbruster
2013-03-20 13:26 ` Corey Bryant
2013-03-20 16:36 ` Corey Bryant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).