HV: refine pci_find_vdev with hash

hv: pci: refine pci_find_vdev with hash

1. Refined pci_find_vdev with BDF-hashing for better performance

Tracked-On: #4857
Signed-off-by: Wang Qian <qian1.wang@intel.com>
Reviewed-by: Li Fei <Fei1.Li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Qian Wang
2020-06-16 11:34:03 +08:00
committed by wenlingz
parent 8fb8d81935
commit 882c9d5d76
3 changed files with 16 additions and 7 deletions

View File

@@ -32,7 +32,10 @@
#include <spinlock.h>
#include <pci.h>
#include <list.h>
#define VDEV_LIST_HASHBITS 4U
#define VDEV_LIST_HASHSIZE (1U << VDEV_LIST_HASHBITS)
struct pci_vbar {
enum pci_bar_type type;
@@ -135,6 +138,7 @@ struct pci_vdev {
*/
struct pci_vdev *parent_user;
struct pci_vdev *user;
struct hlist_node link;
};
union pci_cfg_addr_reg {
@@ -153,6 +157,7 @@ struct acrn_vpci {
uint64_t pci_mmcfg_base;
uint32_t pci_vdev_cnt;
struct pci_vdev pci_vdevs[CONFIG_MAX_PCI_DEV_NUM];
struct hlist_head vdevs_hlist_heads [VDEV_LIST_HASHSIZE];
};
struct acrn_vm;