diff --git a/exec.c b/exec.c
index f398d21..7477eea 100644
--- a/exec.c
+++ b/exec.c
@@ -42,8 +42,8 @@
 #include <qemu.h>
 #else /* !CONFIG_USER_ONLY */
 #include "sysemu/xen-mapcache.h"
+#endif
 #include "trace.h"
-#endif
 #include "exec/cpu-all.h"
 #include "qemu/rcu_queue.h"
 #include "qemu/main-loop.h"
@@ -2592,24 +2592,28 @@ static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr,
             case 8:
                 /* 64 bit write access */
                 val = ldq_p(buf);
+                trace_ioport_out(addr, 'q', val);
                 result |= memory_region_dispatch_write(mr, addr1, val, 8,
                                                        attrs);
                 break;
             case 4:
                 /* 32 bit write access */
                 val = ldl_p(buf);
+                trace_ioport_out(addr, 'l', val & 0xffffffff);
                 result |= memory_region_dispatch_write(mr, addr1, val, 4,
                                                        attrs);
                 break;
             case 2:
                 /* 16 bit write access */
                 val = lduw_p(buf);
+                trace_ioport_out(addr, 'w', val & 0xffff);
                 result |= memory_region_dispatch_write(mr, addr1, val, 2,
                                                        attrs);
                 break;
             case 1:
                 /* 8 bit write access */
                 val = ldub_p(buf);
+                trace_ioport_out(addr, 'b', val & 0xff);
                 result |= memory_region_dispatch_write(mr, addr1, val, 1,
                                                        attrs);
                 break;
@@ -2685,24 +2689,28 @@ MemTxResult address_space_read_continue(AddressSpace *as, hwaddr addr,
                 /* 64 bit read access */
                 result |= memory_region_dispatch_read(mr, addr1, &val, 8,
                                                       attrs);
+                trace_ioport_in(addr, 'q', val);
                 stq_p(buf, val);
                 break;
             case 4:
                 /* 32 bit read access */
                 result |= memory_region_dispatch_read(mr, addr1, &val, 4,
                                                       attrs);
+                trace_ioport_in(addr, 'l', val & 0xffffffff);
                 stl_p(buf, val);
                 break;
             case 2:
                 /* 16 bit read access */
                 result |= memory_region_dispatch_read(mr, addr1, &val, 2,
                                                       attrs);
+                trace_ioport_in(addr, 'w', val & 0xffff);
                 stw_p(buf, val);
                 break;
             case 1:
                 /* 8 bit read access */
                 result |= memory_region_dispatch_read(mr, addr1, &val, 1,
                                                       attrs);
+                trace_ioport_in(addr, 'b', val & 0xff);
                 stb_p(buf, val);
                 break;
             default:
diff --git a/ioport.c b/ioport.c
index 7a84d54..2f8ee9d 100644
--- a/ioport.c
+++ b/ioport.c
@@ -27,7 +27,6 @@
 
 #include "qemu/osdep.h"
 #include "exec/ioport.h"
-#include "trace.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 
@@ -55,7 +54,6 @@ const MemoryRegionOps unassigned_io_ops = {
 
 void cpu_outb(pio_addr_t addr, uint8_t val)
 {
-    trace_cpu_out(addr, 'b', val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         &val, 1);
 }
@@ -64,7 +62,6 @@ void cpu_outw(pio_addr_t addr, uint16_t val)
 {
     uint8_t buf[2];
 
-    trace_cpu_out(addr, 'w', val);
     stw_p(buf, val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         buf, 2);
@@ -74,7 +71,6 @@ void cpu_outl(pio_addr_t addr, uint32_t val)
 {
     uint8_t buf[4];
 
-    trace_cpu_out(addr, 'l', val);
     stl_p(buf, val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         buf, 4);
@@ -86,7 +82,6 @@ uint8_t cpu_inb(pio_addr_t addr)
 
     address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                        &val, 1);
-    trace_cpu_in(addr, 'b', val);
     return val;
 }
 
@@ -97,7 +92,6 @@ uint16_t cpu_inw(pio_addr_t addr)
 
     address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 2);
     val = lduw_p(buf);
-    trace_cpu_in(addr, 'w', val);
     return val;
 }
 
@@ -108,7 +102,6 @@ uint32_t cpu_inl(pio_addr_t addr)
 
     address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 4);
     val = ldl_p(buf);
-    trace_cpu_in(addr, 'l', val);
     return val;
 }
 
diff --git a/trace-events b/trace-events
index d494de1..2759412 100644
--- a/trace-events
+++ b/trace-events
@@ -136,9 +136,9 @@ thread_pool_cancel(void *req, void *opaque) "req %p opaque %p"
 paio_submit_co(int64_t sector_num, int nb_sectors, int type) "sector_num %"PRId64" nb_sectors %d type %d"
 paio_submit(void *acb, void *opaque, int64_t sector_num, int nb_sectors, int type) "acb %p opaque %p sector_num %"PRId64" nb_sectors %d type %d"
 
-# ioport.c
-cpu_in(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
-cpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
+# exec.c
+ioport_in(uint64_t addr, char size, uint64_t val) "addr %#"PRIx64"(%c) value %#"PRIx64
+ioport_out(uint64_t addr, char size, uint64_t val) "addr %#"PRIx64"(%c) value %#"PRIx64
 
 # balloon.c
 # Since requests are raised via monitor, not many tracepoints are needed.
