qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] pci: add config space access traces
@ 2013-08-21  4:42 Alexey Kardashevskiy
  2013-08-27  7:48 ` Alexey Kardashevskiy
  2013-08-27  8:23 ` Michael S. Tsirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2013-08-21  4:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Michael S . Tsirkin

This adds pci_cfg_read and pci_cfg_write traces for config spaces accesses.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* added slot and function numbers into traces
* added arrows in trace strings
---
 hw/pci/pci_host.c | 11 ++++++++++-
 trace-events      |  4 ++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index 7dd9b25..77c7d1f 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -20,6 +20,7 @@
 
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
+#include "trace.h"
 
 /* debug PCI */
 //#define DEBUG_PCI
@@ -51,14 +52,22 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
                                   uint32_t limit, uint32_t val, uint32_t len)
 {
     assert(len <= 4);
+    trace_pci_cfg_write(pci_dev->name, PCI_SLOT(pci_dev->devfn),
+                        PCI_FUNC(pci_dev->devfn), addr, val);
     pci_dev->config_write(pci_dev, addr, val, MIN(len, limit - addr));
 }
 
 uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
                                      uint32_t limit, uint32_t len)
 {
+    uint32_t ret;
+
     assert(len <= 4);
-    return pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
+    ret = pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
+    trace_pci_cfg_read(pci_dev->name, PCI_SLOT(pci_dev->devfn),
+                       PCI_FUNC(pci_dev->devfn), addr, ret);
+
+    return ret;
 }
 
 void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
