mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-11 05:39:45 +00:00
hv: vpci: sos could access low severity guest pci cfg space
There're some cases the SOS (higher severity guest) needs to access the post-launched VM (lower severity guest) PCI CFG space: 1. The SR-IOV PF needs to reset the VF 2. Some pass through device still need DM to handle some quirk. In the case a device is assigned to a UOS and is not in a zombie state, the SOS is able to access, if and only if the SOS has higher severity than the UOS. Tracked-On: #4371 Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -353,8 +353,16 @@ static struct pci_vdev *find_available_vdev(struct acrn_vpci *vpci, union pci_bd
|
||||
struct pci_vdev *vdev = pci_find_vdev(vpci, bdf);
|
||||
|
||||
if ((vdev != NULL) && (vdev->vpci != vpci)) {
|
||||
/* If the device is assigned to other guest, we could not access it */
|
||||
vdev = NULL;
|
||||
/* In the case a device is assigned to a UOS and is not in a zombie state */
|
||||
if ((vdev->new_owner != NULL) && (vdev->new_owner->vpci != NULL)) {
|
||||
/* the SOS is able to access, if and only if the SOS has higher severity than the UOS. */
|
||||
if (get_vm_severity(vpci->vm->vm_id) <
|
||||
get_vm_severity(vdev->new_owner->vpci->vm->vm_id)) {
|
||||
vdev = NULL;
|
||||
}
|
||||
} else {
|
||||
vdev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return vdev;
|
||||
|
Reference in New Issue
Block a user