File tree Expand file tree Collapse file tree 3 files changed +51
-41
lines changed Expand file tree Collapse file tree 3 files changed +51
-41
lines changed Original file line number Diff line number Diff line change @@ -95,3 +95,37 @@ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
95
95
return g_intern_static_string ("RAM" );
96
96
}
97
97
}
98
+
99
+ /*
100
+ * Time control
101
+ */
102
+ static bool has_control ;
103
+ static Error * migration_blocker ;
104
+
105
+ const void * qemu_plugin_request_time_control (void )
106
+ {
107
+ if (!has_control ) {
108
+ has_control = true;
109
+ error_setg (& migration_blocker ,
110
+ "TCG plugin time control does not support migration" );
111
+ migrate_add_blocker (& migration_blocker , NULL );
112
+ return & has_control ;
113
+ }
114
+ return NULL ;
115
+ }
116
+
117
+ static void advance_virtual_time__async (CPUState * cpu , run_on_cpu_data data )
118
+ {
119
+ int64_t new_time = data .host_ulong ;
120
+ qemu_clock_advance_virtual_time (new_time );
121
+ }
122
+
123
+ void qemu_plugin_update_ns (const void * handle , int64_t new_time )
124
+ {
125
+ if (handle == & has_control ) {
126
+ /* Need to execute out of cpu_exec, so bql can be locked. */
127
+ async_run_on_cpu (current_cpu ,
128
+ advance_virtual_time__async ,
129
+ RUN_ON_CPU_HOST_ULONG (new_time ));
130
+ }
131
+ }
Original file line number Diff line number Diff line change 12
12
13
13
#include "qemu/osdep.h"
14
14
#include "qemu/plugin.h"
15
+ #include "exec/log.h"
15
16
16
17
/*
17
18
* Virtual Memory queries - these are all NOPs for user-mode which
@@ -38,3 +39,19 @@ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
38
39
{
39
40
return g_intern_static_string ("Invalid" );
40
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
+
49
+ const void * qemu_plugin_request_time_control (void )
50
+ {
51
+ return NULL ;
52
+ }
53
+
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
+ }
Original file line number Diff line number Diff line change @@ -526,44 +526,3 @@ uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry)
526
526
return total ;
527
527
}
528
528
529
- /*
530
- * Time control
531
- */
532
- static bool has_control ;
533
- #ifdef CONFIG_SOFTMMU
534
- static Error * migration_blocker ;
535
- #endif
536
-
537
- const void * qemu_plugin_request_time_control (void )
538
- {
539
- if (!has_control ) {
540
- has_control = true;
541
- #ifdef CONFIG_SOFTMMU
542
- error_setg (& migration_blocker ,
543
- "TCG plugin time control does not support migration" );
544
- migrate_add_blocker (& migration_blocker , NULL );
545
- #endif
546
- return & has_control ;
547
- }
548
- return NULL ;
549
- }
550
-
551
- #ifdef CONFIG_SOFTMMU
552
- static void advance_virtual_time__async (CPUState * cpu , run_on_cpu_data data )
553
- {
554
- int64_t new_time = data .host_ulong ;
555
- qemu_clock_advance_virtual_time (new_time );
556
- }
557
- #endif
558
-
559
- void qemu_plugin_update_ns (const void * handle , int64_t new_time )
560
- {
561
- #ifdef CONFIG_SOFTMMU
562
- if (handle == & has_control ) {
563
- /* Need to execute out of cpu_exec, so bql can be locked. */
564
- async_run_on_cpu (current_cpu ,
565
- advance_virtual_time__async ,
566
- RUN_ON_CPU_HOST_ULONG (new_time ));
567
- }
568
- #endif
569
- }
You can’t perform that action at this time.
0 commit comments