qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/5] tpm: convert tpm_crb.c to use trace-events
Date: Mon, 5 Mar 2018 12:07:46 +0000	[thread overview]
Message-ID: <20180305120745.GG3131@work-vm> (raw)
In-Reply-To: <85dd51e6-9fa9-a369-922b-13bcb6e8d1f6@linux.vnet.ibm.com>

* Stefan Berger (stefanb@linux.vnet.ibm.com) wrote:
> On 03/05/2018 04:49 AM, Dr. David Alan Gilbert wrote:
> > * Stefan Berger (stefanb@linux.vnet.ibm.com) wrote:
> > > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > > ---
> > >   Makefile.objs       |  1 +
> > >   hw/tpm/tpm_crb.c    | 17 +++++------------
> > >   hw/tpm/trace-events |  5 +++++
> > >   3 files changed, 11 insertions(+), 12 deletions(-)
> > >   create mode 100644 hw/tpm/trace-events
> > > 
> > > diff --git a/Makefile.objs b/Makefile.objs
> > > index 5dc1348..72c3d8c 100644
> > > --- a/Makefile.objs
> > > +++ b/Makefile.objs
> > > @@ -162,6 +162,7 @@ trace-events-subdirs += hw/alpha
> > >   trace-events-subdirs += hw/hppa
> > >   trace-events-subdirs += hw/xen
> > >   trace-events-subdirs += hw/ide
> > > +trace-events-subdirs += hw/tpm
> > >   trace-events-subdirs += ui
> > >   trace-events-subdirs += audio
> > >   trace-events-subdirs += net
> > > diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
> > > index b5b8256..d8917cb 100644
> > > --- a/hw/tpm/tpm_crb.c
> > > +++ b/hw/tpm/tpm_crb.c
> > > @@ -29,6 +29,7 @@
> > >   #include "sysemu/reset.h"
> > >   #include "tpm_int.h"
> > >   #include "tpm_util.h"
> > > +#include "trace.h"
> > >   typedef struct CRBState {
> > >       DeviceState parent_obj;
> > > @@ -44,14 +45,6 @@ typedef struct CRBState {
> > >   #define CRB(obj) OBJECT_CHECK(CRBState, (obj), TYPE_TPM_CRB)
> > > -#define DEBUG_CRB 0
> > > -
> > > -#define DPRINTF(fmt, ...) do {                  \
> > > -        if (DEBUG_CRB) {                        \
> > > -            printf(fmt, ## __VA_ARGS__);        \
> > > -        }                                       \
> > > -    } while (0)
> > > -
> > >   #define CRB_INTF_TYPE_CRB_ACTIVE 0b1
> > >   #define CRB_INTF_VERSION_CRB 0b1
> > >   #define CRB_INTF_CAP_LOCALITY_0_ONLY 0b0
> > > @@ -91,8 +84,8 @@ static uint64_t tpm_crb_mmio_read(void *opaque, hwaddr addr,
> > >       unsigned offset = addr & 3;
> > >       uint32_t val = *(uint32_t *)regs >> (8 * offset);
> > > -    DPRINTF("CRB read 0x" TARGET_FMT_plx " len:%u val: 0x%" PRIx32 "\n",
> > > -            addr, size, val);
> > > +    trace_tpm_crb_mmio_read(addr, size, val);
> > > +
> > >       return val;
> > >   }
> > > @@ -100,8 +93,8 @@ static void tpm_crb_mmio_write(void *opaque, hwaddr addr,
> > >                                  uint64_t val, unsigned size)
> > >   {
> > >       CRBState *s = CRB(opaque);
> > > -    DPRINTF("CRB write 0x" TARGET_FMT_plx " len:%u val: 0x%" PRIx64 "\n",
> > > -            addr, size, val);
> > > +
> > > +    trace_tpm_crb_mmio_write(addr, size, val);
> > >       switch (addr) {
> > >       case A_CRB_CTRL_REQ:
> > > diff --git a/hw/tpm/trace-events b/hw/tpm/trace-events
> > > new file mode 100644
> > > index 0000000..336b06d
> > > --- /dev/null
> > > +++ b/hw/tpm/trace-events
> > > @@ -0,0 +1,5 @@
> > > +# See docs/devel/tracing.txt for syntax documentation.
> > > +
> > > +# hw/tpm/tpm_crb.c
> > > +tpm_crb_mmio_read(uint64_t addr, unsigned size, uint32_t val) "CRB read 0x" TARGET_FMT_plx " len:%u val: 0x%" PRIx32
> > > +tpm_crb_mmio_write(uint64_t addr, unsigned size, uint32_t val) "CRB write 0x" TARGET_FMT_plx " len:%u val: 0x%" PRIx32
> > Have you checked that builds OK on 32bit?   I think you'll need to use
> > PRIx64 there since the trace makes you use the uint64_t parameter.
> 
> It builds fines as it is.

OK, fair enough.

Dave

>   Stefan
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-03-05 12:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-04 21:56 [Qemu-devel] [PATCH 0/5] Convert the TPM code to use tracing Stefan Berger
2018-03-04 21:56 ` [Qemu-devel] [PATCH 1/5] tpm: convert tpm_crb.c to use trace-events Stefan Berger
2018-03-05  0:08   ` Philippe Mathieu-Daudé
2018-03-05  9:49   ` Dr. David Alan Gilbert
2018-03-05 12:05     ` Stefan Berger
2018-03-05 12:07       ` Dr. David Alan Gilbert [this message]
2018-03-04 21:56 ` [Qemu-devel] [PATCH 2/5] tpm: convert tpm_passthrough.c " Stefan Berger
2018-03-05  0:08   ` Philippe Mathieu-Daudé
2018-03-04 21:56 ` [Qemu-devel] [PATCH 3/5] tpm: convert tpm_util.c " Stefan Berger
2018-03-05  0:08   ` Philippe Mathieu-Daudé
2018-03-04 21:56 ` [Qemu-devel] [PATCH 4/5] tpm: convert tpm_emulator.c " Stefan Berger
2018-03-05  0:09   ` Philippe Mathieu-Daudé
2018-03-04 21:56 ` [Qemu-devel] [PATCH 5/5] tpm: convert tpm_tis.c " Stefan Berger
2018-03-05  9:32 ` [Qemu-devel] [PATCH 0/5] Convert the TPM code to use tracing Marc-André Lureau
2018-03-06 14:48 ` Stefan Hajnoczi
2018-03-07 12:53   ` 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=20180305120745.GG3131@work-vm \
    --to=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --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).