mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
acrn-config: refine the tools for audio/audio_codec
There are 2 scenarios to pass through audio/audio_codec: 1. Only pass through audio device to vm. 2. Pass through audio and audio codec device to vm. The improvement is to generate proper boot audio option for each scenario. Tracked-On: #3853 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
950e3aa224
commit
1326eec4eb
@ -133,6 +133,8 @@ def generate_script_file(names, pt_sel, dm, vmid, config):
|
||||
|
||||
print("{}".format(header_info), file=config)
|
||||
com.gen(names, pt_sel, dm, vmid, config)
|
||||
if launch_cfg_lib.ERR_LIST:
|
||||
return launch_cfg_lib.ERR_LIST
|
||||
|
||||
|
||||
def main(args):
|
||||
@ -201,14 +203,18 @@ def main(args):
|
||||
launch_script_file = output + script_name
|
||||
config_srcs.append(launch_script_file)
|
||||
with open(launch_script_file, mode = 'w', newline=None, encoding='utf-8') as config:
|
||||
generate_script_file(names, pt_sel, dm.args, vm_th, config)
|
||||
err_dic = generate_script_file(names, pt_sel, dm.args, vm_th, config)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
else:
|
||||
for post_vm_i in post_num_list:
|
||||
script_name = "launch_uos_id{}.sh".format(post_vm_i)
|
||||
launch_script_file = output + script_name
|
||||
config_srcs.append(launch_script_file)
|
||||
with open(launch_script_file, mode = 'w', newline='\n', encoding='utf-8') as config:
|
||||
generate_script_file(names, pt_sel, dm.args, post_vm_i, config)
|
||||
err_dic = generate_script_file(names, pt_sel, dm.args, post_vm_i, config)
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
||||
commit_msg = "launch_uos_id{}.sh".format(launch_vm_count)
|
||||
|
||||
|
@ -134,12 +134,6 @@ def audio_pt(uos_type, sel, vmid, config):
|
||||
fun_codec = bdf_codec[6:7]
|
||||
slot_codec = sel.slot['audio_codec'][vmid]
|
||||
|
||||
if uos_type == "WINDOWS":
|
||||
print(' echo ${passthru_vpid["audio"]} > /sys/bus/pci/drivers/pci-stub/new_id', file=config)
|
||||
print(' echo ${passthru_bdf["audio"]} > /sys/bus/pci/devices/${passthru_bdf["audio"]}/driver/unbind', file=config)
|
||||
print(' echo ${passthru_bdf["audio"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
|
||||
return
|
||||
|
||||
if bdf_audio:
|
||||
print("kernel_version=$(uname -r)", file=config)
|
||||
print('audio_module="/usr/lib/modules/$kernel_version/kernel/sound/soc/intel/boards/snd-soc-sst_bxt_sos_tdf8532.ko"', file=config)
|
||||
@ -162,6 +156,7 @@ def audio_pt(uos_type, sel, vmid, config):
|
||||
print("audio_passthrough=1", file=config)
|
||||
print("fi", file=config)
|
||||
print('boot_audio_option=""', file=config)
|
||||
|
||||
print("if [ $audio_passthrough == 1 ]; then", file=config)
|
||||
print(" # for audio device", file=config)
|
||||
print(' echo ${passthru_vpid["audio"]} > /sys/bus/pci/drivers/pci-stub/new_id', file=config)
|
||||
@ -169,19 +164,32 @@ def audio_pt(uos_type, sel, vmid, config):
|
||||
print(' echo ${passthru_bdf["audio"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
|
||||
print("", file=config)
|
||||
|
||||
if bdf_codec:
|
||||
# select audio and audio_codec device to pass through to vm
|
||||
print(" # for audio codec", file=config)
|
||||
print(' echo ${passthru_vpid["audio_codec"]} > /sys/bus/pci/drivers/pci-stub/new_id', file=config)
|
||||
print(' echo ${passthru_bdf["audio_codec"]} > /sys/bus/pci/devices/${passthru_bdf["audio_codec"]}/driver/unbind', file=config)
|
||||
print(' echo ${passthru_bdf["audio_codec"]} > /sys/bus/pci/drivers/pci-stub/bind', file=config)
|
||||
print("", file=config)
|
||||
|
||||
print(' boot_audio_option="-s {},passthru,{}/{}/{},'.format(
|
||||
print(' boot_audio_option="-s {},passthru,{}/{}/{},keep_gsi '.format(
|
||||
slot_audio, bus, dev, fun), end="", file=config)
|
||||
print('keep_gsi -s {},passthru,{}/{}/{}"'.format(
|
||||
print('-s {},passthru,{}/{}/{}"'.format(
|
||||
slot_codec, bus_codec, dev_codec, fun_codec), file=config)
|
||||
else:
|
||||
# only select audio device to pass through to vm
|
||||
print(' boot_audio_option="-s {},passthru,{}/{}/{},keep_gsi'.format(
|
||||
slot_audio, bus, dev, fun), file=config)
|
||||
|
||||
print("else", file=config)
|
||||
print(' boot_audio_option="-s {},virtio-audio"'.format(slot_audio), file=config)
|
||||
print("fi", file=config)
|
||||
elif bdf_codec:
|
||||
# only selected audio codec, then set error message
|
||||
key = "audio/audio codec error:"
|
||||
launch_cfg_lib.ERR_LIST[key] = "Audio codec device should be pass through together with Audio devcie"
|
||||
print(' boot_audio_option=-s {},passthru,{}/{}/{}"'.format(
|
||||
slot_codec, bus_codec, dev_codec, fun_codec), file=config)
|
||||
|
||||
|
||||
def media_pt(uos_type, sel, vmid, config):
|
||||
|
Loading…
Reference in New Issue
Block a user