Skip to content

Commit

Permalink
Modified subdev files to support RHEL/AlmaLinux 9.5 (#8610)
Browse files Browse the repository at this point in the history
Signed-off-by: Manoj Takasi <[email protected]>
Co-authored-by: Manoj Takasi <[email protected]>
  • Loading branch information
ManojTakasi and Manoj Takasi authored Nov 20, 2024
1 parent d77c362 commit e9fe46b
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/CMake/config/prerm.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
# configuration of the components and hence we want to handle the configuration
# in postinst script.

awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^rhel|^centos"
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^(rhel|centos|almalinux)"
if [ $? -eq 0 ] && [ $1 -ge 1 ]; then
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS"
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS/AlmaLinux"
exit 0
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ static int bridge_mmap(struct file *file, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ static int accel_deadlock_detector_mmap(struct file *filp, struct vm_area_struct

// prevent touching the pages (byte access) for swap-in, and prevent the pages from being swapped out
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/aim.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ static int aim_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/am.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,13 @@ static int am_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,13 @@ static int asm_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/lapc.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ static int lapc_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static irqreturn_t msix_xdma_isr(int irq, void *arg)
ret = irq_entry->handler(irq, irq_entry->arg);

if (!IS_ERR_OR_NULL(irq_entry->event_ctx)) {
#if KERNEL_VERSION(6, 8, 0) <= LINUX_VERSION_CODE
#if KERNEL_VERSION(6, 8, 0) <= LINUX_VERSION_CODE || defined(RHEL_9_5_GE)
eventfd_signal(irq_entry->event_ctx);
#else
eventfd_signal(irq_entry->event_ctx, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/spc.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ static int spc_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ static int trace_fifo_lite_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ static int trace_funnel_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ static int trace_s2mm_mmap(struct file *filp, struct vm_area_struct *vma)
* and prevent the pages from being swapped out
*/
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime_src/core/pcie/driver/linux/xocl/subdev/xdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static irqreturn_t xdma_isr(int irq, void *arg)
ret = irq_entry->handler(irq, irq_entry->arg);

if (!IS_ERR_OR_NULL(irq_entry->event_ctx)) {
#if KERNEL_VERSION(6, 8, 0) <= LINUX_VERSION_CODE
#if KERNEL_VERSION(6, 8, 0) <= LINUX_VERSION_CODE || defined(RHEL_9_5_GE)
eventfd_signal(irq_entry->event_ctx);
#else
eventfd_signal(irq_entry->event_ctx, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ int xocl_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)

vma->vm_private_data = obj;

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_MIXEDMAP;
#else
vm_flags_set(vma, VM_MIXEDMAP);
Expand Down
6 changes: 3 additions & 3 deletions src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int xocl_bo_mmap(struct file *filp, struct vm_area_struct *vma)
return -EINVAL;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
/* Clear VM_PFNMAP flag set by drm_gem_mmap()
* we have "struct page" for all backing pages for bo
*/
Expand Down Expand Up @@ -157,7 +157,7 @@ static int xocl_native_mmap(struct file *filp, struct vm_area_struct *vma)

vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && !defined(RHEL_9_5_GE)
vma->vm_flags |= VM_IO;
vma->vm_flags |= VM_RESERVED;
#else
Expand Down Expand Up @@ -407,7 +407,7 @@ static uint xocl_poll(struct file *filp, poll_table *wait)
return xocl_poll_client(filp, wait, priv->driver_priv);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0) || defined(RHEL_9_5_GE)
/* This was removed in 6.8 */
#define DRM_UNLOCKED 0
#endif
Expand Down
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, 5)
#define RHEL_9_5_GE
#endif
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4)
#define RHEL_9_4_GE
#endif
Expand Down

0 comments on commit e9fe46b

Please sign in to comment.