hv: unmap SR-IOV VF MMIO when the VF physical device is disabled

To avoid information leakage, we need to ensure that the device is
inaccessble when it does not exist.

For SR-IOV disabled VF device, we have the following operations.
    1. The configuration space accessing will get 0xFFFFFFFF as a
       return value after set the device state to zombie.
    2. The BAR MMIO EPT mapping are removed, the accesssing causes
       EPT violation.
    3. The device will be detached from IOMMU.
    4. The IRQ pin and vector are released.

Tracked-On: #4433

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yuan Liu
2020-03-16 17:43:09 +08:00
committed by wenlingz
parent b09f07e200
commit 9375c634dc
4 changed files with 35 additions and 4 deletions

View File

@@ -239,8 +239,6 @@ static void disable_vfs(struct pci_vdev *pf_vdev)
* resources
*
* If the VF drivers are still running in SOS or UOS, the MMIO access will return 0xFF.
*
* TODO For security reasons, we need to enforce a return of 0xFF to avoid information leakage.
*/
num_vfs = read_sriov_reg(pf_vdev, PCIR_SRIOV_NUMVFS);
first = read_sriov_reg(pf_vdev, PCIR_SRIOV_FST_VF_OFF);