From: Alex Williamson <alex.williamson@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: stefanb@linux.vnet.ibm.com, cohuck@redhat.com,
qemu-devel@nongnu.org, Eric Auger <eric.auger@redhat.com>,
eric.auger.pro@gmail.com, david@gibson.dropbear.id.au
Subject: Re: [PATCH v2 1/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region
Date: Wed, 19 Jan 2022 16:13:52 -0700 [thread overview]
Message-ID: <20220119161352.7e67a4ba.alex.williamson@redhat.com> (raw)
In-Reply-To: <20ca78c8-a9f9-28f4-f1e1-255dbf384c7b@amsat.org>
On Wed, 19 Jan 2022 23:46:19 +0100
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> On 18/1/22 16:33, 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.
> >
> > The change in meson.build is required to include the
> > cpu.h header.
> >
> > Signed-off-by: Eric Auger <eric.auger@redhat.com>
> > Tested-by: Stefan Berger <stefanb@linux.ibm.com>
> >
> > ---
> >
> > v1 -> v2:
> > - Add tpm_crb_unrealize
> > ---
> > hw/tpm/meson.build | 2 +-
> > hw/tpm/tpm_crb.c | 22 ++++++++++++++++++++--
> > 2 files changed, 21 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/tpm/meson.build b/hw/tpm/meson.build
> > index 1c68d81d6a..3e74df945b 100644
> > --- a/hw/tpm/meson.build
> > +++ b/hw/tpm/meson.build
> > @@ -1,8 +1,8 @@
> > softmmu_ss.add(when: 'CONFIG_TPM_TIS', if_true: files('tpm_tis_common.c'))
> > softmmu_ss.add(when: 'CONFIG_TPM_TIS_ISA', if_true: files('tpm_tis_isa.c'))
> > softmmu_ss.add(when: 'CONFIG_TPM_TIS_SYSBUS', if_true: files('tpm_tis_sysbus.c'))
> > -softmmu_ss.add(when: 'CONFIG_TPM_CRB', if_true: files('tpm_crb.c'))
> >
> > +specific_ss.add(when: 'CONFIG_TPM_CRB', if_true: files('tpm_crb.c'))
>
> We don't need to make this file target-specific.
>
> > specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TPM_TIS'], if_true: files('tpm_ppi.c'))
> > specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TPM_CRB'], if_true: files('tpm_ppi.c'))
> > specific_ss.add(when: 'CONFIG_TPM_SPAPR', if_true: files('tpm_spapr.c'))
> > diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
> > index 58ebd1469c..6ec19a9911 100644
> > --- a/hw/tpm/tpm_crb.c
> > +++ b/hw/tpm/tpm_crb.c
> > @@ -25,6 +25,7 @@
> > #include "sysemu/tpm_backend.h"
> > #include "sysemu/tpm_util.h"
> > #include "sysemu/reset.h"
> > +#include "cpu.h"
> > #include "tpm_prop.h"
> > #include "tpm_ppi.h"
> > #include "trace.h"
> > @@ -43,6 +44,7 @@ struct CRBState {
> >
> > bool ppi_enabled;
> > TPMPPI ppi;
> > + uint8_t *crb_cmd_buf;
> > };
> > typedef struct CRBState CRBState;
> >
> > @@ -291,10 +293,14 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)
> > return;
> > }
> >
> > + s->crb_cmd_buf = qemu_memalign(ç,
> > + HOST_PAGE_ALIGN(CRB_CTRL_CMD_SIZE));
>
> HOST_PAGE_ALIGN() and qemu_real_host_page_size() actually belong
> to "exec/cpu-common.h".
>
> Alex, could you hold on a few days for this patch? I am going to send
> a cleanup series. Otherwise no worry, I will clean this on top too.
Sure. Thanks,
Alex
next prev parent reply other threads:[~2022-01-19 23:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 15:33 [PATCH v2 0/2] TPM-CRB: Remove spurious error report when used with VFIO Eric Auger
2022-01-18 15:33 ` [PATCH v2 1/2] tpm: CRB: Use ram_device for "tpm-crb-cmd" region Eric Auger
2022-01-19 22:46 ` Philippe Mathieu-Daudé via
2022-01-19 23:13 ` Alex Williamson [this message]
2022-01-18 15:33 ` [PATCH v2 2/2] hw/vfio/common: Silence ram device offset alignment error traces Eric Auger
2022-01-19 20:13 ` Alex Williamson
2022-01-19 20:40 ` Stefan Berger
2022-01-19 20:40 ` [PATCH v2 0/2] TPM-CRB: Remove spurious error report when used with VFIO Stefan Berger
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=20220119161352.7e67a4ba.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=f4bug@amsat.org \
--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).