Skip to content

Commit 65ffad6

Browse files
authored
Merge pull request #905 from rradjabi/kernelUpgradeFixF1
Kernel Upgrade Fix for F1
2 parents afd9469 + 89c7f8b commit 65ffad6

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

src/runtime_src/driver/xclng/drm/xocl/userpf/common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ struct xocl_dev {
111111
/*should be removed after mailbox is supported */
112112
u64 unique_id_last_bitstream;
113113
/* remove the previous id after we move to uuid */
114+
115+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) || RHEL_P2P_SUPPORT_76
116+
struct dev_pagemap pgmap;
117+
#endif
118+
114119
xuid_t xclbin_id;
115120
unsigned ip_reference[MAX_CUS];
116121
struct list_head ctx_list;

src/runtime_src/driver/xclng/drm/xocl/userpf/xdma.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,29 @@ static int xocl_p2p_mem_reserve(struct pci_dev *pdev, xdev_handle_t xdev_hdl)
144144
#endif
145145

146146

147+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) || RHEL_P2P_SUPPORT_76
148+
xdev->pgmap.ref = &xdev->ref;
149+
memcpy(&xdev->pgmap.res, &res, sizeof(struct resource));
150+
xdev->pgmap.altmap_valid = false;
151+
#endif
152+
153+
147154
/* Ubuntu 16.04 kernel_ver 4.4.0.116*/
148155
#if KERNEL_VERSION(4, 5, 0) > LINUX_VERSION_CODE && \
149156
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
150-
xdev->bypass_bar_addr= devm_memremap_pages(&(pdev->dev), &res);
157+
xdev->bypass_bar_addr = devm_memremap_pages(&(pdev->dev), &res);
151158

152-
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || RHEL_P2P_SUPPORT
153-
xdev->bypass_bar_addr= devm_memremap_pages(&(pdev->dev), &res
159+
#elif KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE && \
160+
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || RHEL_P2P_SUPPORT_74
161+
xdev->bypass_bar_addr = devm_memremap_pages(&(pdev->dev), &res
154162
, &xdev->ref, NULL);
155163

164+
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) || RHEL_P2P_SUPPORT_76
165+
xdev->bypass_bar_addr = devm_memremap_pages(&(pdev->dev), &xdev->pgmap);
166+
167+
#endif
168+
169+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || RHEL_P2P_SUPPORT
156170
ret = devm_add_action_or_reset(&(pdev->dev), xocl_dev_percpu_kill,
157171
&xdev->ref);
158172
if (ret)

src/runtime_src/driver/xclng/drm/xocl/xocl_drv.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,26 @@ static inline bool uuid_is_null(const xuid_t *uuid)
103103
#define XOCL_CHARDEV_REG_COUNT 16
104104

105105
#ifdef RHEL_RELEASE_VERSION
106-
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,3)
107-
#define RHEL_P2P_SUPPORT 1
108-
#else
109-
#define RHEL_P2P_SUPPORT 0
106+
107+
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
108+
#define RHEL_P2P_SUPPORT_74 0
109+
#define RHEL_P2P_SUPPORT_76 1
110+
#elif RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7,3) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
111+
#define RHEL_P2P_SUPPORT_74 1
112+
#define RHEL_P2P_SUPPORT_76 0
110113
#endif
111114
#else
112-
#define RHEL_P2P_SUPPORT 0
115+
#define RHEL_P2P_SUPPORT_74 0
116+
#define RHEL_P2P_SUPPORT_76 0
113117
#endif
114118

115119
#define INVALID_SUBDEVICE ~0U
116120
#define NUMS_OF_DYNA_IP_ADDR 4
117121

122+
#define RHEL_P2P_SUPPORT (RHEL_P2P_SUPPORT_74 | RHEL_P2P_SUPPORT_76)
123+
124+
#define XOCL_INVALID_MINOR -1
125+
118126
extern struct class *xrt_class;
119127

120128
struct xocl_dev;

src/runtime_src/tools/scripts/setup.csh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if ( "$OSDIST" =~ "ubuntu" ) then
3939
endif
4040

4141
if ( "$OSDIST" =~ centos || "$OSDIST" =~ redhat* ) then
42-
if ( "$OSREL" !~ 7.4* && "$OSREL" !~ 7.5* ) then
42+
if ( "$OSREL" !~ 7.4* && "$OSREL" !~ 7.5* && "$OSREL" !~ 7.6* ) then
4343
echo "ERROR: Centos or RHEL release version must be 7.4 or later"
4444
exit 1
4545
endif

src/runtime_src/tools/scripts/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [[ $OSDIST == "ubuntu" ]]; then
1515
fi
1616

1717
if [[ $OSDIST == "centos" ]] || [[ $OSDIST == "redhat"* ]]; then
18-
if [[ $OSREL != "7.4"* ]] && [[ $OSREL != "7.5"* ]]; then
18+
if [[ $OSREL != "7.4"* ]] && [[ $OSREL != "7.5"* ]] && [[ $OSREL != "7.6"* ]]; then
1919
echo "ERROR: Centos or RHEL release version must be 7.4 or later"
2020
return 1
2121
fi

0 commit comments

Comments
 (0)