Skip to content

Commit e0a101d

Browse files
lifeixwenlingz
authored andcommitted
hv: vpci: a minor fix about is_zombie_vf
Now we check whether a device is zombie by the ->user != NULL. Tracked-On: #4550 Signed-off-by: Li Fei1 <[email protected]>
1 parent 2100ef0 commit e0a101d

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

hypervisor/dm/vpci/vpci_priv.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ static inline bool msicap_access(const struct pci_vdev *vdev, uint32_t offset)
112112
return (has_msi_cap(vdev) && in_range(offset, vdev->msi.capoff, vdev->msi.caplen));
113113
}
114114

115+
/**
116+
* @brief Check if the specified vdev is a zombie VF instance
117+
*
118+
* @pre: The vdev is a VF instance
119+
*
120+
* @param vdev Pointer to vdev instance
121+
*
122+
* @return If the vdev is a zombie VF instance return true, otherwise return false
123+
*/
124+
static inline bool is_zombie_vf(const struct pci_vdev *vdev)
125+
{
126+
return (vdev->user == NULL);
127+
}
128+
115129
void init_vdev_pt(struct pci_vdev *vdev, bool is_pf_vdev);
116130
void deinit_vdev_pt(struct pci_vdev *vdev);
117131
void vdev_pt_write_vbar(struct pci_vdev *vdev, uint32_t idx, uint32_t val);

hypervisor/include/arch/x86/guest/vm.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,6 @@ static inline uint16_t vmid_2_rel_vmid(uint16_t sos_vmid, uint16_t vmid) {
208208
return (vmid - sos_vmid);
209209
}
210210

211-
/**
212-
* @brief Check if the specified vdev is a zombie VF instance
213-
*
214-
* @param vdev Pointer to vdev instance
215-
*
216-
* @return If the vdev is a zombie VF instance return true, otherwise return false
217-
*/
218-
static inline bool is_zombie_vf(const struct pci_vdev *vdev)
219-
{
220-
return (vdev->vpci == NULL);
221-
}
222-
223211
void make_shutdown_vm_request(uint16_t pcpu_id);
224212
bool need_shutdown_vm(uint16_t pcpu_id);
225213
int32_t shutdown_vm(struct acrn_vm *vm);

hypervisor/include/dm/vpci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct pci_vdev {
132132
* user | vdev in HV | vdev in pre-VM | vdev in SOS | vdev in post-VM | vdev in post-VM
133133
*/
134134
struct pci_vdev *parent_user;
135-
struct pci_vdev *user;
135+
struct pci_vdev *user; /* NULL means this device is not used or is a zombie VF */
136136
};
137137

138138
union pci_cfg_addr_reg {

0 commit comments

Comments
 (0)