qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/3] tpm-ppi: page-align PPI RAM


From: Marc-André Lureau
Subject: Re: [PATCH v2 2/3] tpm-ppi: page-align PPI RAM
Date: Wed, 8 Jan 2020 16:49:32 +0400

Hi

On Wed, Jan 8, 2020 at 3:29 PM Dr. David Alan Gilbert
<address@hidden> wrote:
>
> * Dr. David Alan Gilbert (address@hidden) wrote:
> > * Marc-André Lureau (address@hidden) wrote:
> > > post-copy migration fails on destination with error such as:
> > > 2019-12-26T10:22:44.714644Z qemu-kvm: ram_block_discard_range:
> > > Unaligned start address: 0x559d2afae9a0
> >
> > Ah good, we got a sane error message!
> >
> > > Use qemu_memalign() to constrain the PPI RAM memory alignment.
> > >
> > > Cc: address@hidden
> > > Signed-off-by: Marc-André Lureau <address@hidden>
> > > Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> > > ---
> > >  hw/tpm/tpm_ppi.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c
> > > index ff314592b4..6d9c1a3e40 100644
> > > --- a/hw/tpm/tpm_ppi.c
> > > +++ b/hw/tpm/tpm_ppi.c
> > > @@ -43,7 +43,8 @@ void tpm_ppi_reset(TPMPPI *tpmppi)
> > >  void tpm_ppi_init(TPMPPI *tpmppi, struct MemoryRegion *m,
> > >                    hwaddr addr, Object *obj)
> > >  {
> > > -    tpmppi->buf = g_malloc0(HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE));
> > > +    tpmppi->buf = qemu_memalign(qemu_real_host_page_size,
> > > +                                HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE));
> >
> > Reviewed-by: Dr. David Alan Gilbert <address@hidden>
>
> I just noticed a bit in the CODING_STYLE that says:
>
>   Memory allocated by qemu_memalign or qemu_blockalign must be freed with
>   qemu_vfree, since breaking this will cause problems on Win32.
>
> so I guess this is wrong?

The buf is not freed, TPM are not hotpluggable. For strictness, we
could have a finalize later.

>
> Dave
>
> >
> > >      memory_region_init_ram_device_ptr(&tpmppi->ram, obj, "tpm-ppi",
> > >                                        TPM_PPI_ADDR_SIZE, tpmppi->buf);
> > >      vmstate_register_ram(&tpmppi->ram, DEVICE(obj));
> > > --
> > > 2.24.0.308.g228f53135a
> > >
> > --
> > Dr. David Alan Gilbert / address@hidden / Manchester, UK
> --
> Dr. David Alan Gilbert / address@hidden / Manchester, UK
>
>


-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]