mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 00:38:28 +00:00
hv: vpci: rename ptdev_config to pci_dev_config
pci_dev_config in VM configure stores all the PCI devices for a VM. Besides PT devices, there're other type devices, like virtual host bridge. So rename ptdev to pci_dev for these configure. Tracked-On: #3475 Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
83e887dbb3
commit
adbaaaf6cb
@@ -498,7 +498,7 @@ void init_vdev_pt(struct pci_vdev *vdev)
|
||||
vbar_base = get_pbar_base(vdev->pdev, idx);
|
||||
} else if (idx > 0U) {
|
||||
/* For pre-launched VMs: vbar base is predefined in vm_config */
|
||||
vbar_base = vdev->ptdev_config->vbar_base[idx - 1U];
|
||||
vbar_base = vdev->pci_dev_config->vbar_base[idx - 1U];
|
||||
} else {
|
||||
vbar_base = 0UL;
|
||||
}
|
||||
@@ -522,7 +522,7 @@ void init_vdev_pt(struct pci_vdev *vdev)
|
||||
vbar_base = get_pbar_base(vdev->pdev, idx);
|
||||
} else {
|
||||
/* For pre-launched VMs: vbar base is predefined in vm_config */
|
||||
vbar_base = vdev->ptdev_config->vbar_base[idx];
|
||||
vbar_base = vdev->pci_dev_config->vbar_base[idx];
|
||||
}
|
||||
vdev_pt_write_vbar(vdev, pci_bar_offset(idx), (uint32_t)vbar_base);
|
||||
break;
|
||||
|
@@ -420,25 +420,25 @@ static void write_cfg(const struct acrn_vpci *vpci, union pci_bdf bdf,
|
||||
|
||||
/**
|
||||
* @pre vm_config != NULL
|
||||
* @pre vm_config->pci_ptdev_num <= CONFIG_MAX_PCI_DEV_NUM
|
||||
* @pre vm_config->pci_dev_num <= CONFIG_MAX_PCI_DEV_NUM
|
||||
*/
|
||||
static struct acrn_vm_pci_ptdev_config *find_ptdev_config_by_pbdf(const struct acrn_vm_config *vm_config,
|
||||
static struct acrn_vm_pci_dev_config *find_pci_dev_config(const struct acrn_vm_config *vm_config,
|
||||
union pci_bdf pbdf)
|
||||
{
|
||||
struct acrn_vm_pci_ptdev_config *ptdev_config, *tmp;
|
||||
struct acrn_vm_pci_dev_config *pci_dev_config, *tmp;
|
||||
uint16_t i;
|
||||
|
||||
ptdev_config = NULL;
|
||||
for (i = 0U; i < vm_config->pci_ptdev_num; i++) {
|
||||
tmp = &vm_config->pci_ptdevs[i];
|
||||
pci_dev_config = NULL;
|
||||
for (i = 0U; i < vm_config->pci_dev_num; i++) {
|
||||
tmp = &vm_config->pci_devs[i];
|
||||
|
||||
if (bdf_is_equal(&tmp->pbdf, &pbdf)) {
|
||||
ptdev_config = tmp;
|
||||
pci_dev_config = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ptdev_config;
|
||||
return pci_dev_config;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,11 +450,11 @@ 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(vm->vm_id);
|
||||
struct acrn_vpci *vpci = &(((struct acrn_vm *)vm)->vpci);
|
||||
struct acrn_vm_pci_ptdev_config *ptdev_config;
|
||||
struct acrn_vm_pci_dev_config *pci_dev_config;
|
||||
|
||||
ptdev_config = find_ptdev_config_by_pbdf(vm_config, pdev->bdf);
|
||||
pci_dev_config = find_pci_dev_config(vm_config, pdev->bdf);
|
||||
|
||||
if (((is_prelaunched_vm(vm) && (ptdev_config != NULL)) || is_sos_vm(vm))
|
||||
if (((is_prelaunched_vm(vm) && (pci_dev_config != NULL)) || is_sos_vm(vm))
|
||||
&& (vpci->pci_vdev_cnt < CONFIG_MAX_PCI_DEV_NUM)) {
|
||||
struct pci_vdev *vdev;
|
||||
|
||||
@@ -463,11 +463,11 @@ static void init_vdev_for_pdev(struct pci_pdev *pdev, const struct acrn_vm *vm)
|
||||
|
||||
vdev->vpci = vpci;
|
||||
vdev->pdev = pdev;
|
||||
vdev->ptdev_config = ptdev_config;
|
||||
vdev->pci_dev_config = pci_dev_config;
|
||||
|
||||
if (ptdev_config != NULL) {
|
||||
if (pci_dev_config != NULL) {
|
||||
/* vbdf is defined in vm_config */
|
||||
vdev->bdf.value = ptdev_config->vbdf.value;
|
||||
vdev->bdf.value = pci_dev_config->vbdf.value;
|
||||
} else {
|
||||
/* vbdf is not defined in vm_config, set it to equal to pbdf */
|
||||
vdev->bdf.value = pdev->bdf.value;
|
||||
|
Reference in New Issue
Block a user