xref: /qemu/plugins/api-user.c (revision 6d1829fce4ea50d343f2df63eeff96685a359bf5)
1 /*
2  * QEMU Plugin API - user-mode only implementations
3  *
4  * This provides the APIs that have a user-mode specific
5  * implementations or are only relevant to user-mode.
6  *
7  * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
8  * Copyright (C) 2019-2025, Linaro
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 
13 #include "qemu/osdep.h"
14 #include "qemu/plugin.h"
15 #include "exec/log.h"
16 
17 /*
18  * Virtual Memory queries - these are all NOPs for user-mode which
19  * only ever has visibility of virtual addresses.
20  */
21 
qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,uint64_t vaddr)22 struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
23                                                   uint64_t vaddr)
24 {
25     return NULL;
26 }
27 
qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr * haddr)28 bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr)
29 {
30     return false;
31 }
32 
qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr * haddr)33 uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
34 {
35     return 0;
36 }
37 
qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr * h)38 const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
39 {
40     return g_intern_static_string("Invalid");
41 }
42 
43 /*
44  * Time control - for user mode the only real time is wall clock time
45  * so realistically all you can do in user mode is slow down execution
46  * which doesn't require the ability to mess with the clock.
47  */
48 
qemu_plugin_request_time_control(void)49 const void *qemu_plugin_request_time_control(void)
50 {
51     return NULL;
52 }
53 
qemu_plugin_update_ns(const void * handle,int64_t new_time)54 void qemu_plugin_update_ns(const void *handle, int64_t new_time)
55 {
56     qemu_log_mask(LOG_UNIMP, "user-mode can't control time");
57 }
58