acrn-config: refine slot assignment for launch config
When passthrough device for VM, if there is no fun0 of the slot was passed in, PCI expansion card can not respond as a device, it must implement at least function number 0. Tracked-On: #4641 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
c8eda07323
commit
5936bf431c
|
@ -151,6 +151,7 @@ class PthruSelected():
|
|||
# check connections between several pass-through devices
|
||||
launch_cfg_lib.pt_devs_check_audio(self.bdf['audio'], self.bdf['audio_codec'])
|
||||
launch_cfg_lib.bdf_duplicate_check(self.bdf)
|
||||
launch_cfg_lib.check_slot(self.slot)
|
||||
|
||||
|
||||
class VirtioDeviceSelect():
|
||||
|
|
|
@ -39,11 +39,9 @@ PT_SLOT = {
|
|||
"lpc":1,
|
||||
"pci-gvt":2,
|
||||
"virtio-blk":3,
|
||||
"audio_codec":24
|
||||
}
|
||||
|
||||
|
||||
POST_UUID_DIC = {}
|
||||
PM_CHANNEL = ['', 'IOC', 'PowerButton', 'vuart1(pty)', 'vuart1(tty)']
|
||||
PM_CHANNEL_DIC = {
|
||||
None:'',
|
||||
|
@ -528,3 +526,31 @@ def uos_cpu_affinity(uosid_cpu_affinity):
|
|||
for uosid,cpu_affinity_list in uosid_cpu_affinity.items():
|
||||
cpu_affinity[uosid + sos_vm_id] = cpu_affinity_list
|
||||
return cpu_affinity
|
||||
|
||||
|
||||
def check_slot(slot_db):
|
||||
|
||||
slot_values = {}
|
||||
# init list of slot values for Post VM
|
||||
for dev in slot_db.keys():
|
||||
for uosid in slot_db[dev].keys():
|
||||
slot_values[uosid] = []
|
||||
break
|
||||
|
||||
# get slot values for Passthrough devices
|
||||
for dev in PASSTHRU_DEVS:
|
||||
for uosid,slot_str in slot_db[dev].items():
|
||||
if not slot_str:
|
||||
continue
|
||||
slot_values[uosid].append(slot_str)
|
||||
|
||||
# update slot values and replace the fun=0 if there is no fun 0 in bdf list
|
||||
for dev in PASSTHRU_DEVS:
|
||||
for uosid,slot_str in slot_db[dev].items():
|
||||
if not slot_str or ':' not in str(slot_str):
|
||||
continue
|
||||
bus_slot = slot_str[0:-1]
|
||||
bus_slot_fun0 = bus_slot + "0"
|
||||
if bus_slot_fun0 not in slot_values[uosid]:
|
||||
slot_db[dev][uosid] = bus_slot_fun0
|
||||
slot_values[uosid].append(bus_slot_fun0)
|
||||
|
|
Loading…
Reference in New Issue