qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: QEMU <qemu-devel@nongnu.org>,
	Amarnath Valluri <amarnath.valluri@intel.com>
Subject: Re: [Qemu-devel] [PATCH v3 06/13] tpm_tis: move r/w_offsets to TPMState
Date: Thu, 21 Dec 2017 09:44:11 -0500	[thread overview]
Message-ID: <a587de86-84cc-72f5-e541-1c7597c0f1dc@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAJ+F1CKg3G-JUZDPOK66GDwmL7d=JsjechKd=Xin7CvAVo0UuA@mail.gmail.com>

On 12/21/2017 09:41 AM, Marc-André Lureau wrote:
> Hi
>
> On Fri, Nov 10, 2017 at 3:11 PM, Stefan Berger
> <stefanb@linux.vnet.ibm.com> wrote:
>> Now that we have a single buffer, we also only need a single set of
>> read/write offsets into that buffer. This works since only one
>> locality can be active.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>> ---
>>   hw/tpm/tpm_tis.c | 57 +++++++++++++++++++++++++++-----------------------------
>>   1 file changed, 27 insertions(+), 30 deletions(-)
>>
>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>> index 0b6dd7f..dfdddd3 100644
>> waddr addr,
>>               }
>>
>>               while ((s->loc[locty].sts & TPM_TIS_STS_EXPECT) && size > 0) {
>> -                if (s->loc[locty].w_offset < s->be_buffer_size) {
>> -                    s->buffer[s->loc[locty].w_offset++] =
>> +                if (s->w_offset < s->be_buffer_size) {
>> +                    s->buffer[s->w_offset++] =
>>                           (uint8_t)val;
>>                       val >>= 8;
>>                       size--;
>> @@ -931,13 +928,13 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
>>               }
>>
>>               /* check for complete packet */
>> -            if (s->loc[locty].w_offset > 5 &&
>> +            if (s->w_offset > 5 &&
>>                   (s->loc[locty].sts & TPM_TIS_STS_EXPECT)) {
>>                   /* we have a packet length - see if we have all of it */
>>                   bool need_irq = !(s->loc[locty].sts & TPM_TIS_STS_VALID);
>>
>>                   len = tpm_cmd_get_size(&s->buffer);
>> -                if (len > s->loc[locty].w_offset) {
>> +                if (len > s->w_offset) {
>>                       tpm_tis_sts_set(&s->loc[locty],
>>                                       TPM_TIS_STS_EXPECT | TPM_TIS_STS_VALID);
>>                   } else {
>> @@ -1022,8 +1019,8 @@ static void tpm_tis_reset(DeviceState *dev)
>>           s->loc[c].ints = 0;
>>           s->loc[c].state = TPM_TIS_STATE_IDLE;
>>
>> -        s->loc[c].w_offset = 0;
>> -        s->loc[c].r_offset = 0;
>> +        s->w_offset = 0;
>> +        s->r_offset = 0;
>>       }
>>
>>       tpm_tis_do_startup_tpm(s, s->be_buffer_size);
>> --
>> 2.5.5
>>
>>
> Looks good, but I wonder why it's not part of "tpm_tis: move buffers
> from localities into common location"
>
> Not a big deal though, so
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

I thought it may be easier to review/follow if I do all these steps 
separately. I could squash it together.


    Stefan

>
>
>

  reply	other threads:[~2017-12-21 14:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 14:11 [Qemu-devel] [PATCH v3 00/13] tpm: Extend TPM with state migration support (not 2.11) Stefan Berger
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 01/13] tpm_tis: convert uint32_t to size_t Stefan Berger
2017-12-21 14:11   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 02/13] tpm_tis: limit size of buffer from backend Stefan Berger
2017-12-21 14:11   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 03/13] tpm_tis: remove TPMSizeBuffer usage Stefan Berger
2017-12-21 14:11   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 04/13] tpm_tis: move buffers from localities into common location Stefan Berger
2017-12-21 14:11   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 05/13] tpm_tis: merge read and write buffer into single buffer Stefan Berger
2017-12-21 14:41   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 06/13] tpm_tis: move r/w_offsets to TPMState Stefan Berger
2017-12-21 14:41   ` Marc-André Lureau
2017-12-21 14:44     ` Stefan Berger [this message]
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 07/13] tpm_tis: merge r/w_offset into rw_offset Stefan Berger
2017-12-21 14:41   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 08/13] tpm: Implement tpm_sized_buffer_reset Stefan Berger
2017-12-21 14:44   ` Marc-André Lureau
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 09/13] tpm: Introduce condition to notify waiters of completed command Stefan Berger
2017-12-22 13:24   ` Marc-André Lureau
2017-12-27 14:17     ` Stefan Berger
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 10/13] tpm: Introduce condition in TPM backend for notification Stefan Berger
2017-12-27 14:19   ` Stefan Berger
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 11/13] tpm: implement tpm_backend_wait_cmd_completed Stefan Berger
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 12/13] tpm: extend TPM emulator with state migration support Stefan Berger
2017-11-10 14:11 ` [Qemu-devel] [PATCH v3 13/13] tpm_tis: extend TPM TIS " Stefan Berger
2017-12-22 12:49 ` [Qemu-devel] [PATCH v3 00/13] tpm: Extend TPM with state migration support (not 2.11) Marc-André Lureau
2017-12-22 15:59   ` Stefan Berger
2017-12-22 16:13     ` Marc-André Lureau
2017-12-22 17:47       ` Stefan Berger
2017-12-22 17:52         ` Marc-André Lureau
2017-12-22 19:18           ` Stefan Berger
2017-12-27 15:00       ` Stefan Berger

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=a587de86-84cc-72f5-e541-1c7597c0f1dc@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=amarnath.valluri@intel.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).