From 012ec75163482bdb3de5655d319678a0ccdbddd1 Mon Sep 17 00:00:00 2001 From: dongshen Date: Tue, 25 Jun 2019 14:17:52 -0700 Subject: [PATCH] HV: rename vbdf in struct pci_vdev to bdf Rename vbdf to bdf for the following reasons: Use the same coding style as struct pci_pdev, as pci_pdev uses bdf instead of pbdf pci_vdev implies the its bdf is virtual, no need to prefix bdf with the v prefix (redundant) Tracked-On: #3241 Signed-off-by: dongshen Acked-by: Eddie Dong --- hypervisor/dm/vpci/vdev.c | 2 +- hypervisor/dm/vpci/vmsi.c | 4 ++-- hypervisor/dm/vpci/vmsix.c | 4 ++-- hypervisor/dm/vpci/vpci.c | 10 +++++----- hypervisor/dm/vpci/vpci_priv.h | 2 +- hypervisor/include/dm/vpci.h | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hypervisor/dm/vpci/vdev.c b/hypervisor/dm/vpci/vdev.c index 6214fdb00..01418d370 100644 --- a/hypervisor/dm/vpci/vdev.c +++ b/hypervisor/dm/vpci/vdev.c @@ -83,7 +83,7 @@ struct pci_vdev *pci_find_vdev_by_vbdf(const struct acrn_vpci *vpci, union pci_b for (i = 0U; i < vpci->pci_vdev_cnt; i++) { tmp = (struct pci_vdev *)&(vpci->pci_vdevs[i]); - if (bdf_is_equal(&(tmp->vbdf), &vbdf)) { + if (bdf_is_equal(&(tmp->bdf), &vbdf)) { vdev = tmp; break; } diff --git a/hypervisor/dm/vpci/vmsi.c b/hypervisor/dm/vpci/vmsi.c index 2bcc6db3b..8a41e3ce6 100644 --- a/hypervisor/dm/vpci/vmsi.c +++ b/hypervisor/dm/vpci/vmsi.c @@ -98,7 +98,7 @@ static int32_t vmsi_remap(const struct pci_vdev *vdev, bool enable) info.vmsi_data.full = 0U; } - ret = ptirq_msix_remap(vm, vdev->vbdf.value, pbdf.value, 0U, &info); + ret = ptirq_msix_remap(vm, vdev->bdf.value, pbdf.value, 0U, &info); if (ret == 0) { /* Update MSI Capability structure to physical device */ pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.pmsi_addr.full); @@ -185,7 +185,7 @@ int32_t vmsi_write_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, u void deinit_vmsi(const struct pci_vdev *vdev) { if (has_msi_cap(vdev)) { - ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, 1U); + ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->bdf.value, 1U); } } diff --git a/hypervisor/dm/vpci/vmsix.c b/hypervisor/dm/vpci/vmsix.c index 1902861cf..37573e384 100644 --- a/hypervisor/dm/vpci/vmsix.c +++ b/hypervisor/dm/vpci/vmsix.c @@ -77,7 +77,7 @@ static int32_t vmsix_remap_entry(const struct pci_vdev *vdev, uint32_t index, bo info.vmsi_addr.full = vdev->msix.table_entries[index].addr; info.vmsi_data.full = (enable) ? vdev->msix.table_entries[index].data : 0U; - ret = ptirq_msix_remap(vdev->vpci->vm, vdev->vbdf.value, vdev->pdev->bdf.value, (uint16_t)index, &info); + ret = ptirq_msix_remap(vdev->vpci->vm, vdev->bdf.value, vdev->pdev->bdf.value, (uint16_t)index, &info); if (ret == 0) { /* Write the table entry to the physical structure */ hva = hpa2hva(vdev->msix.mmio_hpa + vdev->msix.table_offset); @@ -383,7 +383,7 @@ void deinit_vmsix(const struct pci_vdev *vdev) { if (has_msix_cap(vdev)) { if (vdev->msix.table_count != 0U) { - ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, vdev->msix.table_count); + ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->bdf.value, vdev->msix.table_count); } } } diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index 16bc89793..16e70a29e 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -419,10 +419,10 @@ static void init_vdev_for_pdev(struct pci_pdev *pdev, const struct acrn_vm *vm) if (ptdev_config != NULL) { /* vbdf is defined in vm_config */ - vdev->vbdf.value = ptdev_config->vbdf.value; + vdev->bdf.value = ptdev_config->vbdf.value; } else { /* vbdf is not defined in vm_config, set it to equal to pbdf */ - vdev->vbdf.value = pdev->bdf.value; + vdev->bdf.value = pdev->bdf.value; } init_vhostbridge(vdev); @@ -523,7 +523,7 @@ static void deinit_postlaunched_vm_vpci(const struct acrn_vm *vm) vdev->vpci = (struct acrn_vpci *) &sos_vm->vpci; /* vbdf equals to pbdf in sos */ - vdev->vbdf.value = vdev->pdev->bdf.value; + vdev->bdf.value = vdev->pdev->bdf.value; } } } @@ -544,7 +544,7 @@ void vpci_set_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, ui } else { /* UOS may do BDF mapping */ vdev->vpci = (struct acrn_vpci *)&(target_vm->vpci); - vdev->vbdf.value = vbdf; + vdev->bdf.value = vbdf; vdev->pdev->bdf.value = pbdf; } } @@ -571,7 +571,7 @@ void vpci_reset_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, vdev->vpci = &vm->vpci; /* vbdf equals to pbdf in sos */ - vdev->vbdf.value = vdev->pdev->bdf.value; + vdev->bdf.value = vdev->pdev->bdf.value; } } } diff --git a/hypervisor/dm/vpci/vpci_priv.h b/hypervisor/dm/vpci/vpci_priv.h index f8b846bed..1ae0ffa98 100644 --- a/hypervisor/dm/vpci/vpci_priv.h +++ b/hypervisor/dm/vpci/vpci_priv.h @@ -98,7 +98,7 @@ static inline bool has_msix_cap(const struct pci_vdev *vdev) */ static inline bool is_hostbridge(const struct pci_vdev *vdev) { - return (vdev->vbdf.value == 0U); + return (vdev->bdf.value == 0U); } void init_vhostbridge(struct pci_vdev *vdev); diff --git a/hypervisor/include/dm/vpci.h b/hypervisor/include/dm/vpci.h index a1770904c..772c09ff4 100644 --- a/hypervisor/include/dm/vpci.h +++ b/hypervisor/include/dm/vpci.h @@ -67,7 +67,7 @@ union pci_cfgdata { struct pci_vdev { const struct acrn_vpci *vpci; /* The bus/device/function triple of the virtual PCI device. */ - union pci_bdf vbdf; + union pci_bdf bdf; struct pci_pdev *pdev;