mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-12 17:06:13 +00:00
hv: vpci: remove pBDF configure for emulated device
Since now we use vBDF to search the device for PCI vdev. Tracked-On: #3475 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
parent
90480db553
commit
d82a00a128
@ -9,17 +9,10 @@
|
|||||||
#include <pci_dev.h>
|
#include <pci_dev.h>
|
||||||
#include <vpci.h>
|
#include <vpci.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* In theory, emulated PCI device doesn't need to bind to physical PCI device.
|
|
||||||
* However, now we need to search virtual PCI device by pBDF because we bind
|
|
||||||
* post-launched VM PTDev with SOS's.
|
|
||||||
* Remove the pBDF for emulated PCI device once we don't have this limit.
|
|
||||||
*/
|
|
||||||
struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM] = {
|
struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM] = {
|
||||||
{
|
{
|
||||||
.emu_type = PCI_DEV_TYPE_HVEMUL,
|
.emu_type = PCI_DEV_TYPE_HVEMUL,
|
||||||
.vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x00U},
|
.vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x00U},
|
||||||
.pbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x00U},
|
|
||||||
.vdev_ops = &vhostbridge_ops,
|
.vdev_ops = &vhostbridge_ops,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -66,7 +59,6 @@ static bool is_allocated_to_prelaunched_vm(struct pci_pdev *pdev)
|
|||||||
void fill_pci_dev_config(struct pci_pdev *pdev)
|
void fill_pci_dev_config(struct pci_pdev *pdev)
|
||||||
{
|
{
|
||||||
uint16_t vmid;
|
uint16_t vmid;
|
||||||
uint32_t idx;
|
|
||||||
struct acrn_vm_config *vm_config;
|
struct acrn_vm_config *vm_config;
|
||||||
struct acrn_vm_pci_dev_config *dev_config;
|
struct acrn_vm_pci_dev_config *dev_config;
|
||||||
|
|
||||||
@ -77,24 +69,12 @@ void fill_pci_dev_config(struct pci_pdev *pdev)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: revert me if we could split post-launched VM's PTDev from SOS's */
|
dev_config = &vm_config->pci_devs[vm_config->pci_dev_num];
|
||||||
for (idx = 0U; idx < SOS_EMULATED_PCI_DEV_NUM; idx++) {
|
dev_config->emu_type = PCI_DEV_TYPE_PTDEV;
|
||||||
dev_config = &vm_config->pci_devs[idx];
|
dev_config->vbdf.value = pdev->bdf.value;
|
||||||
if (bdf_is_equal(&dev_config->pbdf, &pdev->bdf)) {
|
dev_config->pbdf.value = pdev->bdf.value;
|
||||||
dev_config->pdev = pdev;
|
dev_config->pdev = pdev;
|
||||||
break;
|
vm_config->pci_dev_num++;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx == SOS_EMULATED_PCI_DEV_NUM) {
|
|
||||||
dev_config = &vm_config->pci_devs[vm_config->pci_dev_num];
|
|
||||||
dev_config->emu_type = PCI_DEV_TYPE_PTDEV;
|
|
||||||
dev_config->vbdf.value = pdev->bdf.value;
|
|
||||||
dev_config->pbdf.value = pdev->bdf.value;
|
|
||||||
dev_config->pdev = pdev;
|
|
||||||
vm_config->pci_dev_num++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user