mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-18 09:23:44 +00:00
hv: refine init_one_dev_config
The init_one_dev_config is used to initialize a acrn_vm_pci_dev_config SRIOV needs a explicit acrn_vm_pci_dev_config to create a VF vdev,so refine it to return acrn_vm_pci_dev_config. Tracked-On: #4433 Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
87e7d79112
commit
320ed6c238
@ -54,13 +54,21 @@ static bool is_allocated_to_prelaunched_vm(struct pci_pdev *pdev)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @pre: pdev != NULL
|
* @brief Initialize a acrn_vm_pci_dev_config structure
|
||||||
|
*
|
||||||
|
* Initialize a acrn_vm_pci_dev_config structure with a specified the pdev structure.
|
||||||
|
* A acrn_vm_pci_dev_config is used to store a PCI device configuration for a VM. The
|
||||||
|
* caller of the function init_one_dev_config should guarantee execution atomically.
|
||||||
|
*
|
||||||
|
* @pre pdev != NULL
|
||||||
|
*
|
||||||
|
* @return If there's a successfully initialized acrn_vm_pci_dev_config return it, otherwise return NULL;
|
||||||
*/
|
*/
|
||||||
void init_one_dev_config(struct pci_pdev *pdev)
|
struct acrn_vm_pci_dev_config *init_one_dev_config(struct pci_pdev *pdev)
|
||||||
{
|
{
|
||||||
uint16_t vmid;
|
uint16_t vmid;
|
||||||
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 = NULL;
|
||||||
|
|
||||||
if (!is_allocated_to_prelaunched_vm(pdev)) {
|
if (!is_allocated_to_prelaunched_vm(pdev)) {
|
||||||
for (vmid = 0U; vmid < CONFIG_MAX_VM_NUM; vmid++) {
|
for (vmid = 0U; vmid < CONFIG_MAX_VM_NUM; vmid++) {
|
||||||
@ -77,4 +85,5 @@ void init_one_dev_config(struct pci_pdev *pdev)
|
|||||||
vm_config->pci_dev_num++;
|
vm_config->pci_dev_num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return dev_config;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
extern struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM];
|
extern struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM];
|
||||||
|
|
||||||
struct pci_pdev;
|
struct pci_pdev;
|
||||||
void init_one_dev_config(struct pci_pdev *pdev);
|
struct acrn_vm_pci_dev_config *init_one_dev_config(struct pci_pdev *pdev);
|
||||||
|
|
||||||
#endif /* PCI_DEV_H_ */
|
#endif /* PCI_DEV_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user