quic/qbox
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for QemuInstance:
Collaboration graph
[legend]

Public Types

enum  TcgMode { TCG_UNSPECIFIED , TCG_SINGLE , TCG_COROUTINE , TCG_MULTI }
 
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)
 
 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 char *arg)
 Add a the display 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_tcg_enabled () const
 
std::shared_ptr< gs::tlm_quantumkeeper_extendedcreate_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::LibQemuget ()
 Returns the underlying qemu::LibQemu instance.
 
QemuInstanceDmiManagerget_dmi_manager ()
 Returns the locked QemuInstanceDmiManager instance.
 
int number_devices ()
 

Public Attributes

TargetSignalSocket< boolreset
 
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 ()
 
LibLoaderget_loader (sc_core::sc_object *o)
 
Target strtotarget (std::string s)
 

Protected Attributes

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< boolp_icount
 
cci::cci_param< intp_icount_mips
 
cci::cci_param< std::string > p_args
 
bool p_display_argument_set
 
cci::cci_param< std::string > p_accel
 

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_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.

◆ set_display_arg()

void QemuInstance::set_display_arg ( const char arg)
inline

Add a the display 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: