]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/VirtioLib: change the parameter of VirtioAppendDesc() to UINT64
authorBrijesh Singh <brijesh.singh@amd.com>
Wed, 23 Aug 2017 10:57:19 +0000 (06:57 -0400)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 25 Aug 2017 08:42:19 +0000 (10:42 +0200)
The patch change the "BufferPhysAddr" parameter of VirtioAppendDesc()
from type UINTN to UINT64.

UINTN is appropriate as long as we pass system memory references. After
the introduction of bus master device addresses, that's no longer the case
in general. Should we implement "real" IOMMU support at some point, UINTN
could break in 32-bit builds of OVMF.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
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>
[lersek@redhat.com: clarify commit message]
[lersek@redhat.com: balance parens in VirtioAppendDesc() comment blocks]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/Include/Library/VirtioLib.h
OvmfPkg/Library/VirtioLib/VirtioLib.c

index 547b4ee497b85b2168ebec8dce25db895f2ff0ad..bca58cdeb2aa1fdfe5f49a7f72a64d4aaf42002e 100644 (file)
@@ -151,33 +151,34 @@ VirtioPrepare (
   The caller is responsible for initializing *Indices with VirtioPrepare()\r
   first.\r
 \r
-  @param[in,out] Ring        The virtio ring to append the buffer to, as a\r
-                             descriptor.\r
+  @param[in,out] Ring               The virtio ring to append the buffer to,\r
+                                    as a descriptor.\r
 \r
-  @param[in] BufferPhysAddr  (Guest pseudo-physical) start address of the\r
-                             transmit / receive buffer.\r
+  @param[in] BufferDeviceAddress    (Bus master device) start address of the\r
+                                    transmit / receive buffer.\r
 \r
-  @param[in] BufferSize      Number of bytes to transmit or receive.\r
+  @param[in] BufferSize             Number of bytes to transmit or receive.\r
 \r
-  @param[in] Flags           A bitmask of VRING_DESC_F_* flags. The caller\r
-                             computes this mask dependent on further buffers to\r
-                             append and transfer direction.\r
-                             VRING_DESC_F_INDIRECT is unsupported. The\r
-                             VRING_DESC.Next field is always set, but the host\r
-                             only interprets it dependent on VRING_DESC_F_NEXT.\r
+  @param[in] Flags                  A bitmask of VRING_DESC_F_* flags. The\r
+                                    caller computes this mask dependent on\r
+                                    further buffers to append and transfer\r
+                                    direction. VRING_DESC_F_INDIRECT is\r
+                                    unsupported. The VRING_DESC.Next field is\r
+                                    always set, but the host only interprets\r
+                                    it dependent on VRING_DESC_F_NEXT.\r
 \r
-  @param[in,out] Indices     Indices->HeadDescIdx is not accessed.\r
-                             On input, Indices->NextDescIdx identifies the next\r
-                             descriptor to carry the buffer. On output,\r
-                             Indices->NextDescIdx is incremented by one, modulo\r
-                             2^16.\r
+  @param[in,out] Indices            Indices->HeadDescIdx is not accessed.\r
+                                    On input, Indices->NextDescIdx identifies\r
+                                    the next descriptor to carry the buffer.\r
+                                    On output, Indices->NextDescIdx is\r
+                                    incremented by one, modulo 2^16.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 VirtioAppendDesc (\r
   IN OUT VRING        *Ring,\r
-  IN     UINTN        BufferPhysAddr,\r
+  IN     UINT64       BufferDeviceAddress,\r
   IN     UINT32       BufferSize,\r
   IN     UINT16       Flags,\r
   IN OUT DESC_INDICES *Indices\r
index 40ea17dfaf86ad0dc1aed0c2a3dd55bcf64eb992..b94f2dd7cb30c0e1626d32c999f54e6e67f30fa5 100644 (file)
@@ -189,7 +189,6 @@ VirtioPrepare (
   Indices->NextDescIdx = Indices->HeadDescIdx;\r
 }\r
 \r
-\r
 /**\r
 \r
   Append a contiguous buffer for transmission / reception via the virtio ring.\r
@@ -205,33 +204,34 @@ VirtioPrepare (
   The caller is responsible for initializing *Indices with VirtioPrepare()\r
   first.\r
 \r
-  @param[in,out] Ring        The virtio ring to append the buffer to, as a\r
-                             descriptor.\r
+  @param[in,out] Ring               The virtio ring to append the buffer to,\r
+                                    as a descriptor.\r
 \r
-  @param[in] BufferPhysAddr  (Guest pseudo-physical) start address of the\r
-                             transmit / receive buffer.\r
+  @param[in] BufferDeviceAddress    (Bus master device) start address of the\r
+                                    transmit / receive buffer.\r
 \r
-  @param[in] BufferSize      Number of bytes to transmit or receive.\r
+  @param[in] BufferSize             Number of bytes to transmit or receive.\r
 \r
-  @param[in] Flags           A bitmask of VRING_DESC_F_* flags. The caller\r
-                             computes this mask dependent on further buffers to\r
-                             append and transfer direction.\r
-                             VRING_DESC_F_INDIRECT is unsupported. The\r
-                             VRING_DESC.Next field is always set, but the host\r
-                             only interprets it dependent on VRING_DESC_F_NEXT.\r
+  @param[in] Flags                  A bitmask of VRING_DESC_F_* flags. The\r
+                                    caller computes this mask dependent on\r
+                                    further buffers to append and transfer\r
+                                    direction. VRING_DESC_F_INDIRECT is\r
+                                    unsupported. The VRING_DESC.Next field is\r
+                                    always set, but the host only interprets\r
+                                    it dependent on VRING_DESC_F_NEXT.\r
 \r
-  @param[in,out] Indices     Indices->HeadDescIdx is not accessed.\r
-                             On input, Indices->NextDescIdx identifies the next\r
-                             descriptor to carry the buffer. On output,\r
-                             Indices->NextDescIdx is incremented by one, modulo\r
-                             2^16.\r
+  @param[in,out] Indices            Indices->HeadDescIdx is not accessed.\r
+                                    On input, Indices->NextDescIdx identifies\r
+                                    the next descriptor to carry the buffer.\r
+                                    On output, Indices->NextDescIdx is\r
+                                    incremented by one, modulo 2^16.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 VirtioAppendDesc (\r
   IN OUT VRING        *Ring,\r
-  IN     UINTN        BufferPhysAddr,\r
+  IN     UINT64       BufferDeviceAddress,\r
   IN     UINT32       BufferSize,\r
   IN     UINT16       Flags,\r
   IN OUT DESC_INDICES *Indices\r
@@ -240,7 +240,7 @@ VirtioAppendDesc (
   volatile VRING_DESC *Desc;\r
 \r
   Desc        = &Ring->Desc[Indices->NextDescIdx++ % Ring->QueueSize];\r
-  Desc->Addr  = BufferPhysAddr;\r
+  Desc->Addr  = BufferDeviceAddress;\r
   Desc->Len   = BufferSize;\r
   Desc->Flags = Flags;\r
   Desc->Next  = Indices->NextDescIdx % Ring->QueueSize;\r