27 cci::cci_param<std::string> p_vsock_backend_path;
28 cci::cci_param<std::string> p_vsock_vm_option;
29 cci::cci_param<std::string> p_vsock_sock_path;
30 cci::cci_param<bool> p_exec_backend;
39 , p_vsock_backend_path(
"vsock_device_backend_path",
"",
"path of vhost-device-vsock")
42 "guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vsock.sock,tx-buffer-size=65536,queue-size=1024",
43 "value of --vm option passed to vhost-device-vsock")
44 , p_vsock_sock_path(
"vsock_socket_path",
"/tmp/vsock.sock",
45 "path of vhost chardev socket to communicate with vhost-device-vsock")
46 , p_exec_backend(
"exec_backend",
true,
47 "boolean parameter to decide if the platform should start the backend, or we can only connect "
48 "to an already started backend")
50 if (p_exec_backend.get_value()) {
51 if (p_vsock_backend_path.get_value().empty()) {
53 <<
"vsock_path CCI parameter is empty, please use the path of vhost-device-vsock executable";
55 if (p_vsock_vm_option.get_value().empty()) {
57 <<
"vsock_vm_option CCI parameter is empty, please use a correct value of \"--vm\" option "
58 "passed to vhost-device-vsock";
60 exec_vhost_user_vsock(p_vsock_backend_path.get_value(), p_vsock_vm_option.get_value());
63 std::string
chardev_str =
"socket,id=vhost_user_vsock_pci_sock_chardev,path=" + p_vsock_sock_path.get_value();
65 gpex->add_device(*
this);
68 void before_end_of_elaboration()
override
70 qemu_gpex::Device::before_end_of_elaboration();
71 m_dev.set_prop_str(
"chardev",
"vhost_user_vsock_pci_sock_chardev");
75 void exec_vhost_user_vsock(std::string
path, std::string
vsock_vm)
78 SCP_FATAL(()) <<
"exec_vhost_user_vsock() failed, path is empty!";
81 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:327