mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-09 04:39:34 +00:00
HV: remove function pci_pdev_foreach()
And make other related changes accordingly: Remove pci_pdev_enumeration_cb define Create init_vdevs() to iterate through the pdev list and create vdev for each pdev Export num_pci_pdev and pci_pdev_array as globals in header file Minor cosmetic fix: Remove trailing whitespace Tracked-On: #3022 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
536c69b9ff
commit
a6503c6af3
@@ -34,7 +34,7 @@
|
||||
#include <logmsg.h>
|
||||
#include "vpci_priv.h"
|
||||
|
||||
static void init_vdev_for_pdev(struct pci_pdev *pdev, const void *vm);
|
||||
static void init_vdevs(const struct acrn_vm *vm);
|
||||
static void deinit_prelaunched_vm_vpci(const struct acrn_vm *vm);
|
||||
static void deinit_postlaunched_vm_vpci(const struct acrn_vm *vm);
|
||||
static void read_cfg(const struct acrn_vpci *vpci, union pci_bdf bdf, uint32_t offset, uint32_t bytes, uint32_t *val);
|
||||
@@ -208,8 +208,8 @@ void vpci_init(struct acrn_vm *vm)
|
||||
case PRE_LAUNCHED_VM:
|
||||
case SOS_VM:
|
||||
vm->iommu = create_iommu_domain(vm->vm_id, hva2hpa(vm->arch_vm.nworld_eptp), 48U);
|
||||
/* Build up vdev array for vm */
|
||||
pci_pdev_foreach(init_vdev_for_pdev, vm);
|
||||
/* Build up vdev list for vm */
|
||||
init_vdevs(vm);
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
@@ -398,9 +398,9 @@ static struct acrn_vm_pci_ptdev_config *find_ptdev_config_by_pbdf(const struct a
|
||||
* @pre vm != NULL
|
||||
* @pre vm->vpci.pci_vdev_cnt <= CONFIG_MAX_PCI_DEV_NUM
|
||||
*/
|
||||
static void init_vdev_for_pdev(struct pci_pdev *pdev, const void *vm)
|
||||
static void init_vdev_for_pdev(struct pci_pdev *pdev, const struct acrn_vm *vm)
|
||||
{
|
||||
const struct acrn_vm_config *vm_config = get_vm_config(((struct acrn_vm *)vm)->vm_id);
|
||||
const struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||
struct acrn_vpci *vpci = &(((struct acrn_vm *)vm)->vpci);
|
||||
struct acrn_vm_pci_ptdev_config *ptdev_config;
|
||||
|
||||
@@ -450,6 +450,18 @@ static void init_vdev_for_pdev(struct pci_pdev *pdev, const void *vm)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm != NULL
|
||||
*/
|
||||
static void init_vdevs(const struct acrn_vm *vm)
|
||||
{
|
||||
uint32_t idx;
|
||||
|
||||
for (idx = 0U; idx < num_pci_pdev; idx++) {
|
||||
init_vdev_for_pdev(&pci_pdev_array[idx], vm);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm != NULL
|
||||
* @pre vm->vpci.pci_vdev_cnt <= CONFIG_MAX_PCI_DEV_NUM
|
||||
@@ -561,6 +573,7 @@ void vpci_reset_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf,
|
||||
vm = get_sos_vm();
|
||||
|
||||
vdev->vpci = &vm->vpci;
|
||||
|
||||
/* vbdf equals to pbdf in sos */
|
||||
vdev->vbdf.value = vdev->pdev->bdf.value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user