qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, marcandre.lureau@gmail.com
Subject: Re: [PATCH v3 1/2] tpm: Use new ptm_cap_n structure for PTM_GET_CAPABILITY
Date: Wed, 16 Oct 2024 13:01:15 -0400	[thread overview]
Message-ID: <5558e41c-5d22-481e-9bc7-b46cd65e5d34@linux.ibm.com> (raw)
In-Reply-To: <Zw_VpwVc_qSpJS6y@redhat.com>



On 10/16/24 11:03 AM, Daniel P. Berrangé wrote:
> On Wed, Oct 16, 2024 at 10:57:07AM -0400, Stefan Berger wrote:
>> Use the new ptm_cap_n structure for getting the PTM_GET_CAPABILITY response
>> from swtpm. Previously only 17 bits could possibly have been set in ptm_cap
>> (=uint64_t) in big endian order and those bits are now found in the 2nd
>> 32bit word in the response in the caps field.
>>
>> This data structure makes it now clear that the 1st 32bit word carries the
>> tpm_result like all the other response structures of all other commands
>> do.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
>> ---
>>   backends/tpm/tpm_emulator.c | 14 ++++++++------
>>   backends/tpm/tpm_ioctl.h    | 13 ++++++++++++-
>>   backends/tpm/trace-events   |  2 +-
>>   3 files changed, 21 insertions(+), 8 deletions(-)
>>
> 
>> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
>> index 1933ab6855..ee2dd15d35 100644
>> --- a/backends/tpm/tpm_ioctl.h
>> +++ b/backends/tpm/tpm_ioctl.h
>> @@ -29,6 +29,16 @@
>>   
>>   typedef uint32_t ptm_res;
>>   
>> +/* PTM_GET_CAPABILITY: Get supported capabilities (ioctl's) */
>> +struct ptm_cap_n {
>> +    union {
>> +        struct {
>> +            ptm_res tpm_result; /* will always be TPM_SUCCESS (0) */
>> +            uint32_t caps;
>> +        } resp; /* response */
>> +    } u;
>> +};
> 
> The union here is pointless surely, since it only has one entry and
> the following patch doesn't add a 2nd either ?

I did this because all commands have a union.
> 
> 
> With regards,
> Daniel


  reply	other threads:[~2024-10-16 17:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 14:57 [PATCH v3 0/2] tpm: Resolve potential blocking-forever issue Stefan Berger
2024-10-16 14:57 ` [PATCH v3 1/2] tpm: Use new ptm_cap_n structure for PTM_GET_CAPABILITY Stefan Berger
2024-10-16 15:03   ` Daniel P. Berrangé
2024-10-16 17:01     ` Stefan Berger [this message]
2024-10-16 14:57 ` [PATCH v3 2/2] tpm_emulator: Read control channel response in 2 passes Stefan Berger
2024-10-16 15:16   ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5558e41c-5d22-481e-9bc7-b46cd65e5d34@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).