aboutsummaryrefslogtreecommitdiff
path: root/hw/rdma
AgeCommit message (Collapse)Author
2018-05-03hw/rdma: Fix possible out of bounds access to port GID indexMarcel Apfelbaum
Make sure the backend GID index is less then port's gid table length. Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Message-Id: <20180430200223.4119-8-marcel.apfelbaum@gmail.com>
2018-05-03hw/rdma: Delete duplicate definition of MAX_RM_TBL_NAMEYuval Shaia
By a mistake this constant was defined twice - remove the duplication. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Message-Id: <20180430200223.4119-7-marcel.apfelbaum@gmail.com>
2018-05-03hw/rdma: Fix possible out of bounds access to regs arrayYuval Shaia
Coverity (CID1390589, CID1390608). Array size is RDMA_BAR1_REGS_SIZE, let's make sure the given address is in range. While there also: 1. Adjust the size of this bar to reasonable size 2. Report the size of the array with sizeof(array) Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Message-Id: <20180430200223.4119-6-marcel.apfelbaum@gmail.com>
2018-05-03hw/rdma: Fix possible out of bounds access to GID tableYuval Shaia
Array size is MAX_PORT_GIDS, let's make sure the given index is in range. While there limit device table size to 1. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Message-Id: <20180430200223.4119-5-marcel.apfelbaum@gmail.com>
2018-05-03hw/rdma: Delete port's pkey tableYuval Shaia
Support for PKEY is not yet implemented. Removing the unneeded table until a support will be added. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Message-Id: <20180430200223.4119-4-marcel.apfelbaum@gmail.com>
2018-05-03hw/rdma: Fix possible usage of a NULL pointerMarcel Apfelbaum
Coverity CID 1390586; The cq handle is provided by the guest and cannot be trusted to be previuosly allocated. Fix it by exiting the completion flow. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Message-Id: <20180430200223.4119-3-marcel.apfelbaum@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2018-05-03hw/rdma: Fix possible munmap call on a NULL pointerMarcel Apfelbaum
Coverity CID 1390620: we call munmap() on a NULL pointer. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Message-Id: <20180430200223.4119-2-marcel.apfelbaum@gmail.com>
2018-03-23hw/rdma: Fix 32-bit compilationYuval Shaia
Use the correct printf formats, so that a 32-bit compile doesn't spit out lots of warnings about %lx being incompatible with uint64_t. Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180322095220.9976-4-yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-03-23hw/rdma: Use correct print format in CHK_ATTR macroYuval Shaia
Macro should not cast the given variable to u64 instead it should use the supplied format argument (fmt). Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180322095220.9976-3-yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-03-23hw/rdma: Change host_virt to void *Yuval Shaia
To avoid compilation warnings on 32-bit machines: rdma_backend.c: In function 'rdma_backend_create_mr': rdma_backend.c:409:37: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] mr->ibmr = ibv_reg_mr(pd->ibpd, (void *)addr, length, access); Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180322095220.9976-2-yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-03-23hw/rdma: fix clang compilation errorsMarcel Apfelbaum
Fix some enum castings and extra parentheses. Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Message-Id: <20180321140316.96045-1-marcel@redhat.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
2018-03-23rdma: fix up include directivesMichael S. Tsirkin
Our rule right now is to use <> for external headers only. RDMA code violates that, fix it up. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-03-23hw/rdma: Add support for Query QP verb to pvrdma deviceYuval Shaia
This IB verb is needed by some applications - implement it. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-03-23hw/rdma: Add Query QP operationYuval Shaia
This operation is needed by rdma devices - implement it. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-02-19hw/rdma: Implementation of PVRDMA deviceYuval Shaia
PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device. It works with its Linux Kernel driver AS IS, no need for any special guest modifications. While it complies with the VMware device, it can also communicate with bare metal RDMA-enabled machines and does not require an RDMA HCA in the host, it can work with Soft-RoCE (rxe). It does not require the whole guest RAM to be pinned allowing memory over-commit and, even if not implemented yet, migration support will be possible with some HW assistance. Implementation is divided into 2 components, rdma general and pvRDMA specific functions and structures. The second PVRDMA sub-module - interaction with PCI layer. - Device configuration and setup (MSIX, BARs etc). - Setup of DSR (Device Shared Resources) - Setup of device ring. - Device management. Reviewed-by: Dotan Barak <dotanb@mellanox.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-02-19hw/rdma: PVRDMA commands and data-path opsYuval Shaia
First PVRDMA sub-module - implementation of the PVRDMA device. - PVRDMA commands such as create CQ and create MR. - Data path QP operations - post_send and post_recv. - Completion handler. Reviewed-by: Dotan Barak <dotanb@mellanox.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-02-19hw/rdma: Implementation of generic rdma device layersYuval Shaia
This layer is composed of two sub-modules, backend and resource manager. Backend sub-module is responsible for all the interaction with IB layers such as ibverbs and umad (external libraries). Resource manager is a collection of functions and structures to manage RDMA resources such as QPs, CQs and MRs. Reviewed-by: Dotan Barak <dotanb@mellanox.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-02-19hw/rdma: Definitions for rdma device and rdma resource managerYuval Shaia
Definition of various structures and constants used in backend and resource manager modules. Reviewed-by: Dotan Barak <dotanb@mellanox.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2018-02-19hw/rdma: Add wrappers and macrosYuval Shaia
As all mapping for this device are from driver to device, declare wrappers on top of pci_dma_*map functions. In addition, declare macros to be used for debug messages. Reviewed-by: Dotan Barak <dotanb@mellanox.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>