virtio/pci: make sure each queue is physically contiguous
The spdk_dma_zmalloc guarantee about physical memory contiguity is about to be removed soon. For hardware rings that require physical memory or IOVA contiguity we will now enforce hugepage alignment and size restrictions to make sure they occupy only a single hugepage. Change-Id: I8f44ad6f33d60f01403cc3db693497e4f722e528 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/418612 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
9166bb3c51
commit
e8762a41db
@ -264,7 +264,15 @@ modern_setup_queue(struct virtio_dev *dev, struct virtqueue *vq)
|
||||
void *queue_mem;
|
||||
uint64_t queue_mem_phys_addr;
|
||||
|
||||
queue_mem = spdk_dma_zmalloc(vq->vq_ring_size, VIRTIO_PCI_VRING_ALIGN, &queue_mem_phys_addr);
|
||||
/* To ensure physical address contiguity we make the queue occupy
|
||||
* only a single hugepage (2MB). As of Virtio 1.0, the queue size
|
||||
* always falls within this limit.
|
||||
*/
|
||||
if (vq->vq_ring_size > 0x200000) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
queue_mem = spdk_dma_zmalloc(vq->vq_ring_size, 0x200000, &queue_mem_phys_addr);
|
||||
if (queue_mem == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user