Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/runtime_src/core/pcie/driver/linux/xocl/lib/libxdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -4344,7 +4344,9 @@ MODULE_AUTHOR("Xilinx, Inc.");
MODULE_DESCRIPTION(DRV_MODULE_DESC);
MODULE_VERSION(DRV_MODULE_VERSION);
MODULE_LICENSE("GPL v2");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) || defined(RHEL_9_0_GE)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS("DMA_BUF");
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) || defined(RHEL_9_0_GE)
MODULE_IMPORT_NS(DMA_BUF);
#endif

Expand Down
11 changes: 10 additions & 1 deletion src/runtime_src/core/pcie/driver/linux/xocl/mgmtpf/mgmt-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
#include "mgmt-core.h"

#include <linux/crc32c.h>
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/i2c.h>
Expand All @@ -24,6 +23,12 @@
#include "version.h"
#include "xclbin.h"
#include "../xocl_drv.h"

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0) || defined(RHEL_9_7_GE)
#include <linux/crc32.h>
#else
#include <linux/crc32c.h>
#endif
#include "../xocl_xclbin.h"

#define SIZE_4KB 4096
Expand Down Expand Up @@ -852,7 +857,11 @@ static bool xclmgmt_is_same_domain(struct xclmgmt_dev *lro,
return false;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0) || defined(RHEL_9_7_GE)
crc_chk = crc32_le(~0, (void *)mb_conn->kaddr, PAGE_SIZE);
#else
crc_chk = crc32c_le(~0, (void *)mb_conn->kaddr, PAGE_SIZE);
#endif
if (crc_chk != mb_conn->crc32) {
mgmt_info(lro, "crc32 : %x, %x\n", mb_conn->crc32, crc_chk);
mgmt_info(lro, "failed to get the same CRC\n");
Expand Down
4 changes: 4 additions & 0 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/p2p.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,11 @@ static void p2p_read_addr_mgmtpf(struct p2p *p2p)
mb_req->req = XCL_MAILBOX_REQ_READ_P2P_BAR_ADDR;
mb_p2p = (struct xcl_mailbox_p2p_bar_addr *)mb_req->data;

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0) && !defined(RHEL_9_7_GE)
if (!iommu_present(&pci_bus_type)){
#else
if (!device_iommu_mapped(&pcidev->dev)) {
#endif
mb_p2p->p2p_bar_len = pci_resource_len(pcidev, p2p->p2p_bar_idx);
mb_p2p->p2p_bar_addr = pci_resource_start(pcidev,
p2p->p2p_bar_idx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,9 @@ static struct drm_driver mm_drm_driver = {
#endif
.name = XOCL_MODULE_NAME,
.desc = XOCL_DRIVER_DESC,
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0) && !defined(RHEL_9_7_GE)
.date = driver_date,
#endif
};

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(RHEL_8_5_GE)
Expand Down
15 changes: 13 additions & 2 deletions src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

#include <linux/aer.h>
#include <linux/crc32c.h>
#include <linux/iommu.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand All @@ -21,6 +20,12 @@
#include "xocl_errors.h"
#include "../xocl_drv.h"

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0) || defined(RHEL_9_7_GE)
#include <linux/crc32.h>
#else
#include <linux/crc32c.h>
#endif


#ifndef PCI_EXT_CAP_ID_REBAR
#define PCI_EXT_CAP_ID_REBAR 0x15
Expand Down Expand Up @@ -621,7 +626,11 @@ static void xocl_mb_connect(struct xocl_dev *xdev)
mb_conn->kaddr = (uint64_t)kaddr;
mb_conn->paddr = (uint64_t)virt_to_phys(kaddr);
get_random_bytes(kaddr, PAGE_SIZE);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0) || defined(RHEL_9_7_GE)
mb_conn->crc32 = crc32_le(~0, kaddr, PAGE_SIZE);
#else
mb_conn->crc32 = crc32c_le(~0, kaddr, PAGE_SIZE);
#endif
mb_conn->version = XCL_MB_PROTOCOL_VER;

ret = xocl_peer_request(xdev, mb_req, reqlen, resp, &resplen,
Expand Down Expand Up @@ -2052,6 +2061,8 @@ MODULE_VERSION(XRT_DRIVER_VERSION);
MODULE_DESCRIPTION(XOCL_DRIVER_DESC);
MODULE_AUTHOR("Lizhi Hou <lizhi.hou@xilinx.com>");
MODULE_LICENSE("GPL v2");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) || defined(RHEL_9_0_GE)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS("DMA_BUF");
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) || defined(RHEL_9_0_GE)
MODULE_IMPORT_NS(DMA_BUF);
#endif
3 changes: 3 additions & 0 deletions src/runtime_src/core/pcie/driver/linux/xocl/xocl_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@
#endif

#if defined(RHEL_RELEASE_CODE)
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 7)
#define RHEL_9_7_GE
#endif
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 5)
#define RHEL_9_5_GE
#endif
Expand Down