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:
Li Fei1
2019-12-19 23:29:50 +08:00
committed by wenlingz
parent a90e0f6c84
commit 1fddf943d8
5 changed files with 26 additions and 5 deletions

View File

@@ -138,6 +138,12 @@
#define PCIM_PCIE_FLRCAP (0x1U << 28U)
#define PCIM_PCIE_FLR (0x1U << 15U)
/* Conventional PCI Advanced Features Capability */
#define PCIY_AF 0x13U
#define PCIM_AF_FLR_CAP (0x1U << 25U)
#define PCIR_AF_CTRL 0x4U
#define PCIM_AF_FLR 0x1U
#define HOST_BRIDGE_BDF 0U
#define PCI_STD_NUM_BARS 6U
@@ -189,6 +195,10 @@ struct pci_pdev {
/* Function Level Reset Capability */
bool has_flr;
uint32_t pcie_capoff;
/* Conventional PCI Advanced Features FLR Capability */
bool has_af_flr;
uint32_t af_capoff;
};
static inline uint32_t pci_bar_offset(uint32_t idx)