diff mbox series

[10/11] hw/block/fdc: Convert from FLOPPY_DPRINTF() macro to trace events

Message ID 20180621171257.14897-11-f4bug@amsat.org
State New
Headers show
Series hw: various conversions to trace-events | expand

Commit Message

Philippe Mathieu-Daudé June 21, 2018, 5:12 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/block/fdc.c        | 6 +++---
 hw/block/trace-events | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

John Snow June 21, 2018, 5:41 p.m. UTC | #1
On 06/21/2018 01:12 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/block/fdc.c        | 6 +++---
>  hw/block/trace-events | 4 ++++
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
> index cd29e27d8f..c7b4fe9b3e 100644
> --- a/hw/block/fdc.c
> +++ b/hw/block/fdc.c
> @@ -40,6 +40,7 @@
>  #include "sysemu/blockdev.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/log.h"
> +#include "trace.h"
>  
>  /********************************************************/
>  /* debug Floppy devices */
> @@ -934,7 +935,7 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg)
>          retval = (uint32_t)(-1);
>          break;
>      }
> -    FLOPPY_DPRINTF("read reg%d: 0x%02x\n", reg & 7, retval);
> +    trace_fdc_ioport_read(reg, retval);

Earlier in this function we've already masked the register number, which
is not clear from context.

Reviewed-by: John Snow <jsnow@redhat.com>

(and ACK, to whomever stages this outside of my branch. --js)

>  
>      return retval;
>  }
> @@ -943,9 +944,8 @@ static void fdctrl_write (void *opaque, uint32_t reg, uint32_t value)
>  {
>      FDCtrl *fdctrl = opaque;
>  
> -    FLOPPY_DPRINTF("write reg%d: 0x%02x\n", reg & 7, value);
> -
>      reg &= 7;
> +    trace_fdc_ioport_write(reg, value);
>      switch (reg) {
>      case FD_REG_DOR:
>          fdctrl_write_dor(fdctrl, value);
> diff --git a/hw/block/trace-events b/hw/block/trace-events
> index 6b9e733412..d842c45409 100644
> --- a/hw/block/trace-events
> +++ b/hw/block/trace-events
> @@ -1,5 +1,9 @@
>  # See docs/devel/tracing.txt for syntax documentation.
>  
> +# hw/block/fdc.c
> +fdc_ioport_read(uint8_t reg, uint8_t value) "read reg 0x%02x val 0x%02x"
> +fdc_ioport_write(uint8_t reg, uint8_t value) "write reg 0x%02x val 0x%02x"
> +
>  # hw/block/virtio-blk.c
>  virtio_blk_req_complete(void *vdev, void *req, int status) "vdev %p req %p status %d"
>  virtio_blk_rw_complete(void *vdev, void *req, int ret) "vdev %p req %p ret %d"
>
Philippe Mathieu-Daudé June 21, 2018, 6:07 p.m. UTC | #2
On 06/21/2018 02:41 PM, John Snow wrote:
> 
> 
> On 06/21/2018 01:12 PM, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  hw/block/fdc.c        | 6 +++---
>>  hw/block/trace-events | 4 ++++
>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
>> index cd29e27d8f..c7b4fe9b3e 100644
>> --- a/hw/block/fdc.c
>> +++ b/hw/block/fdc.c
>> @@ -40,6 +40,7 @@
>>  #include "sysemu/blockdev.h"
>>  #include "sysemu/sysemu.h"
>>  #include "qemu/log.h"
>> +#include "trace.h"
>>  
>>  /********************************************************/
>>  /* debug Floppy devices */
>> @@ -934,7 +935,7 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg)
>>          retval = (uint32_t)(-1);
>>          break;
>>      }
>> -    FLOPPY_DPRINTF("read reg%d: 0x%02x\n", reg & 7, retval);
>> +    trace_fdc_ioport_read(reg, retval);
> 
> Earlier in this function we've already masked the register number, which
> is not clear from context.

Sorry this is an old patch, I then learned to fill commit messages as if
you are going to send upstream, even if it will be in months...

> Reviewed-by: John Snow <jsnow@redhat.com>

Thanks.

> 
> (and ACK, to whomever stages this outside of my branch. --js)
> 
>>  
>>      return retval;
>>  }
>> @@ -943,9 +944,8 @@ static void fdctrl_write (void *opaque, uint32_t reg, uint32_t value)
>>  {
>>      FDCtrl *fdctrl = opaque;
>>  
>> -    FLOPPY_DPRINTF("write reg%d: 0x%02x\n", reg & 7, value);
>> -
>>      reg &= 7;
>> +    trace_fdc_ioport_write(reg, value);
>>      switch (reg) {
>>      case FD_REG_DOR:
>>          fdctrl_write_dor(fdctrl, value);
>> diff --git a/hw/block/trace-events b/hw/block/trace-events
>> index 6b9e733412..d842c45409 100644
>> --- a/hw/block/trace-events
>> +++ b/hw/block/trace-events
>> @@ -1,5 +1,9 @@
>>  # See docs/devel/tracing.txt for syntax documentation.
>>  
>> +# hw/block/fdc.c
>> +fdc_ioport_read(uint8_t reg, uint8_t value) "read reg 0x%02x val 0x%02x"
>> +fdc_ioport_write(uint8_t reg, uint8_t value) "write reg 0x%02x val 0x%02x"
>> +
>>  # hw/block/virtio-blk.c
>>  virtio_blk_req_complete(void *vdev, void *req, int status) "vdev %p req %p status %d"
>>  virtio_blk_rw_complete(void *vdev, void *req, int ret) "vdev %p req %p ret %d"
>>
diff mbox series

Patch

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index cd29e27d8f..c7b4fe9b3e 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -40,6 +40,7 @@ 
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
+#include "trace.h"
 
 /********************************************************/
 /* debug Floppy devices */
@@ -934,7 +935,7 @@  static uint32_t fdctrl_read (void *opaque, uint32_t reg)
         retval = (uint32_t)(-1);
         break;
     }
-    FLOPPY_DPRINTF("read reg%d: 0x%02x\n", reg & 7, retval);
+    trace_fdc_ioport_read(reg, retval);
 
     return retval;
 }
@@ -943,9 +944,8 @@  static void fdctrl_write (void *opaque, uint32_t reg, uint32_t value)
 {
     FDCtrl *fdctrl = opaque;
 
-    FLOPPY_DPRINTF("write reg%d: 0x%02x\n", reg & 7, value);
-
     reg &= 7;
+    trace_fdc_ioport_write(reg, value);
     switch (reg) {
     case FD_REG_DOR:
         fdctrl_write_dor(fdctrl, value);
diff --git a/hw/block/trace-events b/hw/block/trace-events
index 6b9e733412..d842c45409 100644
--- a/hw/block/trace-events
+++ b/hw/block/trace-events
@@ -1,5 +1,9 @@ 
 # See docs/devel/tracing.txt for syntax documentation.
 
+# hw/block/fdc.c
+fdc_ioport_read(uint8_t reg, uint8_t value) "read reg 0x%02x val 0x%02x"
+fdc_ioport_write(uint8_t reg, uint8_t value) "write reg 0x%02x val 0x%02x"
+
 # hw/block/virtio-blk.c
 virtio_blk_req_complete(void *vdev, void *req, int status) "vdev %p req %p status %d"
 virtio_blk_rw_complete(void *vdev, void *req, int ret) "vdev %p req %p ret %d"