Re: [RFC PATCH 4/5] qemu: Build command line for ivshmem device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2014/8/6 0:48, Maxime Leroy wrote:
> This patch implements support for the ivshmem device
> in QEMU.
> 
> Example from this xml:
> 
>     <ivshmem server='yes'' role='master'/>

s/'yes''/'yes'

>       <source file='/tmp/socket-ivshmem0'/>
>       <size unit='M'>32</size>
>       <msi vectors='32' ioeventfd='on'/>
>     </ivshmem>
> 
> The following QEMU line is built:
> 
>    -device ivshmem,size=32m,vectors=32,chardev=charivshmem0,msi=on,
> 	ioeventfd=on,role=master
>    -chardev socket,path=/tmp/socket-ivshmem0,id=charivshmem0
> 
> Note: PCI hotpluging has not be implemented.
> 
> Signed-off-by: Maxime Leroy <maxime.leroy@xxxxxxxxx>
> ---
>  src/qemu/qemu_command.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_command.h |  4 +++
>  src/qemu/qemu_hotplug.c |  1 +
>  3 files changed, 82 insertions(+)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index a5ff10a..b434023 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1034,6 +1034,10 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
>          if (virAsprintf(&def->hubs[i]->info.alias, "hub%zu", i) < 0)
>              return -1;
>      }
> +    for (i = 0; i < def->nivshmems; i++) {
> +        if (virAsprintf(&def->ivshmems[i]->info.alias, "ivshmem%zu", i) < 0)
> +            return -1;
> +    }
>      for (i = 0; i < def->nsmartcards; i++) {
>          if (virAsprintf(&def->smartcards[i]->info.alias, "smartcard%zu", i) < 0)
>              return -1;
> @@ -5032,6 +5036,53 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def,
>  }
>  
[...]
> +char *
>  qemuBuildUSBHostdevDevStr(virDomainDefPtr def,
>                            virDomainHostdevDefPtr dev,
>                            virQEMUCapsPtr qemuCaps)
> @@ -9317,6 +9368,32 @@ qemuBuildCommandLine(virConnectPtr conn,
>          }
>      }
>  
> +    for (i = 0; i < def->nivshmems; i++) {
> +        virDomainIvshmemDefPtr ivshmem = def->ivshmems[i];
> +        char *devstr;
> +
> +        virCommandAddArg(cmd, "-device");
> +        if (!(devstr = qemuBuildIvshmemDevStr(def, ivshmem, qemuCaps)))
> +            goto error;
> +        virCommandAddArg(cmd, devstr);
> +        VIR_FREE(devstr);
> +
> +        if (ivshmem->use_server == VIR_DOMAIN_IVSHMEM_SERVER_ENABLED) {
> +            virDomainChrSourceDef source;
> +
> +            source.type = VIR_DOMAIN_CHR_TYPE_UNIX;
> +            source.data.nix.path = ivshmem->file;
> +            source.data.nix.listen = false;
> +
> +            virCommandAddArg(cmd, "-chardev");

In qemuBuildCommandLine() , "-device" and "-chardev" capabilities are checked
before most(not all) of virCommandAddArg for devices. I think that will be
nicer.


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]