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

RE: Enable audio virtualization in Xen


  • To: Christopher Clark <christopher.w.clark@xxxxxxxxx>
  • From: "SHARMA, JYOTIRMOY" <JYOTIRMOY.SHARMA@xxxxxxx>
  • Date: Tue, 26 Jul 2022 10:57:15 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R7Gy3XqzN4zXHWjHLnQ448VIUa32XBboXl5wXO0XRRY=; b=SINtqbTwv1OlSmboSIabwDXzpx2tsY/tJ2Vsy8lCvQazrcyMeAlGk1/ozWf6NCWALFrOJj8ezzgokxUnG0LDjUR71bCqOjaj034Xu7iCtkViwbZfrsWF9BkNstdijKqJU0F3K0CuPzsabGrYSsMxFbXUNebF+Os7WWQWOJBf7Qc8ihMGeivb191QnujNZlTm4NdPFffVk8Vm5ZeIiHFig4LTtQvpJE0RWobOz70TT0HWgaHIT1+nzzPeylQi3fvCcGpDfrtOQAI0HDfiDvpRAzxc5+Z2bVToD4EPn/0aJnddRM5P+cTC5Yg8Eah7VT+oGJJwwrH30z/1pvwyM/X1Eg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oT1NsWB3tqlwMr9lvsMyOJygA+3WJh1PrwBQCGNxDPLGazJqSdNw+zH21udTwTOyFKSnuvXqSJimEX0+rj33XKwHDC/xNDtHd4ZysxOdiRK5hGLoCk6A5BNScvgu90+dgxTIdwJyWNKGgkFibAU7TdkXXYzWneYkoGZ/1p0DHoP8jOlSGXWazI4wgcNXYjAk4XAMyhR5597rqApERu/6dTvIg6bWF3ZvSjhYCbLNAifZB1d5YSfaP4nWw7GZ1TpC9nJ2BwUnlWpnqY/BwpNzENd/4Ne0PF/+Z0ymfnSJFXy0h0WbUAqYJ2qRW1QSgDZAn/Y9RLRMfyerPzeBpkrOXw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "xen-users@xxxxxxxxxxxxxxxxxxxx" <xen-users@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 28 Jul 2022 20:08:50 +0000
  • List-id: Xen user discussion <xen-users.lists.xenproject.org>
  • Msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-07-26T10:57:11Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=fe043d7f-7e6e-4995-a203-34e5b5362b6a; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1
  • Thread-index: AdigFizJpGeQu9pXSearK44pKRlEjgAVU4KAABr1NcA=
  • Thread-topic: Enable audio virtualization in Xen

[AMD Official Use Only - General]

Hi Christopher,

Thank you for the quick response. Please find answers below.

>> Does audio playback work OK from your Ubuntu dom0?
Yes.

>> Do you know which version of Ubuntu you are using? ('cat /etc/lsb-release')
Ubuntu 22.04 LTS.

>> Do you know which version of Xen you are using? ('xl info' in dom0 should 
>> help)
4.16.2-pre. 

>> Do you know which version of Qemu you have installed in dom0?
QEMU emulator version 6.1.1.

