From: Stefan Berger <stefanb@linux.ibm.com>
To: Joelle van Dyne <j@getutm.app>, qemu-devel@nongnu.org
Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: Re: [PATCH v2 04/11] tpm_crb: use a single read-as-mem/write-as-mmio mapping
Date: Fri, 14 Jul 2023 08:03:05 -0400 [thread overview]
Message-ID: <89abcf2c-e34e-ed0c-8f90-c2469dbcf860@linux.ibm.com> (raw)
In-Reply-To: <20230714070931.23476-5-j@getutm.app>
On 7/14/23 03:09, Joelle van Dyne wrote:
> On Apple Silicon, when Windows performs a LDP on the CRB MMIO space,
> the exception is not decoded by hardware and we cannot trap the MMIO
> read. This led to the idea from @agraf to use the same mapping type as
> ROM devices: namely that reads should be seen as memory type and
> writes should trap as MMIO.
>
> Once that was done, the second memory mapping of the command buffer
> region was redundent and was removed.
>
> A note about the removal of the read trap for `CRB_LOC_STATE`:
> The only usage was to return the most up-to-date value for
> `tpmEstablished`. However, `tpmEstablished` is only cleared when a
> TPM2_HashStart operation is called which only exists for locality 4.
> We do not handle locality 4. Indeed, the comment for the write handler
> of `CRB_LOC_CTRL` makes the same argument for why it is not calling
> the backend to reset the `tpmEstablished` bit (to 1).
> As this bit is unused, we do not need to worry about updating it for
> reads.
>
> Signed-off-by: Joelle van Dyne <j@getutm.app>
> ---
> hw/tpm/tpm_crb.h | 2 -
> hw/tpm/tpm_crb.c | 3 -
> hw/tpm/tpm_crb_common.c | 126 +++++++++++++++++++++-------------------
> 3 files changed, 65 insertions(+), 66 deletions(-)
>
> diff --git a/hw/tpm/tpm_crb.h b/hw/tpm/tpm_crb.h
> index da3a0cf256..7cdd37335f 100644
> --- a/hw/tpm/tpm_crb.h
> +++ b/hw/tpm/tpm_crb.h
> @@ -26,9 +26,7 @@
> typedef struct TPMCRBState {
> TPMBackend *tpmbe;
> TPMBackendCmd cmd;
> - uint32_t regs[TPM_CRB_R_MAX];
> MemoryRegion mmio;
> - MemoryRegion cmdmem;
>
> size_t be_buffer_size;
>
> diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
> index 598c3e0161..07c6868d8d 100644
> --- a/hw/tpm/tpm_crb.c
> +++ b/hw/tpm/tpm_crb.c
> @@ -68,7 +68,6 @@ static const VMStateDescription vmstate_tpm_crb_none = {
> .name = "tpm-crb",
> .pre_save = tpm_crb_none_pre_save,
> .fields = (VMStateField[]) {
> - VMSTATE_UINT32_ARRAY(state.regs, CRBState, TPM_CRB_R_MAX),
The same comment as stated on v1 still applies, this part has to stay since VM state contains it:
2023-07-14T12:01:38.005199Z qemu-system-x86_64: Unknown ramblock "tpm-crb-cmd", cannot accept migration
2023-07-14T12:01:38.005318Z qemu-system-x86_64: error while loading state for instance 0x0 of device 'ram'
2023-07-14T12:01:38.005350Z qemu-system-x86_64: load of migration failed: Invalid argument
Stefan
next prev parent reply other threads:[~2023-07-14 12:04 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 7:09 [PATCH v2 00/11] tpm: introduce TPM CRB SysBus device Joelle van Dyne
2023-07-14 7:09 ` [PATCH v2 01/11] tpm_crb: refactor common code Joelle van Dyne
2023-07-14 7:09 ` [PATCH v2 02/11] tpm_crb: CTRL_RSP_ADDR is 64-bits wide Joelle van Dyne
2023-07-14 7:09 ` [PATCH v2 03/11] tpm_ppi: refactor memory space initialization Joelle van Dyne
2023-07-14 7:09 ` [PATCH v2 04/11] tpm_crb: use a single read-as-mem/write-as-mmio mapping Joelle van Dyne
2023-07-14 12:03 ` Stefan Berger [this message]
2023-07-14 7:09 ` [PATCH v2 05/11] tpm_crb: use the ISA bus Joelle van Dyne
2023-07-17 13:46 ` Igor Mammedov
2023-07-18 14:16 ` Stefan Berger
2023-08-01 1:46 ` Joelle van Dyne
2023-10-17 14:24 ` Alexander Graf
2023-07-14 7:09 ` [PATCH v2 06/11] tpm_crb: move ACPI table building to device interface Joelle van Dyne
2023-07-14 17:21 ` Stefan Berger
2023-07-17 13:42 ` Igor Mammedov
2023-08-01 3:02 ` Joelle van Dyne
2023-08-01 19:38 ` Stefan Berger
2023-08-07 10:20 ` Igor Mammedov
2023-07-14 7:09 ` [PATCH v2 07/11] hw/arm/virt: add plug handler for TPM on SysBus Joelle van Dyne
2023-07-14 12:11 ` Stefan Berger
2023-07-14 17:09 ` Joelle van Dyne
2023-07-17 14:00 ` Igor Mammedov
2023-07-14 7:09 ` [PATCH v2 08/11] hw/loongarch/virt: " Joelle van Dyne
2023-07-20 17:57 ` Stefan Berger
2023-08-03 11:35 ` Stefan Berger
2023-07-14 7:09 ` [PATCH v2 09/11] tpm_tis_sysbus: move DSDT AML generation to device Joelle van Dyne
2023-07-14 16:19 ` Stefan Berger
2023-07-14 17:29 ` Joelle van Dyne
2023-07-14 17:37 ` Stefan Berger
2023-07-14 17:39 ` Joelle van Dyne
2023-07-14 17:43 ` Stefan Berger
2023-07-14 17:46 ` Joelle van Dyne
2023-07-14 18:01 ` Stefan Berger
2023-07-14 18:15 ` Joelle van Dyne
2023-07-17 14:06 ` Igor Mammedov
2023-07-14 7:09 ` [PATCH v2 10/11] tpm_crb_sysbus: introduce TPM CRB SysBus device Joelle van Dyne
2023-07-14 14:27 ` Stefan Berger
2023-07-14 17:20 ` Joelle van Dyne
2023-07-14 17:52 ` Stefan Berger
2023-07-17 14:23 ` Igor Mammedov
2023-10-29 2:21 ` Joelle van Dyne
2023-07-14 7:09 ` [PATCH v2 11/11] tpm_crb: support restoring older vmstate Joelle van Dyne
2023-07-14 14:05 ` Stefan Berger
2023-07-14 14:51 ` Stefan Berger
2023-07-14 17:04 ` Joelle van Dyne
2023-07-14 18:22 ` Stefan Berger
2023-07-14 18:41 ` Stefan Berger
2023-07-14 18:49 ` Joelle van Dyne
2023-07-14 19:12 ` Stefan Berger
2023-07-14 19:44 ` Joelle van Dyne
2023-07-14 19:56 ` Stefan Berger
2023-07-17 14:40 ` Peter Maydell
2023-07-17 14:33 ` Igor Mammedov
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=89abcf2c-e34e-ed0c-8f90-c2469dbcf860@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=j@getutm.app \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
/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).