OvmfPkg/VirtioNetDxe: alloc RxBuf using AllocateSharedPages()
When device is behind the IOMMU, VirtioNetDxe is required to use the device address in bus master operations. RxBuf is allocated using AllocatePool() which returns the system physical address. The patch uses VIRTIO_DEVICE_PROTOCOL.AllocateSharedPages() to allocate the RxBuf and map with VirtioMapAllBytesInSharedBuffer() so that we can obtain the device address for RxBuf. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
committed by
Laszlo Ersek
parent
940baec09c
commit
46b11f00ac
@@ -82,6 +82,7 @@ VirtioNetReceive (
|
||||
UINT8 *RxPtr;
|
||||
UINT16 AvailIdx;
|
||||
EFI_STATUS NotifyStatus;
|
||||
UINTN RxBufOffset;
|
||||
|
||||
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -143,7 +144,9 @@ VirtioNetReceive (
|
||||
*HeaderSize = Dev->Snm.MediaHeaderSize;
|
||||
}
|
||||
|
||||
RxPtr = (UINT8 *)(UINTN) Dev->RxRing.Desc[DescIdx + 1].Addr;
|
||||
RxBufOffset = (UINTN)(Dev->RxRing.Desc[DescIdx + 1].Addr -
|
||||
Dev->RxBufDeviceBase);
|
||||
RxPtr = Dev->RxBuf + RxBufOffset;
|
||||
CopyMem (Buffer, RxPtr, RxLen);
|
||||
|
||||
if (DestAddr != NULL) {
|
||||
|
Reference in New Issue
Block a user