mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 00:38:28 +00:00
hv: vpci: restore PCI BARs when doing AF FLR
ACRN hypervisor should trap guest doing PCI AF FLR. Besides, it should save some status before doing the FLR and restore them later, only BARs values for now. This patch will trap guest Conventional PCI Advanced Features Control Register write operation if the device supports Conventional PCI Advanced Features Capability and check whether it wants to do device AF FLR. If it does, call pdev_do_flr to do the job. Tracked-On: #3465 Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -235,6 +235,8 @@ void init_vdev_pt(struct pci_vdev *vdev)
|
||||
|
||||
vdev->has_flr = vdev->pdev->has_flr;
|
||||
vdev->pcie_capoff = vdev->pdev->pcie_capoff;
|
||||
vdev->has_af_flr = vdev->pdev->has_af_flr;
|
||||
vdev->af_capoff = vdev->pdev->af_capoff;
|
||||
|
||||
for (idx = 0U; idx < vdev->nr_bars; idx++) {
|
||||
vbar = &vdev->bar[idx];
|
||||
|
@@ -337,8 +337,9 @@ static int32_t vpci_write_pt_dev_cfg(struct pci_vdev *vdev, uint32_t offset,
|
||||
vmsi_write_cfg(vdev, offset, bytes, val);
|
||||
} else if (msixcap_access(vdev, offset)) {
|
||||
vmsix_write_cfg(vdev, offset, bytes, val);
|
||||
} else if (vdev->has_flr && ((vdev->pcie_capoff + PCIR_PCIE_DEVCTRL) == offset) &&
|
||||
((val & PCIM_PCIE_FLR) != 0U)) {
|
||||
} else if ((vdev->has_flr && ((vdev->pcie_capoff + PCIR_PCIE_DEVCTRL) == offset) &&
|
||||
((val & PCIM_PCIE_FLR) != 0U)) || (vdev->has_af_flr &&
|
||||
((vdev->af_capoff + PCIR_AF_CTRL) == offset) && ((val & PCIM_AF_FLR) != 0U))) {
|
||||
/* Assume that guest write FLR must be 4 bytes aligned */
|
||||
pdev_do_flr(vdev->pdev->bdf, offset, bytes, val);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user