diff --git a/trace-events b/trace-events
index 3856b5c..9d1d1df 100644
--- a/trace-events
+++ b/trace-events
@@ -1176,3 +1176,7 @@ object_class_dynamic_cast_assert(const char *type, const char *target, const cha
 # hw/xen/xen_pvdevice.c
 xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
 xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
+
+# hw/pci/pci_host.c
+pci_cfg_read(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x -> 0x%x"
+pci_cfg_write(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x <- 0x%x"
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] pci: add config space access traces
  2013-08-21  4:42 [Qemu-devel] [PATCH v2] pci: add config space access traces Alexey Kardashevskiy
@ 2013-08-27  7:48 ` Alexey Kardashevskiy
  2013-08-27  8:22   ` Michael S. Tsirkin
  2013-08-27  8:23 ` Michael S. Tsirkin
  1 sibling, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2013-08-27  7:48 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-devel, Michael S . Tsirkin

On 08/21/2013 02:42 PM, Alexey Kardashevskiy wrote:
> This adds pci_cfg_read and pci_cfg_write traces for config spaces accesses.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v2:
> * added slot and function numbers into traces
> * added arrows in trace strings
> ---
>  hw/pci/pci_host.c | 11 ++++++++++-
>  trace-events      |  4 ++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
> index 7dd9b25..77c7d1f 100644
> --- a/hw/pci/pci_host.c
> +++ b/hw/pci/pci_host.c
> @@ -20,6 +20,7 @@
>  
>  #include "hw/pci/pci.h"
>  #include "hw/pci/pci_host.h"
> +#include "trace.h"
>  
>  /* debug PCI */
>  //#define DEBUG_PCI
> @@ -51,14 +52,22 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
>                                    uint32_t limit, uint32_t val, uint32_t len)
>  {
>      assert(len <= 4);
> +    trace_pci_cfg_write(pci_dev->name, PCI_SLOT(pci_dev->devfn),
> +                        PCI_FUNC(pci_dev->devfn), addr, val);
>      pci_dev->config_write(pci_dev, addr, val, MIN(len, limit - addr));
>  }
>  
>  uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
>                                       uint32_t limit, uint32_t len)
>  {
> +    uint32_t ret;
> +
>      assert(len <= 4);
> -    return pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
> +    ret = pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
> +    trace_pci_cfg_read(pci_dev->name, PCI_SLOT(pci_dev->devfn),
> +                       PCI_FUNC(pci_dev->devfn), addr, ret);
> +
> +    return ret;
>  }
>  
>  void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
> diff --git a/trace-events b/trace-events
> index 3856b5c..9d1d1df 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -1176,3 +1176,7 @@ object_class_dynamic_cast_assert(const char *type, const char *target, const cha
>  # hw/xen/xen_pvdevice.c
>  xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
>  xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
> +
> +# hw/pci/pci_host.c
> +pci_cfg_read(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x -> 0x%x"
> +pci_cfg_write(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x <- 0x%x"
> 

Michael, what's about this patch? Pretty trivial :) Thanks.



-- 
Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] pci: add config space access traces
  2013-08-27  7:48 ` Alexey Kardashevskiy
@ 2013-08-27  8:22   ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2013-08-27  8:22 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-devel

On Tue, Aug 27, 2013 at 05:48:35PM +1000, Alexey Kardashevskiy wrote:
> On 08/21/2013 02:42 PM, Alexey Kardashevskiy wrote:
> > This adds pci_cfg_read and pci_cfg_write traces for config spaces accesses.
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > ---
> > Changes:
> > v2:
> > * added slot and function numbers into traces
> > * added arrows in trace strings
> > ---
> >  hw/pci/pci_host.c | 11 ++++++++++-
> >  trace-events      |  4 ++++
> >  2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
> > index 7dd9b25..77c7d1f 100644
> > --- a/hw/pci/pci_host.c
> > +++ b/hw/pci/pci_host.c
> > @@ -20,6 +20,7 @@
> >  
> >  #include "hw/pci/pci.h"
> >  #include "hw/pci/pci_host.h"
> > +#include "trace.h"
> >  
> >  /* debug PCI */
> >  //#define DEBUG_PCI
> > @@ -51,14 +52,22 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
> >                                    uint32_t limit, uint32_t val, uint32_t len)
> >  {
> >      assert(len <= 4);
> > +    trace_pci_cfg_write(pci_dev->name, PCI_SLOT(pci_dev->devfn),
> > +                        PCI_FUNC(pci_dev->devfn), addr, val);
> >      pci_dev->config_write(pci_dev, addr, val, MIN(len, limit - addr));
> >  }
> >  
> >  uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
> >                                       uint32_t limit, uint32_t len)
> >  {
> > +    uint32_t ret;
> > +
> >      assert(len <= 4);
> > -    return pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
> > +    ret = pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
> > +    trace_pci_cfg_read(pci_dev->name, PCI_SLOT(pci_dev->devfn),
> > +                       PCI_FUNC(pci_dev->devfn), addr, ret);
> > +
> > +    return ret;
> >  }
> >  
> >  void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
> > diff --git a/trace-events b/trace-events
> > index 3856b5c..9d1d1df 100644
> > --- a/trace-events
> > +++ b/trace-events
> > @@ -1176,3 +1176,7 @@ object_class_dynamic_cast_assert(const char *type, const char *target, const cha
> >  # hw/xen/xen_pvdevice.c
> >  xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
> >  xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
> > +
> > +# hw/pci/pci_host.c
> > +pci_cfg_read(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x -> 0x%x"
> > +pci_cfg_write(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x <- 0x%x"
> > 
> 
> Michael, what's about this patch? Pretty trivial :) Thanks.
> 

I thought I responded but apparently didn't send it out.
Will reply to the original mail.

> 
> -- 
> Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] pci: add config space access traces
  2013-08-21  4:42 [Qemu-devel] [PATCH v2] pci: add config space access traces Alexey Kardashevskiy
  2013-08-27  7:48 ` Alexey Kardashevskiy
@ 2013-08-27  8:23 ` Michael S. Tsirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2013-08-27  8:23 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-devel

On Wed, Aug 21, 2013 at 02:42:06PM +1000, Alexey Kardashevskiy wrote:
> This adds pci_cfg_read and pci_cfg_write traces for config spaces accesses.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---

Applied, thanks.

> Changes:
> v2:
> * added slot and function numbers into traces
> * added arrows in trace strings
> ---
>  hw/pci/pci_host.c | 11 ++++++++++-
>  trace-events      |  4 ++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
> index 7dd9b25..77c7d1f 100644
> --- a/hw/pci/pci_host.c
> +++ b/hw/pci/pci_host.c
> @@ -20,6 +20,7 @@
>  
>  #include "hw/pci/pci.h"
>  #include "hw/pci/pci_host.h"
> +#include "trace.h"
>  
>  /* debug PCI */
>  //#define DEBUG_PCI
> @@ -51,14 +52,22 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
>                                    uint32_t limit, uint32_t val, uint32_t len)
>  {
>      assert(len <= 4);
> +    trace_pci_cfg_write(pci_dev->name, PCI_SLOT(pci_dev->devfn),
> +                        PCI_FUNC(pci_dev->devfn), addr, val);
>      pci_dev->config_write(pci_dev, addr, val, MIN(len, limit - addr));
>  }
>  
>  uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
>                                       uint32_t limit, uint32_t len)
>  {
> +    uint32_t ret;
> +
>      assert(len <= 4);
> -    return pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
> +    ret = pci_dev->config_read(pci_dev, addr, MIN(len, limit - addr));
> +    trace_pci_cfg_read(pci_dev->name, PCI_SLOT(pci_dev->devfn),
> +                       PCI_FUNC(pci_dev->devfn), addr, ret);
> +
> +    return ret;
>  }
>  
>  void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
> diff --git a/trace-events b/trace-events
> index 3856b5c..9d1d1df 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -1176,3 +1176,7 @@ object_class_dynamic_cast_assert(const char *type, const char *target, const cha
>  # hw/xen/xen_pvdevice.c
>  xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
>  xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
> +
> +# hw/pci/pci_host.c
> +pci_cfg_read(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x -> 0x%x"
> +pci_cfg_write(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x <- 0x%x"
> -- 
> 1.8.3.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-27  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21  4:42 [Qemu-devel] [PATCH v2] pci: add config space access traces Alexey Kardashevskiy
2013-08-27  7:48 ` Alexey Kardashevskiy
2013-08-27  8:22   ` Michael S. Tsirkin
2013-08-27  8:23 ` Michael S. Tsirkin

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).