[PATCH v3 0/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region

Philippe Mathieu-Daudé posted 2 patches 2 years, 2 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220120001242.230082-1-f4bug@amsat.org
hw/tpm/tpm_crb.c     | 22 ++++++++++++++++++++--
hw/vfio/common.c     | 15 ++++++++++++++-
hw/vfio/trace-events |  1 +
3 files changed, 35 insertions(+), 3 deletions(-)
[PATCH v3 0/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region
Posted by Philippe Mathieu-Daudé 2 years, 2 months ago
This is a respin of Eric's work, but not making tpm_crb.c target
specific.

Based-on: <20220120000836.229419-1-f4bug@amsat.org>
"exec/cpu: Make host pages variables / macros 'target agnostic'"
https://lore.kernel.org/qemu-devel/20220120000836.229419-1-f4bug@amsat.org/

--

Eric's v2 cover:

This series aims at removing a spurious error message we get when
launching a guest with a TPM-CRB device and VFIO-PCI devices.

The CRB command buffer currently is a RAM MemoryRegion and given
its base address alignment, it causes an error report on
vfio_listener_region_add(). This series proposes to use a ram-device
region instead which helps in better assessing the dma map error
failure on VFIO side.

Eric Auger (2):
  tpm: CRB: Use ram_device for "tpm-crb-cmd" region
  hw/vfio/common: Silence ram device offset alignment error traces

 hw/tpm/tpm_crb.c     | 22 ++++++++++++++++++++--
 hw/vfio/common.c     | 15 ++++++++++++++-
 hw/vfio/trace-events |  1 +
 3 files changed, 35 insertions(+), 3 deletions(-)

-- 
2.34.1

Re: [PATCH v3 0/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region
Posted by Alex Williamson 2 years, 2 months ago
On Thu, 20 Jan 2022 01:12:40 +0100
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> This is a respin of Eric's work, but not making tpm_crb.c target
> specific.
> 
> Based-on: <20220120000836.229419-1-f4bug@amsat.org>
> "exec/cpu: Make host pages variables / macros 'target agnostic'"
> https://lore.kernel.org/qemu-devel/20220120000836.229419-1-f4bug@amsat.org/
> 
> --
> 
> Eric's v2 cover:
> 
> This series aims at removing a spurious error message we get when
> launching a guest with a TPM-CRB device and VFIO-PCI devices.
> 
> The CRB command buffer currently is a RAM MemoryRegion and given
> its base address alignment, it causes an error report on
> vfio_listener_region_add(). This series proposes to use a ram-device
> region instead which helps in better assessing the dma map error
> failure on VFIO side.
> 
> Eric Auger (2):
>   tpm: CRB: Use ram_device for "tpm-crb-cmd" region
>   hw/vfio/common: Silence ram device offset alignment error traces
> 
>  hw/tpm/tpm_crb.c     | 22 ++++++++++++++++++++--
>  hw/vfio/common.c     | 15 ++++++++++++++-
>  hw/vfio/trace-events |  1 +
>  3 files changed, 35 insertions(+), 3 deletions(-)
> 

Unfortunately, FTB:

../hw/tpm/tpm_crb.c: In function ‘tpm_crb_realize’:
../hw/tpm/tpm_crb.c:297:33: warning: implicit declaration of function ‘HOST_PAGE_ALIGN’ [-Wimplicit-function-declaration]
  297 |                                 HOST_PAGE_ALIGN(CRB_CTRL_CMD_SIZE));
      |                                 ^~~~~~~~~~~~~~~
../hw/tpm/tpm_crb.c:297:33: warning: nested extern declaration of ‘HOST_PAGE_ALIGN’ [-Wnested-externs]

This is a regression since Eric's v2.  Thanks,

Alex


Re: [PATCH v3 0/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region
Posted by Philippe Mathieu-Daudé via 2 years, 2 months ago
Hi Alex,

On 27/1/22 00:51, Alex Williamson wrote:
> On Thu, 20 Jan 2022 01:12:40 +0100
> Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> 
>> This is a respin of Eric's work, but not making tpm_crb.c target
>> specific.
>>
>> Based-on: <20220120000836.229419-1-f4bug@amsat.org>
>> "exec/cpu: Make host pages variables / macros 'target agnostic'"
>> https://lore.kernel.org/qemu-devel/20220120000836.229419-1-f4bug@amsat.org/

[*]

>> --
>>
>> Eric's v2 cover:
>>
>> This series aims at removing a spurious error message we get when
>> launching a guest with a TPM-CRB device and VFIO-PCI devices.
>>
>> The CRB command buffer currently is a RAM MemoryRegion and given
>> its base address alignment, it causes an error report on
>> vfio_listener_region_add(). This series proposes to use a ram-device
>> region instead which helps in better assessing the dma map error
>> failure on VFIO side.
>>
>> Eric Auger (2):
>>    tpm: CRB: Use ram_device for "tpm-crb-cmd" region
>>    hw/vfio/common: Silence ram device offset alignment error traces
>>
>>   hw/tpm/tpm_crb.c     | 22 ++++++++++++++++++++--
>>   hw/vfio/common.c     | 15 ++++++++++++++-
>>   hw/vfio/trace-events |  1 +
>>   3 files changed, 35 insertions(+), 3 deletions(-)
>>
> 
> Unfortunately, FTB:
> 
> ../hw/tpm/tpm_crb.c: In function ‘tpm_crb_realize’:
> ../hw/tpm/tpm_crb.c:297:33: warning: implicit declaration of function ‘HOST_PAGE_ALIGN’ [-Wimplicit-function-declaration]
>    297 |                                 HOST_PAGE_ALIGN(CRB_CTRL_CMD_SIZE));
>        |                                 ^~~~~~~~~~~~~~~
> ../hw/tpm/tpm_crb.c:297:33: warning: nested extern declaration of ‘HOST_PAGE_ALIGN’ [-Wnested-externs]
> 
> This is a regression since Eric's v2.  Thanks,

This series is based on another patch that Paolo already queued
(see [*] earlier).

Next time I'll try to make it more explicit.

Regards,

Phil.

Re: [PATCH v3 0/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region
Posted by Alex Williamson 2 years, 2 months ago
On Thu, 27 Jan 2022 08:51:15 +0100
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> Hi Alex,
> 
> On 27/1/22 00:51, Alex Williamson wrote:
> > On Thu, 20 Jan 2022 01:12:40 +0100
> > Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> >   
> >> This is a respin of Eric's work, but not making tpm_crb.c target
> >> specific.
> >>
> >> Based-on: <20220120000836.229419-1-f4bug@amsat.org>
> >> "exec/cpu: Make host pages variables / macros 'target agnostic'"
> >> https://lore.kernel.org/qemu-devel/20220120000836.229419-1-f4bug@amsat.org/  
> 
> [*]
> 
> >> --
> >>
> >> Eric's v2 cover:
> >>
> >> This series aims at removing a spurious error message we get when
> >> launching a guest with a TPM-CRB device and VFIO-PCI devices.
> >>
> >> The CRB command buffer currently is a RAM MemoryRegion and given
> >> its base address alignment, it causes an error report on
> >> vfio_listener_region_add(). This series proposes to use a ram-device
> >> region instead which helps in better assessing the dma map error
> >> failure on VFIO side.
> >>
> >> Eric Auger (2):
> >>    tpm: CRB: Use ram_device for "tpm-crb-cmd" region
> >>    hw/vfio/common: Silence ram device offset alignment error traces
> >>
> >>   hw/tpm/tpm_crb.c     | 22 ++++++++++++++++++++--
> >>   hw/vfio/common.c     | 15 ++++++++++++++-
> >>   hw/vfio/trace-events |  1 +
> >>   3 files changed, 35 insertions(+), 3 deletions(-)
> >>  
> > 
> > Unfortunately, FTB:
> > 
> > ../hw/tpm/tpm_crb.c: In function ‘tpm_crb_realize’:
> > ../hw/tpm/tpm_crb.c:297:33: warning: implicit declaration of function ‘HOST_PAGE_ALIGN’ [-Wimplicit-function-declaration]
> >    297 |                                 HOST_PAGE_ALIGN(CRB_CTRL_CMD_SIZE));
> >        |                                 ^~~~~~~~~~~~~~~
> > ../hw/tpm/tpm_crb.c:297:33: warning: nested extern declaration of ‘HOST_PAGE_ALIGN’ [-Wnested-externs]
> > 
> > This is a regression since Eric's v2.  Thanks,  
> 
> This series is based on another patch that Paolo already queued
> (see [*] earlier).
> 
> Next time I'll try to make it more explicit.

Sorry I missed that.  Since Paolo now has that pending in a pull
request I'll try again next week.  Thanks,

Alex