26 cci::cci_param<std::string> p_vsock_backend_path;
27 cci::cci_param<std::string> p_vsock_vm_option;
28 cci::cci_param<std::string> p_vsock_sock_path;
29 cci::cci_param<bool> p_exec_backend;
38 , p_vsock_backend_path(
"vsock_device_backend_path",
"",
"path of vhost-device-vsock")
41 "guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vsock.sock,tx-buffer-size=65536,queue-size=1024",
42 "value of --vm option passed to vhost-device-vsock")
43 , p_vsock_sock_path(
"vsock_socket_path",
"/tmp/vsock.sock",
44 "path of vhost chardev socket to communicate with vhost-device-vsock")
45 , p_exec_backend(
"exec_backend",
true,
46 "boolean parameter to decide if the platform should start the backend, or we can only connect "
47 "to an already started backend")
49 if (p_exec_backend.get_value()) {
50 if (p_vsock_backend_path.get_value().empty()) {
52 <<
"vsock_path CCI parameter is empty, please use the path of vhost-device-vsock executable";
54 if (p_vsock_vm_option.get_value().empty()) {
56 <<
"vsock_vm_option CCI parameter is empty, please use a correct value of \"--vm\" option "
57 "passed to vhost-device-vsock";
59 exec_vhost_user_vsock(p_vsock_backend_path.get_value(), p_vsock_vm_option.get_value());
62 std::string
chardev_str =
"socket,id=vhost_user_vsock_pci_sock_chardev,path=" + p_vsock_sock_path.get_value();
64 gpex->add_device(*
this);
67 void before_end_of_elaboration()
override
69 qemu_gpex::Device::before_end_of_elaboration();
70 m_dev.set_prop_str(
"chardev",
"vhost_user_vsock_pci_sock_chardev");
74 void exec_vhost_user_vsock(std::string
path, std::string
vsock_vm)
77 SCP_FATAL(()) <<
"exec_vhost_user_vsock() failed, path is empty!";
80 SCP_FATAL(()) <<
"exec_vhost_user_vsock() failed, vsock_vm is empty!";
void add_arg(const char *arg)
Add a command line argument to the qemu instance.
Definition qemu-instance.h:329