Skip to content

Commit eee4361

Browse files
authored
Merge pull request cbm-fles#21 from sy-c/fix-rh9
Fixes for RH9
2 parents 9db297c + ec35800 commit eee4361

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

arch/linux_x86_uio/dma_buffer_inc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,16 @@ DMABuffer_free
863863
}
864864

865865
if(munlock(buffer->map, buffer->length) != 0)
866-
{ ERROR_EXIT( errno, exit, "Buffer unlocking failed!\n" ); }
866+
{
867+
#ifdef PDA_SKIP_UNLOCK_FAILURE
868+
#pragma message "*** Compiling with PDA_SKIP_UNLOCK_FAILURE"
869+
// report, but continue with release procedure even if unlock fails
870+
ERROR( errno, "Buffer unlocking failed! (but releasing)\n" );
871+
if(0) { goto exit; } // fake use of exit label to avoid compiler warning
872+
#else
873+
ERROR_EXIT( errno, exit, "Buffer unlocking failed!\n" );
874+
#endif
875+
}
867876

868877
buffer->map = MAP_FAILED;
869878
persistant = PDA_DELETE;

configure

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ MODPROBE_MODE="#define MODPROBE_MODE"
6262
PREFIX="/usr"
6363
DEBUG=""
6464
NUMA="true"
65+
EXTRA_DEFINES=""
6566

6667

6768
help()
@@ -73,6 +74,7 @@ help()
7374
echo " --debug=<true|false>"
7475
echo " --numa=<true|false>"
7576
echo " --modprobe=<true|false>"
77+
echo " --extra=<additional defines, comma separated>"
7678
}
7779

7880

@@ -120,6 +122,11 @@ do
120122
continue
121123
;;
122124

125+
"--extra" )
126+
EXTRA_DEFINES=$VALUE
127+
continue
128+
;;
129+
123130
* )
124131
echo "Unknown parameter $PARAMETER!"
125132
exit -1
@@ -233,6 +240,12 @@ gen_config()
233240
echo "$KMOD_AVAIL" >> $BUILD_PATH/src/config.h
234241
echo "$NUMA_AVAIL" >> $BUILD_PATH/src/config.h
235242
echo "$MODPROBE_MODE" >> $BUILD_PATH/src/config.h
243+
244+
for DEF in ${EXTRA_DEFINES//,/ }
245+
do
246+
echo "#define $DEF" >> $BUILD_PATH/src/config.h
247+
done
248+
236249
echo "#endif /* CONFIG_H */" >> $BUILD_PATH/src/config.h
237250
}
238251

patches/linux_uio/uio_pci_dma.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,18 @@ BIN_ATTR_MAP_CALLBACK( map_sg );
317317
#include <linux/pfn_t.h>
318318
#endif
319319

320+
/**
321+
RH 9.6 includes a kernel with interface changes.
322+
It is still named 5.14.0 (release 570.16.1) but includes backports, and needs the updates desribed below
323+
as for get_user_pages() 6.5.0 and MAX_PAGE_ORDER 6.8.0
324+
RH 9.5 still has the previous interface.
325+
**/
326+
#ifdef RHEL_RELEASE_CODE
327+
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 6)
328+
#define RHEL_RELEASE_9_6
329+
#endif
330+
#endif
331+
320332
/**
321333
* Kernel 4.6 introduced six-argument get_user_pages()
322334
* https://github.com/torvalds/linux/commit/c12d2da56d0e07d230968ee2305aaa86b93a6832
@@ -328,7 +340,7 @@ BIN_ATTR_MAP_CALLBACK( map_sg );
328340
* Kernel 6.5 removes unused vmas parameter from get_user_pages()
329341
* https://github.com/torvalds/linux/commit/54d020692b342f7bd02d7f5795fb5c401caecfcc
330342
**/
331-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
343+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0) || defined(RHEL_RELEASE_9_6)
332344
#define PDA_FOURARG_GUP
333345
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
334346
#define PDA_FIVEARG_GUP
@@ -343,7 +355,7 @@ BIN_ATTR_MAP_CALLBACK( map_sg );
343355
* Kernel 6.8 renames MAX_ORDER to MAX_PAGE_ORDER
344356
* https://github.com/torvalds/linux/commit/5e0a760b44417f7cadd79de2204d6247109558a0
345357
**/
346-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
358+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0) || defined(RHEL_RELEASE_9_6)
347359
#define PDA_MAX_PAGE_ORDER_RENAMED
348360
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
349361
#define PDA_MAX_PAGE_ORDER_INCLUSIVE

0 commit comments

Comments
 (0)