qualcomm/qbox
Loading...
Searching...
No Matches
QemuInstance Class Reference

This class encapsulates a libqemu-cxx qemu::LibQemu instance. It handles QEMU parameters and instance initialization. More...

#include <qemu-instance.h>

Inheritance diagram for QemuInstance:
Collaboration diagram for QemuInstance:

Public Types

enum  TcgMode { TCG_UNSPECIFIED , TCG_SINGLE , TCG_COROUTINE , TCG_MULTI }
enum  TimeSyncStrategy { TIME_SYNC_QUANTUM_KEEPER , TIME_SYNC_MCIPS }
using Target = qemu::Target
using LibLoader = qemu::LibraryLoaderIface

Public Member Functions

void add_dev (QemuDeviceBaseIF *d)
void del_dev (QemuDeviceBaseIF *d)
bool can_run ()
TcgMode StringToTcgMode (std::string s)
TimeSyncStrategy StringToTimeSyncStrategy (std::string s)
 QemuInstance (const sc_core::sc_module_name &n, sc_core::sc_object *o, std::string arch)
 QemuInstance (const sc_core::sc_module_name &n, sc_core::sc_object *o, Target t)
 QemuInstance (const sc_core::sc_module_name &n, LibLoader &loader, Target t)
 QemuInstance (const QemuInstance &)=delete
 QemuInstance (QemuInstance &&)=delete
bool operator== (const QemuInstance &b) const
bool operator!= (const QemuInstance &b) const
void add_arg (const char *arg)
 Add a command line argument to the qemu instance.
void set_display_arg (const std::string &arg)
 Add a the display command line argument to the qemu instance.
void set_vnc_args (const std::string &vnc_options)
 Add the VNC command line argument to the qemu instance.
TcgMode get_tcg_mode ()
 Get the TCG mode for this instance.
bool is_kvm_enabled () const
bool is_hvf_enabled () const
bool is_whpx_enabled () const
bool is_tcg_enabled () const
std::shared_ptr< gs::tlm_quantumkeeper_extended > create_quantum_keeper ()
 Get the TCG mode for this instance.
void init ()
 Initialize the QEMU instance.
bool is_inited () const
 Returns true if the instance is initialized.
qemu::LibQemu & get ()
 Returns the underlying qemu::LibQemu instance.
McipsPlugin & get_mcips_plugin ()
 Returns the mcips_plugin.
bool is_mcips_enabled () const noexcept
 Check if multi core instructions per second plugin (mcips) is enabled.
QemuInstanceDmiManager & get_dmi_manager ()
 Returns the locked QemuInstanceDmiManager instance.
int number_devices ()

Public Attributes

TargetSignalSocket< bool > reset
std::mutex g_signaled_lock
std::condition_variable g_signaled_cond
bool g_signaled = false
std::recursive_mutex g_rec_qemu_io_lock

Protected Member Functions

void push_default_args ()
void push_icount_mode_args ()
void push_tcg_mode_args ()
void push_accelerator_args ()
LibLoader & get_loader (sc_core::sc_object *o)
Target strtotarget (std::string s)

Protected Attributes

cci::cci_param< std::string > p_time_sync_strategy
std::unique_ptr< McipsPlugin > m_mcips_plugin
qemu::LibQemu m_inst
QemuInstanceDmiManager m_dmi_mgr
cci::cci_param< std::string > p_tcg_mode
cci::cci_param< std::string > p_sync_policy
TcgMode m_tcg_mode
cci::cci_param< bool > p_icount
cci::cci_param< int > p_icount_mips
cci::cci_param< std::string > p_args
std::string m_display_argument
cci::cci_param< std::string > p_accel
cci::cci_param< std::string > p_whpx_args

Detailed Description

This class encapsulates a libqemu-cxx qemu::LibQemu instance. It handles QEMU parameters and instance initialization.

Member Function Documentation

◆ add_arg()

void QemuInstance::add_arg ( const char * arg)
inline

Add a command line argument to the qemu instance.

This method may only be called before the instance is initialized.

◆ create_quantum_keeper()

std::shared_ptr< gs::tlm_quantumkeeper_extended > QemuInstance::create_quantum_keeper ( )
inline

Get the TCG mode for this instance.

This method is called by CPU instances determin if to use coroutines or not.

◆ get()

qemu::LibQemu & QemuInstance::get ( )
inline

Returns the underlying qemu::LibQemu instance.

Returns the underlying qemu::LibQemu instance. If the instance hasn't been initialized, init is called just before returning the instance.

◆ get_dmi_manager()

QemuInstanceDmiManager & QemuInstance::get_dmi_manager ( )
inline

Returns the locked QemuInstanceDmiManager instance.

Note: we rely on RVO here so no copy happen on return (this is enforced by the fact that the LockedQemuInstanceDmiManager copy constructor is deleted).

◆ get_mcips_plugin()

McipsPlugin & QemuInstance::get_mcips_plugin ( )
inline

Returns the mcips_plugin.

Returns the mcips_plugin for the current instance.

◆ get_tcg_mode()

TcgMode QemuInstance::get_tcg_mode ( )
inline

Get the TCG mode for this instance.

This method is called by CPU instances determin if to use coroutines or not.

◆ init()

void QemuInstance::init ( )
inline

Initialize the QEMU instance.

Initialize the QEMU instance with the set TCG and icount mode. If the TCG mode hasn't been set, it defaults to TCG_SINGLE. If icount mode hasn't been set, it defaults to ICOUNT_OFF.

The instance should not already be initialized when calling this method.

◆ is_mcips_enabled()

bool QemuInstance::is_mcips_enabled ( ) const
inlinenoexcept

Check if multi core instructions per second plugin (mcips) is enabled.

Returns true only if the CCI parameter requested it AND the plugin was actually constructed.

◆ set_display_arg()

void QemuInstance::set_display_arg ( const std::string & arg)
inline

Add a the display command line argument to the qemu instance.

This method may only be called before the instance is initialized.

◆ set_vnc_args()

void QemuInstance::set_vnc_args ( const std::string & vnc_options)
inline

Add the VNC command line argument to the qemu instance.

This method may only be called before the instance is initialized.


The documentation for this class was generated from the following file: