aboutsummaryrefslogtreecommitdiff
path: root/util/vfio-helpers.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-11-03 03:07:32 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2020-11-03 19:06:23 +0000
commitf6b8104d0b75a8c2b21bd3175e9ba9a402182b2e (patch)
tree9a7d9b98080f891f552c9d2f30e23e32f0c02c0d /util/vfio-helpers.c
parent4c946b2236e630613fcb89516bf7fb2f918dc996 (diff)
downloadqemu-f6b8104d0b75a8c2b21bd3175e9ba9a402182b2e.zip
qemu-f6b8104d0b75a8c2b21bd3175e9ba9a402182b2e.tar.gz
qemu-f6b8104d0b75a8c2b21bd3175e9ba9a402182b2e.tar.bz2
util/vfio-helpers: Convert vfio_dump_mapping to trace events
The QEMU_VFIO_DEBUG definition is only modifiable at build-time. Trace events can be enabled at run-time. As we prefer the latter, convert qemu_vfio_dump_mappings() to use trace events instead of fprintf(). Reviewed-by: Fam Zheng <fam@euphon.net> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20201103020733.2303148-7-philmd@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com>
Diffstat (limited to 'util/vfio-helpers.c')
-rw-r--r--util/vfio-helpers.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index c24a510..73f7bfa 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -521,23 +521,12 @@ QEMUVFIOState *qemu_vfio_open_pci(const char *device, Error **errp)
return s;
}
-static void qemu_vfio_dump_mapping(IOVAMapping *m)
-{
- if (QEMU_VFIO_DEBUG) {
- printf(" vfio mapping %p %" PRIx64 " to %" PRIx64 "\n", m->host,
- (uint64_t)m->size, (uint64_t)m->iova);
- }
-}
-
static void qemu_vfio_dump_mappings(QEMUVFIOState *s)
{
- int i;
-
- if (QEMU_VFIO_DEBUG) {
- printf("vfio mappings\n");
- for (i = 0; i < s->nr_mappings; ++i) {
- qemu_vfio_dump_mapping(&s->mappings[i]);
- }
+ for (int i = 0; i < s->nr_mappings; ++i) {
+ trace_qemu_vfio_dump_mapping(s->mappings[i].host,
+ s->mappings[i].iova,
+ s->mappings[i].size);
}
}