Re: [PATCH v3 52/70] i386/tdx: handle TDG.VP.VMCALL

Markus Armbruster
2023-12-07T09:20:25Z

Xiaoyao Li <xiaoyao.li@intel.com> writes:

> On 12/1/2023 7:02 PM, Markus Armbruster wrote:
>> Xiaoyao Li <xiaoyao.li@intel.com> writes:
>>
>>> From: Isaku Yamahata <isaku.yamahata@intel.com>
>>>
>>> For GetQuote, delegate a request to Quote Generation Service.
>>> Add property "quote-generation-socket" to tdx-guest, whihc is a property
>>> of type SocketAddress to specify Quote Generation Service(QGS).
>>>
>>> On request, connect to the QGS, read request buffer from shared guest
>>> memory, send the request buffer to the server and store the response
>>> into shared guest memory and notify TD guest by interrupt.
>>>
>>> command line example:
>>> qemu-system-x86_64 \
>>> -object '{"qom-type":"tdx-guest","id":"tdx0","quote-generation-socket":{"type": "vsock", "cid":"2","port":"1234"}}' \
>>> -machine confidential-guest-support=tdx0
>>>
>>> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
>>> Codeveloped-by: Chenyi Qiang <chenyi.qiang@intel.com>
>>> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
>>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>>> ---
>>> Changes in v3:
>>> - rename property "quote-generation-service" to "quote-generation-socket";
>>> - change the type of "quote-generation-socket" from str to
>>> SocketAddress;
>>> - squash next patch into this one;
>>> ---
>>> qapi/qom.json | 5 +-
>>> target/i386/kvm/tdx.c | 430 ++++++++++++++++++++++++++++++++++++++++++
>>> target/i386/kvm/tdx.h | 6 +
>>> 3 files changed, 440 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/qapi/qom.json b/qapi/qom.json
>>> index fd99aa1ff8cc..cf36a1832ddd 100644
>>> --- a/qapi/qom.json
>>> +++ b/qapi/qom.json
>>> @@ -894,13 +894,16 @@
>>> #
>>> # @mrownerconfig: base64 MROWNERCONFIG SHA384 digest
>>> #
>>> +# @quote-generation-socket: socket address for Quote Generation Service(QGS)
>>> +#
>> Long line. Better:
>> # @quote-generation-socket: socket address for Quote Generation
>> # Service(QGS)
>
> May I ask what's the limitation for qom.json? if 80 columns limitation doesn't apply to it.

docs/devel/qapi-code-gen.rst section "Documentation markup":

For legibility, wrap text paragraphs so every line is at most 70
characters long.

Why is this not 80? Humans tend to have trouble following long lines
with their eyes (I sure do). Typographic manuals suggest to limit
columns to roughly 60 characters for exactly that reason[*].

For code, four levels of indentation plus 60 characters of actual text
yields 76. However, code lines can be awkward to break, and going over
80 can be less bad than an awkward line break. Use your judgement.

Documentation text, however, tends to be indented much less: 6-10
characters of indentation plus 60 of actual text yields 66-70. When I
reflowed the entire QAPI schema documentation to stay within that limit
(commit a937b6aa739), not a single line break was awkward.

>>> # Since: 8.2
>>> ##
>>> { 'struct': 'TdxGuestProperties',
>>> 'data': { '*sept-ve-disable': 'bool',
>>> '*mrconfigid': 'str',
>>> '*mrowner': 'str',
>>> - '*mrownerconfig': 'str' } }
>>> + '*mrownerconfig': 'str',
>>> + '*quote-generation-socket': 'SocketAddress' } }
>>> ##
>>> # @ThreadContextProperties:
>>

[*] https://en.wikipedia.org/wiki/Column_(typography)#Typographic_style