Skip to content

Commit

Permalink
HV: rename vbdf in struct pci_vdev to bdf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
donsheng authored and wenlingz committed Jul 4, 2019
1 parent 148e747 commit 012ec75
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hypervisor/dm/vpci/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions hypervisor/dm/vpci/vmsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions hypervisor/dm/vpci/vmsix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
10 changes: 5 additions & 5 deletions hypervisor/dm/vpci/vpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
}
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion hypervisor/dm/vpci/vpci_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion hypervisor/include/dm/vpci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 012ec75

Please sign in to comment.