qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Ninad Palsule <ninad@linux.ibm.com>, qemu-devel@nongnu.org
Cc: joel@jms.id.au, andrew@aj.id.au, clg@kaod.org
Subject: Re: [PATCH 2/3] Add support for TPM devices over I2C bus
Date: Wed, 22 Mar 2023 08:05:23 -0400	[thread overview]
Message-ID: <d442b288-1f15-479d-c57a-b4a4b22753b7@linux.ibm.com> (raw)
In-Reply-To: <20230321053001.3886666-3-ninad@linux.ibm.com>



On 3/21/23 01:30, Ninad Palsule wrote:
> Qemu already supports devices attached to ISA and sysbus. This drop adds
> support for the I2C bus attached TPM devices.

> @@ -447,6 +452,15 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
>       return val;
>   }
>   
> +/*
> + * A wrapper read function so that it can be directly called without
> + * mmio.
> + */
> +uint32_t tpm_tis_read_data(TPMState *s, hwaddr addr, unsigned size)
> +{
> +    return tpm_tis_mmio_read(s, addr, size);
> +}
> +
>   /*
>    * Write a value to a register of the TIS interface
>    * See specs pages 33-63 for description of the registers
> @@ -600,6 +614,15 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
>       case TPM_TIS_REG_INT_VECTOR:
>           /* hard wired -- ignore */
>           break;
> +    case TPM_TIS_REG_DATA_CSUM_ENABLE:
> +        /*
> +         * Checksum implemented by common code so no need to set
> +         * any flags.
> +         */

Can you intercept handling this register on the I2C layer and add a byte for its value so that it can be set correctly? We do want to be able to write bit 0 to it to enable it and allow reading of bit 0 to see what the state is. I don't want this byte of state on the TIS layer since this creates state incompatibilities.

And for getting the checksum value it should be also handled on the I2C layer and ask tpm_tis_common.c to run crc_ccitt(0, s->buffer, s->rw_offset) via a function call.

    Stefan


  parent reply	other threads:[~2023-03-22 12:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  5:29 [PATCH 0/3] Add support for TPM devices over I2C bus Ninad Palsule
2023-03-21  5:29 ` [PATCH 1/3] " Ninad Palsule
2023-03-21 23:35   ` Stefan Berger
2023-03-22 11:13     ` Ninad Palsule
2023-03-21  5:30 ` [PATCH 2/3] " Ninad Palsule
2023-03-21 23:54   ` Stefan Berger
2023-03-22 11:18     ` Ninad Palsule
2023-03-22 11:24       ` Stefan Berger
2023-03-22 16:56         ` Ninad Palsule
2023-03-22 12:05   ` Stefan Berger [this message]
2023-03-22 16:58     ` Ninad Palsule
2023-03-21  5:30 ` [PATCH 3/3] " Ninad Palsule
2023-03-22  1:10   ` Stefan Berger
2023-03-22 11:26     ` Ninad Palsule
2023-03-22  1:30   ` Stefan Berger
2023-03-22 11:28     ` Ninad Palsule
2023-03-22 11:50       ` Stefan Berger
2023-03-22 13:04         ` Stefan Berger
2023-03-23  0:43           ` Ninad Palsule
2023-03-22 17:01         ` Ninad Palsule

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=d442b288-1f15-479d-c57a-b4a4b22753b7@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=ninad@linux.ibm.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).