|
|
| McipsPlugin (const sc_core::sc_module_name &nm, qemu::LibQemu &inst) |
|
void | idle_tick_method () |
| | SC_METHOD woken by m_idle_tick. When a CPU is active it does iothread-livelock recovery (bumps qemu_time if it has frozen). When all CPUs are idle it does nothing: just being scheduled was enough to step the SystemC kernel forward (the "idle pump").
|
| void | shutdown_cleanup () |
| | Shared shutdown logic used by both the destructor and end_of_simulation().
|
|
void | end_of_simulation () override |
| | Called by SystemC at end of simulation; stops all QEMU callbacks.
|
|
void | end_of_elaboration () override |
| | Set up the plugin, register QEMU callbacks, and send the first sync window.
|
|
vCPUTime * | get_vcpu (unsigned int cpu_index) |
| | Helper function to get vCPU time structure from scoreboard.
|
|
void | attach_sync_window () |
|
void | detach_sync_window () |
| bool | set_vcpu_insn_per_second (unsigned int cpu_index, uint64_t insn_per_second) |
| | Set the instructions per second for a specific vCPU.
|
|
void | sync_qemu_time_ns () |
| | Copy m_qemu_time into the atomic nanosecond field. Must hold m_mcips_mutex when calling.
|
|
sc_core::sc_time | cpu_time_now (const vCPUTime *vcpu) |
| | Current time for a specific CPU (base + in-flight delta). Must hold m_mcips_mutex when calling.
|
| sc_core::sc_time | qemu_time_now () |
| | Current QEMU time (base + active CPU's in-flight delta).
|
|
sc_core::sc_time | qemu_time_now (const vCPUTime *active) |
| | Overload for callers that already hold m_mcips_mutex and have the active pointer.
|
|
vCPUTime * | slowest_none_idle_cpu () |
| | Find the CPU that is furthest behind in time.
|
| vCPUTime * | select_active_vcpu () |
| | Pick the first non-idle CPU and make it the active one.
|
|
void | pause_if_ahead (vCPUTime *vcpu, const vCPUTime *active, sc_core::sc_time current_qemu_time, sc_core::sc_time threshold) |
| | Pause the CPU if it has run too far ahead of the allowed limit. m_mcips_mutex must be held.
|
|
void | resume_if_behind (const vCPUTime *active, sc_core::sc_time current_qemu_time, sc_core::sc_time threshold) |
| | Resume paused CPUs that are still within the allowed time limit. m_mcips_mutex must be held.
|
| sc_core::sc_time | compute_threshold () |
| | Compute the time threshold that determines which CPUs may run.
|
| void | rebalance_and_sync (vCPUTime *vcpu=nullptr) |
| | Rebalance CPUs and notify SystemC. m_mcips_mutex must be held.
|
| void | set_systemc_window (const sc_core::sc_sync_window< sc_core::sc_sync_policy_tlm_quantum >::window *custom_window=nullptr) |
| | Set the SystemC synchronization window.
|
| void | receive_window_cb (const sc_core::sc_sync_window< sc_core::sc_sync_policy_tlm_quantum >::window &sc_w) |
| | Called by SystemC when a new time window is ready.
|
|
void | vcpu_init (unsigned int cpu_index) |
| | Called under BQL before simulation starts; does not hold m_mcips_mutex.
|
|
void | cpu_end_delta_quota (vCPUTime *vcpu) |
| | Called when a CPU has run its full instruction quota. Adds the time used, pauses/resumes CPUs as needed, and sends a new window. Takes and releases m_mcips_mutex inside.
|
|
void | vcpu_tb_exec_cond (unsigned int cpu_index, void *) |
| | Called when a CPU has run at least global_quantum instructions.
|
|
void | vcpu_tb_trans (qemu_plugin_tb *tb) |
| | Called when QEMU translates a block, adds instruction counting and quota check.
|
| void | vcpu_idle (unsigned int cpu_index) |
| | Called when a CPU goes idle (QEMU holds BQL; we additionally take m_mcips_mutex).
|
| void | vcpu_resume (unsigned int cpu_index) |
| | Called when a CPU wakes up (QEMU holds BQL; we additionally take m_mcips_mutex).
|
| int64_t | get_qemu_clock (void *) |
| | Returns the current simulation time in nanoseconds to QEMU's timer thread.
|
|
std::string | get_mcips_status_json () |
| | Returns a JSON string with the current state of all CPUs (for debugging). Reads without m_mcips_mutex so values may be slightly out of date.
|
|
| LibQemuPlugin (const sc_core::sc_module_name &nm, qemu::LibQemu &inst) |
|
void | push_plugin_args (const std::string &plugin_path) |
| void | shutdown_bridge () |
| | Stop bridge dispatch and drain in-flight callbacks.
|
|
void * | handle_as_userdata () const |