>> Did you build and install Xen from source code, or are you using binary 
>> packages of Xen and its tools?
We built and installed Xen from source code (git clone 
https://xenbits.xen.org/git-http/xen.git).

>> Are you using the xl tools, or libvirt tools for configuring and running 
>> your guest? -- ie. how do you start your domU VM?
We are using xl tools (sudo xl -v create <path to hvm config file>).

>> When your domU is running, please could you run 'ps auxwww' in dom0 and 
>> obtain the process information about the qemu instance that is running, so 
>> that we can see what command line arguments have been supplied to it

This is the log we get right after booting dom 0:

root 723 0.0 0.2 243792 14468 ? Sl 15:51 0:00 
/usr/local/lib/xen/bin/qemu-system-i386 -xen-domid 0 -xen-attach -name dom0 
-nographic -M xenpv -daemonize -monitor /dev/null -serial /dev/null -parallel 
/dev/null -pidfile /var/run/xen/qemu-dom0.pid

This log is seen after we launch dom U (sudo xl -v create <path to hvm config 
file>):

root 2152 20.7 2.3 2858204 133496 ? Ssl 15:53 0:09 
/usr/local/lib/xen/bin/qemu-system-i386 -xen-domid 1 -no-shutdown -chardev 
socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-1,server=on,wait=off -mon 
chardev=libxl-cmd,mode=control -chardev 
socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-1,server=on,wait=off 
-mon chardev=libxenstat-cmd,mode=control -nodefaults -no-user-config -name 
domu-ubuntu.hvm -vnc 127.0.0.1:0,to=99 -display sdl,gl=on -sdl -device 
virtio-vga-gl -boot order=dc -usb -usbdevice tablet -smp 2,maxcpus=2 -net none 
-machine xenfv,suppress-vmdesc=on -m 2040 -drive 
file=/home/amd/u2004_ubuntu.qcow2,if=ide,index=0,media=disk,format=qcow2,cache=writeback

>> A little more information about what you're running will help with providing 
>> guidance here. The xl man page indicates that there is a "soundhw" option in 
>> the VM configuration file for passing sound hardware configution through to 
>> qemu, so if you are using the xl toolstack, you could try adding this to the 
>> config file: soundhw="hda"

I tried giving soundhw="hda" option in the hvm config file. However, I do not 
hear any sound when I play a wave file in dom U. Here is the 'ps auxwww' output 
after making this change:

root 2568 14.8 2.3 2770864 134720 ? Ssl 15:58 0:09 
/usr/local/lib/xen/bin/qemu-system-i386 -xen-domid 2 -no-shutdown -chardev 
socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-2,server=on,wait=off -mon 
chardev=libxl-cmd,mode=control -chardev 
socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-2,server=on,wait=off 
-mon chardev=libxenstat-cmd,mode=control -nodefaults -no-user-config -name 
domu-ubuntu-audio.hvm -vnc 127.0.0.1:0,to=99 -display sdl,gl=on -sdl -device 
virtio-vga-gl -boot order=dc -usb -usbdevice tablet -soundhw hda -smp 
2,maxcpus=2 -net none -machine xenfv,suppress-vmdesc=on -m 2040 -drive 
file=/home/amd/u2004_ubuntu.qcow2,if=ide,index=0,media=disk,format=qcow2,cache=writeback

Also, I tried giving soundhw="all" in the config file, however this throws 
following error:

libxl: error: libxl_dm.c:3130:device_model_spawn_outcome: Domain 4:domain 4 
device model: spawn failed (rc=-3)
libxl: error: libxl_dm.c:3350:device_model_postconfig_done: Domain 4:Post DM 
startup configs failed, rc=-3
libxl: error: libxl_create.c:1867:domcreate_devmodel_started: Domain 4:device 
model did not start: -3
libxl: error: libxl_aoutils.c:646:libxl__kill_xs_path: Device Model already 
exited
libxl: error: libxl_domain.c:1183:libxl__destroy_domid: Domain 4:Non-existant 
domain
libxl: error: libxl_domain.c:1137:domain_destroy_callback: Domain 4:Unable to 
destroy guest
libxl: error: libxl_domain.c:1064:domain_destroy_cb: Domain 4:Destruction of 
domain failed

Can you please let me know what parameters I should use in the config file to 
play audio from dom U?

Regards,
Jyotirmoy

-----Original Message-----
From: Christopher Clark <christopher.w.clark@xxxxxxxxx> 
Sent: Tuesday, July 26, 2022 2:44 AM
To: SHARMA, JYOTIRMOY <JYOTIRMOY.SHARMA@xxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; xen-users@xxxxxxxxxxxxxxxxxxxx
Subject: Re: Enable audio virtualization in Xen

[CAUTION: External Email]

On Mon, Jul 25, 2022 at 4:45 AM SHARMA, JYOTIRMOY <JYOTIRMOY.SHARMA@xxxxxxx> 
wrote:
>
> [AMD Official Use Only - General]
>
>
> Hi all,

Hi Jyotirmoy,

I have add the xen-users list to CC since this thread may be useful to that 
forum.

> I am using ubuntu as dom 0 and also dom U (HVM). I want to play audio from 
> “dom U” Ubuntu.

I think that it should be possible to enable what you are attempting to do. ie. 
audio output from a HVM Ubuntu guest VM.

Some questions to support assisting you:
* Does audio playback work OK from your Ubuntu dom0?
* Do you know which version of Ubuntu you are using? ('cat /etc/lsb-release')
* Do you know which version of Xen you are using? ('xl info' in dom0 should 
help)
* Do you know which version of Qemu you have installed in dom0?
* Did you build and install Xen from source code, or are you using binary 
packages of Xen and its tools?
* Are you using the xl tools, or libvirt tools for configuring and running your 
guest? -- ie. how do you start your domU VM?
* When your domU is running, please could you run 'ps auxwww' in dom0 and 
obtain the process information about the qemu instance that is running, so that 
we can see what command line arguments have been supplied to it

> I am new to Xen/virtualization in general.

Welcome! :-)

> From various reading I understood that I need to take following approach:
>
> 1. Use Xen front end ALSA driver in dom U

I'm not certain that this is necessary for your HVM guest. Instead of using the 
Xen paravirtualized audio protocol, Qemu should be able to present an emulated 
audio device to the HVM guest domU, and a standard audio driver (hda or ac97) 
in domU should suffice.

> 2. Use Qemu to connect to the backend ALSA driver in Dom 0

I think if Qemu is started with the correct command line arguments, it should 
be able to play sound on behalf of the guest, if sound is correctly configured 
and working in dom0.

> Can you please let me know if this approach is fine? If yes, I have following 
> questions:
>
> 1. Do I need to recompile Ubuntu to support Xen front end ALSA driver? Or 
> will Ubuntu iso file already have it enabled?

I think the latter, that the Ubuntu installation ISO should already contain a 
suitable audio device driver that is compatible with the virtual audio device 
that is emulated by Qemu.

> 2. Ho do I configure Qemu to enable backend driver?

A little more information about what you're running will help with providing 
guidance here. The xl man page indicates that there is a "soundhw" option in 
the VM configuration file for passing sound hardware configution through to 
qemu, so if you are using the xl toolstack, you could try adding this to the 
config file: soundhw="hda"

Christopher

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.