qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eauger@redhat.com>
To: eric.auger@redhat.com, Stefan Berger <stefanb@linux.ibm.com>,
	eric.auger.pro@gmail.com, stefanb@linux.vnet.ibm.com,
	qemu-devel@nongnu.org, alex.williamson@redhat.com
Cc: quintela@redhat.com, cohuck@redhat.com, f4bug@amsat.org,
	dgilbert@redhat.com, imammedo@redhat.com,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH v4 1/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region
Date: Thu, 3 Mar 2022 15:37:26 +0100	[thread overview]
Message-ID: <b475d44e-3e25-7db2-7cde-6f6061f1610d@redhat.com> (raw)
In-Reply-To: <b39a5fd1-15a5-7461-0849-4b4478f1aef5@redhat.com>

Hi Stefan,

On 2/8/22 6:58 PM, Eric Auger wrote:
> Hi Stefan,
> 
> On 2/8/22 6:16 PM, Stefan Berger wrote:
>>
>> On 2/8/22 08:38, Eric Auger wrote:
>>> Representing the CRB cmd/response buffer as a standard
>>> RAM region causes some trouble when the device is used
>>> with VFIO. Indeed VFIO attempts to DMA_MAP this region
>>> as usual RAM but this latter does not have a valid page
>>> size alignment causing such an error report:
>>> "vfio_listener_region_add received unaligned region".
>>> To allow VFIO to detect that failing dma mapping
>>> this region is not an issue, let's use a ram_device
>>> memory region type instead.
>>>
>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>> Tested-by: Stefan Berger <stefanb@linux.ibm.com>
>>> Acked-by: Stefan Berger <stefanb@linux.ibm.com>
>>> [PMD: Keep tpm_crb.c in meson's softmmu_ss]
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>>
>> v4 doesn't build for me:
>>
>> ../hw/tpm/tpm_crb.c: In function ?tpm_crb_realize?:
>> ../hw/tpm/tpm_crb.c:297:33: error: implicit declaration of function
>> ?HOST_PAGE_ALIGN? [-Werror=implicit-function-declaration]
>>   297 | HOST_PAGE_ALIGN(CRB_CTRL_CMD_SIZE));
>>       |                                 ^~~~~~~~~~~~~~~
>> ../hw/tpm/tpm_crb.c:297:33: error: nested extern declaration of
>> ?HOST_PAGE_ALIGN? [-Werror=nested-externs]
>> cc1: all warnings being treated as errors
> 
> Do you have
> b269a70810a  exec/cpu: Make host pages variables / macros 'target
> agnostic' in your tree?
I may have missed your reply. Did you have that dependency? Were you
able to compile eventually?

Besides, do you have any opinion overall about the relevance of
transforming the CRB ctrl cmd region into a RAM device wrt the TPM spec?

Again spec says:

"
Including the control structure, the three memory areas comprise the
entirety of the CRB. There are no constraints on how those three memory
areas are provided. They can all be in system RAM, or all be in device
memory, or any combination.
"
(https://trustedcomputinggroup.org/wp-content/uploads/Mobile-Command-Response-Buffer-Interface-v2-r12-Specification_FINAL2.pdf)

What was the rationale behind using RAM device for the PPI region?

There are some spurious warnings when using CRB with VFIO and that would
be nice to remove them one way or the other.

Thanks

Eric
> 
> Thanks
> 
> Eric
>>
>>
>>
> 



  reply	other threads:[~2022-03-03 14:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 13:38 [PATCH v4 0/2] TPM-CRB: Remove spurious error report when used with VFIO Eric Auger
2022-02-08 13:38 ` [PATCH v4 1/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region Eric Auger
2022-02-08 15:17   ` Peter Maydell
2022-02-08 15:56     ` Eric Auger
2022-02-08 16:01       ` Peter Maydell
2022-02-08 16:36         ` Alex Williamson
2022-02-08 17:14           ` Peter Maydell
2022-02-09  9:54             ` Eric Auger
2022-02-08 16:42         ` Eric Auger
2022-02-08 17:03   ` Dr. David Alan Gilbert
2022-02-09  9:39     ` Eric Auger
2022-02-08 17:16   ` Stefan Berger
2022-02-08 17:58     ` Eric Auger
2022-03-03 14:37       ` Eric Auger [this message]
2022-03-03 16:16         ` Marc-André Lureau
2022-03-04  9:32           ` Eric Auger
2022-02-08 13:38 ` [PATCH v4 2/2] hw/vfio/common: Silence ram device offset alignment error traces Eric Auger

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=b475d44e-3e25-7db2-7cde-6f6061f1610d@redhat.com \
    --to=eauger@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=eric.auger@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanb@linux.ibm.com \
    --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).