MCPcopy Create free account
hub / github.com/F-Stack/f-stack / translate_log_addr

Function translate_log_addr

dpdk/lib/vhost/vhost.c:459–486  ·  view source on GitHub ↗

* Converts vring log address to GPA * If IOMMU is enabled, the log address is IOVA * If IOMMU not enabled, the log address is already GPA */

Source from the content-addressed store, hash-verified

457 * If IOMMU not enabled, the log address is already GPA
458 */
459uint64_t
460translate_log_addr(struct virtio_net *dev, struct vhost_virtqueue *vq,
461 uint64_t log_addr)
462{
463 if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) {
464 const uint64_t exp_size = sizeof(uint64_t);
465 uint64_t hva, gpa;
466 uint64_t size = exp_size;
467
468 hva = vhost_iova_to_vva(dev, vq, log_addr,
469 &size, VHOST_ACCESS_RW);
470
471 if (size != exp_size)
472 return 0;
473
474 gpa = hva_to_gpa(dev, hva, exp_size);
475 if (!gpa) {
476 VHOST_LOG_DATA(dev->ifname, ERR,
477 "failed to find GPA for log_addr: 0x%"
478 PRIx64 " hva: 0x%" PRIx64 "\n",
479 log_addr, hva);
480 return 0;
481 }
482 return gpa;
483
484 } else
485 return log_addr;
486}
487
488static int
489vring_translate_split(struct virtio_net *dev, struct vhost_virtqueue *vq)

Callers 2

log_translateFunction · 0.85
log_addr_to_gpaFunction · 0.85

Calls 1

hva_to_gpaFunction · 0.70

Tested by

no test coverage detected