From 8bc0e128a9d29691dd289fd3b6b07a6e3e8e8785 Mon Sep 17 00:00:00 2001 From: dongshen Date: Fri, 15 Feb 2019 11:53:14 -0800 Subject: [PATCH] HV: remove pbdf from struct pci_vdev pci_vdev contains a pointer to pdev, which stores pbdf, so there is no need to store a separate pbdf in vdev. Tracked-On: #2534 Signed-off-by: dongshen Reviewed-by: Eddie Dong Acked-by: Eddie Dong --- hypervisor/dm/vpci/partition_mode.c | 7 +++---- hypervisor/include/dm/vpci.h | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/hypervisor/dm/vpci/partition_mode.c b/hypervisor/dm/vpci/partition_mode.c index d798cef9f..6632653b2 100644 --- a/hypervisor/dm/vpci/partition_mode.c +++ b/hypervisor/dm/vpci/partition_mode.c @@ -67,13 +67,13 @@ static inline bool is_valid_bar(const struct pci_bar *bar) return (is_valid_bar_type(bar) && is_valid_bar_size(bar)); } -static void partition_mode_pdev_init(struct pci_vdev *vdev) +static void partition_mode_pdev_init(struct pci_vdev *vdev, union pci_bdf pbdf) { struct pci_pdev *pdev_ref; uint32_t idx; struct pci_bar *pbar, *vbar; - pdev_ref = find_pci_pdev(vdev->pbdf); + pdev_ref = find_pci_pdev(pbdf); if (pdev_ref != NULL) { vdev->pdev = pdev_ref; @@ -107,10 +107,9 @@ static int32_t partition_mode_vpci_init(const struct acrn_vm *vm) ptdev_config = vm_config->pci_ptdevs + i; vdev->vpci = vpci; vdev->vbdf.value = ptdev_config->vbdf.value; - vdev->pbdf.value = ptdev_config->pbdf.value; if (vdev->vbdf.value != 0U) { - partition_mode_pdev_init(vdev); + partition_mode_pdev_init(vdev, ptdev_config->pbdf); vdev->ops = &pci_ops_vdev_pt; } else { vdev->ops = &pci_ops_vdev_hostbridge; diff --git a/hypervisor/include/dm/vpci.h b/hypervisor/include/dm/vpci.h index 036dcd596..2a7ebe61e 100644 --- a/hypervisor/include/dm/vpci.h +++ b/hypervisor/include/dm/vpci.h @@ -91,9 +91,6 @@ struct pci_vdev { /* The bus/device/function triple of the virtual PCI device. */ union pci_bdf vbdf; - /* The bus/device/function triple of the physical PCI device. */ - union pci_bdf pbdf; - struct pci_pdev *pdev; union pci_cfgdata cfgdata;