Skip to content

Commit 012ec75

Browse files
donshengwenlingz
authored andcommitted
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 <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 148e747 commit 012ec75

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

hypervisor/dm/vpci/vdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct pci_vdev *pci_find_vdev_by_vbdf(const struct acrn_vpci *vpci, union pci_b
8383
for (i = 0U; i < vpci->pci_vdev_cnt; i++) {
8484
tmp = (struct pci_vdev *)&(vpci->pci_vdevs[i]);
8585

86-
if (bdf_is_equal(&(tmp->vbdf), &vbdf)) {
86+
if (bdf_is_equal(&(tmp->bdf), &vbdf)) {
8787
vdev = tmp;
8888
break;
8989
}

hypervisor/dm/vpci/vmsi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static int32_t vmsi_remap(const struct pci_vdev *vdev, bool enable)
9898
info.vmsi_data.full = 0U;
9999
}
100100

101-
ret = ptirq_msix_remap(vm, vdev->vbdf.value, pbdf.value, 0U, &info);
101+
ret = ptirq_msix_remap(vm, vdev->bdf.value, pbdf.value, 0U, &info);
102102
if (ret == 0) {
103103
/* Update MSI Capability structure to physical device */
104104
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
185185
void deinit_vmsi(const struct pci_vdev *vdev)
186186
{
187187
if (has_msi_cap(vdev)) {
188-
ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, 1U);
188+
ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->bdf.value, 1U);
189189
}
190190
}
191191

hypervisor/dm/vpci/vmsix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int32_t vmsix_remap_entry(const struct pci_vdev *vdev, uint32_t index, bo
7777
info.vmsi_addr.full = vdev->msix.table_entries[index].addr;
7878
info.vmsi_data.full = (enable) ? vdev->msix.table_entries[index].data : 0U;
7979

80-
ret = ptirq_msix_remap(vdev->vpci->vm, vdev->vbdf.value, vdev->pdev->bdf.value, (uint16_t)index, &info);
80+
ret = ptirq_msix_remap(vdev->vpci->vm, vdev->bdf.value, vdev->pdev->bdf.value, (uint16_t)index, &info);
8181
if (ret == 0) {
8282
/* Write the table entry to the physical structure */
8383
hva = hpa2hva(vdev->msix.mmio_hpa + vdev->msix.table_offset);
@@ -383,7 +383,7 @@ void deinit_vmsix(const struct pci_vdev *vdev)
383383
{
384384
if (has_msix_cap(vdev)) {
385385
if (vdev->msix.table_count != 0U) {
386-
ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, vdev->msix.table_count);
386+
ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->bdf.value, vdev->msix.table_count);
387387
}
388388
}
389389
}

hypervisor/dm/vpci/vpci.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ static void init_vdev_for_pdev(struct pci_pdev *pdev, const struct acrn_vm *vm)
419419

420420
if (ptdev_config != NULL) {
421421
/* vbdf is defined in vm_config */
422-
vdev->vbdf.value = ptdev_config->vbdf.value;
422+
vdev->bdf.value = ptdev_config->vbdf.value;
423423
} else {
424424
/* vbdf is not defined in vm_config, set it to equal to pbdf */
425-
vdev->vbdf.value = pdev->bdf.value;
425+
vdev->bdf.value = pdev->bdf.value;
426426
}
427427

428428
init_vhostbridge(vdev);
@@ -523,7 +523,7 @@ static void deinit_postlaunched_vm_vpci(const struct acrn_vm *vm)
523523
vdev->vpci = (struct acrn_vpci *) &sos_vm->vpci;
524524

525525
/* vbdf equals to pbdf in sos */
526-
vdev->vbdf.value = vdev->pdev->bdf.value;
526+
vdev->bdf.value = vdev->pdev->bdf.value;
527527
}
528528
}
529529
}
@@ -544,7 +544,7 @@ void vpci_set_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, ui
544544
} else {
545545
/* UOS may do BDF mapping */
546546
vdev->vpci = (struct acrn_vpci *)&(target_vm->vpci);
547-
vdev->vbdf.value = vbdf;
547+
vdev->bdf.value = vbdf;
548548
vdev->pdev->bdf.value = pbdf;
549549
}
550550
}
@@ -571,7 +571,7 @@ void vpci_reset_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf,
571571
vdev->vpci = &vm->vpci;
572572

573573
/* vbdf equals to pbdf in sos */
574-
vdev->vbdf.value = vdev->pdev->bdf.value;
574+
vdev->bdf.value = vdev->pdev->bdf.value;
575575
}
576576
}
577577
}

hypervisor/dm/vpci/vpci_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static inline bool has_msix_cap(const struct pci_vdev *vdev)
9898
*/
9999
static inline bool is_hostbridge(const struct pci_vdev *vdev)
100100
{
101-
return (vdev->vbdf.value == 0U);
101+
return (vdev->bdf.value == 0U);
102102
}
103103

104104
void init_vhostbridge(struct pci_vdev *vdev);

hypervisor/include/dm/vpci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ union pci_cfgdata {
6767
struct pci_vdev {
6868
const struct acrn_vpci *vpci;
6969
/* The bus/device/function triple of the virtual PCI device. */
70-
union pci_bdf vbdf;
70+
union pci_bdf bdf;
7171

7272
struct pci_pdev *pdev;
7373

0 commit comments

Comments
 (0)