VirtualBox

Changeset 85704 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 11, 2020 7:05:24 PM (4 years ago)
Author:
vboxsync
Message:

Add/linux/vboxvideo: Use RTLNX_VER_* macros (just copied them over into vbox_drv.h).

Location:
trunk/src/VBox/Additions/linux/drm
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.c

    r85649 r85704  
    4141#include <drm/drm_crtc_helper.h>
    4242
    43 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(RHEL_81)
     43#if RTLNX_VER_MIN(5,1,0) || defined(RHEL_81)
    4444#include <drm/drm_probe_helper.h>
    4545#endif
     
    6363static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
    6464{
    65 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
     65#if RTLNX_VER_MAX(4,19,0)
    6666        return drm_get_pci_dev(pdev, ent, &driver);
    6767#else
     
    9999        struct drm_device *dev = pci_get_drvdata(pdev);
    100100
    101 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
     101#if RTLNX_VER_MAX(4,19,0)
    102102        drm_put_dev(dev);
    103103#else
     
    108108}
    109109
    110 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) && !defined(RHEL_74)
     110#if RTLNX_VER_MAX(4,9,0) && !defined(RHEL_74)
    111111static void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
    112112                                        bool suspend)
     
    226226};
    227227
    228 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL_74)
     228#if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74)
    229229/* This works around a bug in X servers prior to 1.18.4, which sometimes
    230230 * submit more dirty rectangles than the kernel is willing to handle and
     
    242242        return rc;
    243243}
    244 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !RHEL_74 */
     244#endif /* RTLNX_VER_MAX(4,7,0) && !RHEL_74 */
    245245
    246246static const struct file_operations vbox_fops = {
     
    248248        .open = drm_open,
    249249        .release = drm_release,
    250 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL_74)
     250#if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74)
    251251        .unlocked_ioctl = vbox_ioctl,
    252252#else
     
    255255        .mmap = vbox_mmap,
    256256        .poll = drm_poll,
    257 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_70)
     257#if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_70)
    258258        .fasync = drm_fasync,
    259259#endif
     
    286286}
    287287
    288 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) && !defined(RHEL_74)
     288#if RTLNX_VER_MAX(4,8,0) && !defined(RHEL_74)
    289289static void vbox_master_drop(struct drm_device *dev,
    290290                             struct drm_file *file_priv, bool from_release)
     
    305305
    306306static struct drm_driver driver = {
    307 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
     307#if RTLNX_VER_MAX(5,4,0)
    308308        .driver_features =
    309309            DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ |
    310 # if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81)
     310# if RTLNX_VER_MAX(5,1,0) && !defined(RHEL_81)
    311311            DRIVER_IRQ_SHARED |
    312 # endif /* < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81) */
     312# endif /* < 5.1.0 && !defined(RHEL_81) */
    313313            DRIVER_PRIME,
    314 #else /* >= KERNEL_VERSION(5, 4, 0) */
     314#else  /* >= 5.4.0 */
    315315        .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ,
    316 #endif /* < KERNEL_VERSION(5, 4, 0) */
     316#endif /* <  5.4.0 */
    317317        .dev_priv_size = 0,
    318318
    319 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
     319#if RTLNX_VER_MAX(4,19,0)
    320320    /* Legacy hooks, but still supported. */
    321321        .load = vbox_driver_load,
     
    325325        .master_set = vbox_master_set,
    326326        .master_drop = vbox_master_drop,
    327 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
    328 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) && !defined(RHEL_75) \
     327#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72)
     328# if RTLNX_VER_MAX(4,14,0) && !defined(RHEL_75) \
    329329  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    330330        .set_busid = drm_pci_set_busid,
     
    341341        .patchlevel = DRIVER_PATCHLEVEL,
    342342
    343 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
     343#if RTLNX_VER_MAX(4,7,0)
    344344        .gem_free_object = vbox_gem_free_object,
    345345#else
     
    348348        .dumb_create = vbox_dumb_create,
    349349        .dumb_map_offset = vbox_dumb_mmap_offset,
    350 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_73)
     350#if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_73)
    351351        .dumb_destroy = vbox_dumb_destroy,
    352352#else
     
    368368static int __init vbox_init(void)
    369369{
    370 #if defined(CONFIG_VGA_CONSOLE) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
     370#if defined(CONFIG_VGA_CONSOLE) || RTLNX_VER_MIN(4,7,0)
    371371        if (vgacon_text_force() && vbox_modeset == -1)
    372372                return -EINVAL;
     
    376376                return -EINVAL;
    377377
    378 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73)
     378#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_73)
    379379        return pci_register_driver(&vbox_pci_driver);
    380380#else
     
    385385static void __exit vbox_exit(void)
    386386{
    387 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73)
     387#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_73)
    388388        pci_unregister_driver(&vbox_pci_driver);
    389389#else
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r85684 r85704  
    4141
    4242#include <linux/version.h>
    43 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
     43
     44/* iprt/linux/version.h copy - start */
     45/** @def RTLNX_VER_MIN
     46 * Evaluates to true if the linux kernel version is equal or higher to the
     47 * one specfied. */
     48#define RTLNX_VER_MIN(a_Major, a_Minor, a_Patch) \
     49    (LINUX_VERSION_CODE >= KERNEL_VERSION(a_Major, a_Minor, a_Patch))
     50
     51/** @def RTLNX_VER_MAX
     52 * Evaluates to true if the linux kernel version is less to the one specfied
     53 * (exclusive). */
     54#define RTLNX_VER_MAX(a_Major, a_Minor, a_Patch) \
     55    (LINUX_VERSION_CODE < KERNEL_VERSION(a_Major, a_Minor, a_Patch))
     56
     57/** @def RTLNX_VER_RANGE
     58 * Evaluates to true if the linux kernel version is equal or higher to the given
     59 * minimum version and less (but not equal) to the maximum version (exclusive). */
     60#define RTLNX_VER_RANGE(a_MajorMin, a_MinorMin, a_PatchMin,  a_MajorMax, a_MinorMax, a_PatchMax) \
     61    (   LINUX_VERSION_CODE >= KERNEL_VERSION(a_MajorMin, a_MinorMin, a_PatchMin) \
     62     && LINUX_VERSION_CODE <  KERNEL_VERSION(a_MajorMax, a_MinorMax, a_PatchMax) )
     63
     64
     65/** @def RTLNX_RHEL_MIN
     66 * Require a minium RedHat release.
     67 * @param a_iMajor      The major release number (RHEL_MAJOR).
     68 * @param a_iMinor      The minor release number (RHEL_MINOR).
     69 * @sa RTLNX_RHEL_MAX, RTLNX_RHEL_RANGE, RTLNX_RHEL_MAJ_PREREQ
     70 */
     71#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
     72# define RTLNX_RHEL_MIN(a_iMajor, a_iMinor) \
     73     ((RHEL_MAJOR) > (a_iMajor) || ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) >= (a_iMinor)))
     74#else
     75# define RTLNX_RHEL_MIN(a_iMajor, a_iMinor) (0)
     76#endif
     77
     78/** @def RTLNX_RHEL_MAX
     79 * Require a maximum RedHat release, true for all RHEL versions below it.
     80 * @param a_iMajor      The major release number (RHEL_MAJOR).
     81 * @param a_iMinor      The minor release number (RHEL_MINOR).
     82 * @sa RTLNX_RHEL_MIN, RTLNX_RHEL_RANGE, RTLNX_RHEL_MAJ_PREREQ
     83 */
     84#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
     85# define RTLNX_RHEL_MAX(a_iMajor, a_iMinor) \
     86     ((RHEL_MAJOR) < (a_iMajor) || ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) < (a_iMinor)))
     87#else
     88# define RTLNX_RHEL_MAX(a_iMajor, a_iMinor) (0)
     89#endif
     90
     91/** @define RTLNX_RHEL_RANGE
     92 * Check that it's a RedHat kernel in the given version range.
     93 * The max version is exclusive, the minimum inclusive.
     94 * @sa RTLNX_RHEL_MIN, RTLNX_RHEL_MAX, RTLNX_RHEL_MAJ_PREREQ
     95 */
     96#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
     97# define RTLNX_RHEL_RANGE(a_iMajorMin, a_iMinorMin,  a_iMajorMax, a_iMinorMax) \
     98     (RTLNX_RHEL_MIN(a_iMajorMin, a_iMinorMin) && RTLNX_RHEL_MAX(a_iMajorMax, a_iMinorMax))
     99#else
     100# define RTLNX_RHEL_RANGE(a_iMajorMin, a_iMinorMin,  a_iMajorMax, a_iMinorMax)  (0)
     101#endif
     102
     103/** @def RTLNX_RHEL_MAJ_PREREQ
     104 * Require a minimum minor release number for the given RedHat release.
     105 * @param a_iMajor      RHEL_MAJOR must _equal_ this.
     106 * @param a_iMinor      RHEL_MINOR must be greater or equal to this.
     107 * @sa RTLNX_RHEL_MIN, RTLNX_RHEL_MAX
     108 */
     109#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
     110# define RTLNX_RHEL_MAJ_PREREQ(a_iMajor, a_iMinor) ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) >= (a_iMinor))
     111#else
     112# define RTLNX_RHEL_MAJ_PREREQ(a_iMajor, a_iMinor) (0)
     113#endif
     114
     115
     116/** @def RTLNX_SUSE_MAJ_PREREQ
     117 * Require a minimum minor release number for the given SUSE release.
     118 * @param a_iMajor      CONFIG_SUSE_VERSION must _equal_ this.
     119 * @param a_iMinor      CONFIG_SUSE_PATCHLEVEL must be greater or equal to this.
     120 */
     121#if defined(CONFIG_SUSE_VERSION) && defined(CONFIG_SUSE_PATCHLEVEL)
     122# define RTLNX_SUSE_MAJ_PREREQ(a_iMajor, a_iMinor) ((CONFIG_SUSE_VERSION) == (a_iMajor) && (CONFIG_SUSE_PATCHLEVEL) >= (a_iMinor))
     123#else
     124# define RTLNX_SUSE_MAJ_PREREQ(a_iMajor, a_iMinor) (0)
     125#endif
     126/* iprt/linux/version.h copy - end */
     127
     128#if RTLNX_VER_MAX(4,5,0)
    44129# include <linux/types.h>
    45130# include <linux/spinlock_types.h>
     
    104189#endif
    105190
    106 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) || defined(RHEL_71)
     191#if RTLNX_VER_MAX(3,14,0) || defined(RHEL_71)
    107192#define U8_MAX          ((u8)~0U)
    108193#define S8_MAX          ((s8)(U8_MAX>>1))
     
    119204#endif
    120205
    121 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
     206#if RTLNX_VER_MAX(5,5,0)
    122207#include <drm/drmP.h>
    123 #else /* >= KERNEL_VERSION(5, 5, 0) */
     208#else /* >= 5.5.0 */
    124209#include <drm/drm_file.h>
    125210#include <drm/drm_drv.h>
     
    129214#include <drm/drm_irq.h>
    130215#include <drm/drm_vblank.h>
    131 #endif /* >= KERNEL_VERSION(5, 5, 0) */
    132 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     216#endif /* >= 5.5.0 */
     217#if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    133218#include <drm/drm_encoder.h>
    134219#endif
    135220#include <drm/drm_fb_helper.h>
    136 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
     221#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72)
    137222#include <drm/drm_gem.h>
    138223#endif
     
    150235#include "product-generated.h"
    151236
    152 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && !defined(RHEL_75)
     237#if RTLNX_VER_MAX(4,12,0) && !defined(RHEL_75)
    153238static inline void drm_gem_object_put_unlocked(struct drm_gem_object *obj)
    154239{
     
    157242#endif
    158243
    159 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && !defined(RHEL_75)
     244#if RTLNX_VER_MAX(4,12,0) && !defined(RHEL_75)
    160245static inline void drm_gem_object_put(struct drm_gem_object *obj)
    161246{
     
    191276#define VBOX_REFRESH_PERIOD (HZ / 2)
    192277
    193 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && !defined(RHEL_72)
     278#if RTLNX_VER_MAX(3,13,0) && !defined(RHEL_72)
    194279static inline void *devm_kcalloc(struct device *dev, size_t n, size_t size,
    195280                                 gfp_t flags)
     
    222307
    223308        struct {
    224 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     309#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    225310                struct drm_global_reference mem_global_ref;
    226311                struct ttm_bo_global_ref bo_global_ref;
     
    266351#undef CURSOR_DATA_SIZE
    267352
    268 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
     353#if RTLNX_VER_MAX(4,19,0)
    269354int vbox_driver_load(struct drm_device *dev, unsigned long flags);
    270355#else
    271356int vbox_driver_load(struct drm_device *dev);
    272357#endif
    273 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     358#if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    274359void vbox_driver_unload(struct drm_device *dev);
    275360#else
     
    333418void vbox_mode_fini(struct drm_device *dev);
    334419
    335 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
     420#if RTLNX_VER_MAX(3,3,0)
    336421#define DRM_MODE_FB_CMD drm_mode_fb_cmd
    337422#else
     
    339424#endif
    340425
    341 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(RHEL_71)
     426#if RTLNX_VER_MAX(3,15,0) && !defined(RHEL_71)
    342427#define CRTC_FB(crtc) ((crtc)->fb)
    343428#else
     
    355440int vbox_framebuffer_init(struct drm_device *dev,
    356441                          struct vbox_framebuffer *vbox_fb,
    357 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_73)
     442#if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73)
    358443                          const struct DRM_MODE_FB_CMD *mode_cmd,
    359444#else
     
    371456        struct ttm_bo_kmap_obj kmap;
    372457        struct drm_gem_object gem;
    373 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_72)
     458#if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72)
    374459        u32 placements[3];
    375460#else
     
    391476                     struct drm_device *dev,
    392477                     struct drm_mode_create_dumb *args);
    393 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_73)
     478#if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_73)
    394479int vbox_dumb_destroy(struct drm_file *file,
    395480                      struct drm_device *dev, u32 handle);
     
    419504        int ret;
    420505
    421 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || defined(RHEL_74)
     506#if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74)
    422507        ret = ttm_bo_reserve(&bo->bo, true, no_wait, NULL);
    423508#else
     
    445530void vbox_gem_prime_unpin(struct drm_gem_object *obj);
    446531struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj);
    447 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_72)
     532#if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72)
    448533struct drm_gem_object *vbox_gem_prime_import_sg_table(
    449534        struct drm_device *dev, size_t size, struct sg_table *table);
  • trunk/src/VBox/Additions/linux/drm/vbox_fb.c

    r85684 r85704  
    5151#include <VBoxVideo.h>
    5252
    53 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL_74)
     53#if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74)
    5454/**
    5555 * Tell the host about dirty rectangles to update.
     
    127127
    128128#ifdef CONFIG_FB_DEFERRED_IO
    129 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL_74)
     129# if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74)
    130130static void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagelist)
    131131{
     
    160160#endif
    161161
    162 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(RHEL_73)
     162#if RTLNX_VER_MAX(4,3,0) && !defined(RHEL_73)
    163163static void drm_fb_helper_sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
    164164{
     
    208208        u32 size;
    209209        struct drm_gem_object *gobj;
    210 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
     210#if RTLNX_VER_MAX(3,3,0)
    211211        u32 pitch = mode_cmd->pitch;
    212212#else
     
    226226}
    227227
    228 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(RHEL_73)
     228#if RTLNX_VER_MAX(4,3,0) && !defined(RHEL_73)
    229229static struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *helper)
    230230{
     
    268268        mode_cmd.height = sizes->surface_height;
    269269        pitch = mode_cmd.width * ((sizes->surface_bpp + 7) / 8);
    270 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
     270#if RTLNX_VER_MAX(3,3,0)
    271271        mode_cmd.bpp = sizes->surface_bpp;
    272272        mode_cmd.depth = sizes->surface_depth;
     
    336336        info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
    337337
    338 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) || defined(RHEL_82)
     338#if RTLNX_VER_MIN(5,2,0) || defined(RHEL_82)
    339339        /*
    340340         * The corresponding 5.2-rc1 Linux DRM kernel changes have been
     
    342342         */
    343343        drm_fb_helper_fill_info(info, &fbdev->helper, sizes);
    344 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || VBOX_RHEL_MAJ_PREREQ(7, 5)
     344#elif RTLNX_VER_MIN(4,11,0) || VBOX_RHEL_MAJ_PREREQ(7, 5)
    345345        drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
    346346#else
    347347        drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
    348348#endif
    349 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && !defined(RHEL_82)
     349#if RTLNX_VER_MAX(5,2,0) && !defined(RHEL_82)
    350350        drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width,
    351351                               sizes->fb_height);
     
    371371};
    372372
    373 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(RHEL_73)
     373#if RTLNX_VER_MAX(4,3,0) && !defined(RHEL_73)
    374374static void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper)
    375375{
     
    411411        drm_fb_helper_fini(&fbdev->helper);
    412412
    413 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
     413#if RTLNX_VER_MIN(3,9,0)
    414414        drm_framebuffer_unregister_private(&afb->base);
    415415#endif
     
    430430        spin_lock_init(&fbdev->dirty_lock);
    431431
    432 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(RHEL_72)
     432#if RTLNX_VER_MAX(3,17,0) && !defined(RHEL_72)
    433433        fbdev->helper.funcs = &vbox_fb_helper_funcs;
    434434#else
    435435        drm_fb_helper_prepare(dev, &fbdev->helper, &vbox_fb_helper_funcs);
    436436#endif
    437 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)
     437#if RTLNX_VER_MIN(5,7,0)
    438438        ret = drm_fb_helper_init(dev, &fbdev->helper);
    439 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     439#elif RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    440440        ret = drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs);
    441 #else /* KERNEL_VERSION < 4.11.0 */
     441#else /* < 4.11.0 */
    442442        ret =
    443443            drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs,
     
    447447                return ret;
    448448
    449 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0)
     449#if RTLNX_VER_MAX(5,7,0)
    450450        ret = drm_fb_helper_single_add_all_connectors(&fbdev->helper);
    451451        if (ret)
  • trunk/src/VBox/Additions/linux/drm/vbox_hgsmi.c

    r82968 r85704  
    6969}
    7070
    71 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
     71#if RTLNX_VER_MAX(3,13,0)
    7272void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, dma_addr_t *dma)
    7373{
  • trunk/src/VBox/Additions/linux/drm/vbox_irq.c

    r82968 r85704  
    3434#include "vbox_drv.h"
    3535
    36 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
     36#if RTLNX_VER_MAX(5,1,0)
    3737#include <drm/drm_crtc_helper.h>
    3838# if defined(RHEL_81)
     
    152152
    153153        validate_or_set_position_hints(vbox);
    154 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
     154#if RTLNX_VER_MIN(3,9,0)
    155155        drm_modeset_lock_all(dev);
    156156#else
     
    186186                vbox_conn->vbox_crtc->disconnected = disconnected;
    187187        }
    188 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
     188#if RTLNX_VER_MIN(3,9,0)
    189189        drm_modeset_unlock_all(dev);
    190190#else
     
    206206        INIT_WORK(&vbox->hotplug_work, vbox_hotplug_worker);
    207207        vbox_update_mode_hints(vbox);
    208 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) || defined(RHEL_71)
     208#if RTLNX_VER_MIN(3,16,0) || defined(RHEL_71)
    209209        return drm_irq_install(vbox->dev, vbox->dev->pdev->irq);
    210210#else
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r85649 r85704  
    164164int vbox_framebuffer_init(struct drm_device *dev,
    165165                          struct vbox_framebuffer *vbox_fb,
    166 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_73)
     166#if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73)
    167167                          const struct DRM_MODE_FB_CMD *mode_cmd,
    168168#else
     
    173173        int ret;
    174174
    175 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     175#if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    176176        drm_helper_mode_fill_fb_struct(dev, &vbox_fb->base, mode_cmd);
    177177#else
     
    191191                struct drm_device *dev,
    192192                struct drm_file *filp,
    193 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_73)
     193#if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73)
    194194                const struct drm_mode_fb_cmd2 *mode_cmd)
    195195#else
     
    201201        int ret = -ENOMEM;
    202202
    203 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || defined(RHEL_74)
     203#if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74)
    204204        obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]);
    205205#else
     
    230230};
    231231
    232 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) && !defined(RHEL_73)
     232#if RTLNX_VER_MAX(4,0,0) && !defined(RHEL_73)
    233233#define pci_iomap_range(dev, bar, offset, maxlen) \
    234234        ioremap(pci_resource_start(dev, bar) + (offset), maxlen)
     
    448448}
    449449
    450 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
     450#if RTLNX_VER_MAX(4,19,0)
    451451int vbox_driver_load(struct drm_device *dev, unsigned long flags)
    452452#else
     
    512512}
    513513
    514 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     514#if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    515515void vbox_driver_unload(struct drm_device *dev)
    516516#else
     
    526526        vbox_mm_fini(vbox);
    527527        vbox_hw_fini(vbox);
    528 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) && !defined(RHEL_75)
     528#if RTLNX_VER_MAX(4,11,0) && !defined(RHEL_75)
    529529        return 0;
    530530#endif
     
    539539        struct vbox_private *vbox = dev->dev_private;
    540540
    541 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) || defined(RHEL_71)
     541#if RTLNX_VER_MIN(3,16,0) || defined(RHEL_71)
    542542        if (vbox->fbdev)
    543543                drm_fb_helper_restore_fbdev_mode_unlocked(&vbox->fbdev->helper);
     
    598598}
    599599
    600 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_73)
     600#if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_73)
    601601int vbox_dumb_destroy(struct drm_file *file,
    602602                      struct drm_device *dev, u32 handle)
     
    606606#endif
    607607
    608 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) \
     608#if RTLNX_VER_MAX(4,19,0) && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) \
    609609  && !defined(RHEL_77) && !defined(RHEL_81)
    610610static void ttm_bo_put(struct ttm_buffer_object *bo)
     
    623623static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo)
    624624{
    625 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
     625#if RTLNX_VER_MIN(5,4,0)
    626626        return drm_vma_node_offset_addr(&bo->bo.base.vma_node);
    627 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_70)
     627#elif RTLNX_VER_MAX(3,12,0) && !defined(RHEL_70)
    628628        return bo->bo.addr_space_offset;
    629629#else
    630630        return drm_vma_node_offset_addr(&bo->bo.vma_node);
    631 #endif /* >= KERNEL_VERSION(5, 4, 0) */
     631#endif /* >= 5.4.0 */
    632632}
    633633
     
    642642
    643643        mutex_lock(&dev->struct_mutex);
    644 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || defined(RHEL_74)
     644#if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74)
    645645        obj = drm_gem_object_lookup(file, handle);
    646646#else
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r85649 r85704  
    4040#include <linux/export.h>
    4141#include <drm/drm_crtc_helper.h>
    42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
     42#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72)
    4343#include <drm/drm_plane_helper.h>
    4444#endif
    45 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(RHEL_81)
     45#if RTLNX_VER_MIN(5,1,0) || defined(RHEL_81)
    4646#include <drm/drm_probe_helper.h>
    4747#endif
     
    7070        width = mode->hdisplay ? mode->hdisplay : 640;
    7171        height = mode->vdisplay ? mode->vdisplay : 480;
    72 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     72#if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    7373        bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32;
    7474        pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;
    75 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
     75#elif RTLNX_VER_MIN(3,3,0)
    7676        bpp = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32;
    7777        pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;
     
    9494                VBoxVideoSetModeRegisters(
    9595                        width, height, pitch * 8 / bpp,
    96 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     96#if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75)
    9797                        CRTC_FB(crtc)->format->cpp[0] * 8,
    9898#else
     
    285285static int vbox_crtc_page_flip(struct drm_crtc *crtc,
    286286                               struct drm_framebuffer *fb,
    287 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL_75)
     287#if RTLNX_VER_MIN(4,12,0) || defined(RHEL_75)
    288288                               struct drm_pending_vblank_event *event,
    289289                               uint32_t page_flip_flags,
    290290                               struct drm_modeset_acquire_ctx *ctx)
    291 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) || defined(RHEL_70)
     291#elif RTLNX_VER_MIN(3,12,0) || defined(RHEL_70)
    292292                               struct drm_pending_vblank_event *event,
    293293                               uint32_t page_flip_flags)
     
    311311
    312312        if (event)
    313 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) || defined(RHEL_72)
     313#if RTLNX_VER_MIN(3,19,0) || defined(RHEL_72)
    314314                drm_crtc_send_vblank_event(crtc, event);
    315315#else
     
    386386}
    387387
    388 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && !defined(RHEL_71)
     388#if RTLNX_VER_MAX(3,13,0) && !defined(RHEL_71)
    389389static struct drm_encoder *drm_encoder_find(struct drm_device *dev, u32 id)
    390390{
     
    399399                                                    *connector)
    400400{
    401 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
     401#if RTLNX_VER_MIN(5,5,0)
    402402        struct drm_encoder *encoder;
    403403
     
    405405        drm_connector_for_each_possible_encoder(connector, encoder)
    406406            return encoder;
    407 #else /* KERNEL_VERSION < 5.5 */
     407#else /* < 5.5 */
    408408        int enc_id = connector->encoder_ids[0];
    409409
    410410        /* pick the encoder ids */
    411411        if (enc_id)
    412 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) || \
     412# if RTLNX_VER_MIN(4,15,0) || \
    413413     (defined(CONFIG_SUSE_VERSION) && \
    414          LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
     414         RTLNX_VER_MIN(4,12,0)) || \
    415415     defined(RHEL_76)
    416416                return drm_encoder_find(connector->dev, NULL, enc_id);
     
    418418                return drm_encoder_find(connector->dev, enc_id);
    419419# endif
    420 #endif /* KERNEL_VERSION < 5.5 */
     420#endif /* < 5.5 */
    421421        return NULL;
    422422}
     
    469469
    470470        drm_encoder_init(dev, &vbox_encoder->base, &vbox_enc_funcs,
    471 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_73)
     471#if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73)
    472472                         DRM_MODE_ENCODER_DAC, NULL);
    473473#else
     
    548548                sum += edid[i];
    549549        edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF;
    550 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \
     550#if RTLNX_VER_MIN(4,19,0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \
    551551  || defined(RHEL_77) || defined(RHEL_81)
    552552        drm_connector_update_edid_property(connector, (struct edid *)edid);
     
    607607        vbox_set_edid(connector, preferred_width, preferred_height);
    608608
    609 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) || defined(RHEL_72)
     609#if RTLNX_VER_MIN(3,19,0) || defined(RHEL_72)
    610610        if (vbox_connector->vbox_crtc->x_hint != -1)
    611611                drm_object_property_set_value(&connector->base,
     
    628628}
    629629
    630 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL_71)
     630#if RTLNX_VER_MAX(3,14,0) && !defined(RHEL_71)
    631631static int vbox_mode_valid(struct drm_connector *connector,
    632632#else
     
    640640static void vbox_connector_destroy(struct drm_connector *connector)
    641641{
    642 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(RHEL_72)
     642#if RTLNX_VER_MAX(3,17,0) && !defined(RHEL_72)
    643643        drm_sysfs_connector_remove(connector);
    644644#else
     
    711711        connector->doublescan_allowed = 0;
    712712
    713 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) || defined(RHEL_72)
     713#if RTLNX_VER_MIN(3,19,0) || defined(RHEL_72)
    714714        drm_mode_create_suggested_offset_properties(dev);
    715715        drm_object_attach_property(&connector->base,
     
    718718                                   dev->mode_config.suggested_y_property, 0);
    719719#endif
    720 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(RHEL_72)
     720#if RTLNX_VER_MAX(3,17,0) && !defined(RHEL_72)
    721721        drm_sysfs_connector_add(connector);
    722722#else
     
    724724#endif
    725725
    726 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \
     726#if RTLNX_VER_MIN(4,19,0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \
    727727  || defined(RHEL_77) || defined(RHEL_81)
    728728        drm_connector_attach_encoder(connector, encoder);
     
    833833        }
    834834
    835 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || defined(RHEL_74)
     835#if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74)
    836836        obj = drm_gem_object_lookup(file_priv, handle);
    837837#else
  • trunk/src/VBox/Additions/linux/drm/vbox_prime.c

    r82968 r85704  
    5050}
    5151
    52 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_72)
     52#if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72)
    5353struct drm_gem_object *vbox_gem_prime_import_sg_table(
    5454        struct drm_device *dev, size_t size, struct sg_table *table)
  • trunk/src/VBox/Additions/linux/drm/vbox_ttm.c

    r85649 r85704  
    3636#include <drm/ttm/ttm_page_alloc.h>
    3737
    38 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_72)
     38#if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72)
    3939#define PLACEMENT_FLAGS(placement) (placement)
    4040#else
     
    4747}
    4848
    49 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     49#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    5050static int vbox_ttm_mem_global_init(struct drm_global_reference *ref)
    5151{
     
    6666        int ret;
    6767
    68 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
     68#if RTLNX_VER_MAX(5,0,0)
    6969        global_ref = &vbox->ttm.mem_global_ref;
    7070        global_ref->global_type = DRM_GLOBAL_TTM_MEM;
     
    8989        if (ret) {
    9090                DRM_ERROR("Failed setting up TTM BO subsystem.\n");
    91 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
     91#if RTLNX_VER_MAX(5,0,0)
    9292                drm_global_item_unref(&vbox->ttm.mem_global_ref);
    9393#endif
     
    211211};
    212212
    213 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) && !defined(RHEL_76) \
     213#if (RTLNX_VER_MAX(4,17,0)) && !defined(RHEL_76) \
    214214  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    215215static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
     
    229229
    230230        tt->func = &vbox_tt_backend_func;
    231 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) && !defined(RHEL_76) \
     231#if (RTLNX_VER_MAX(4,17,0)) && !defined(RHEL_76) \
    232232  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    233233        if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
     
    242242}
    243243
    244 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
    245 # if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
     244#if RTLNX_VER_MAX(4,17,0)
     245# if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \
    246246  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    247247static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
     
    265265static struct ttm_bo_driver vbox_bo_driver = {
    266266        .ttm_tt_create = vbox_ttm_tt_create,
    267 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
     267#if RTLNX_VER_MAX(4,17,0)
    268268        .ttm_tt_populate = vbox_ttm_tt_populate,
    269269        .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,
    270270#endif
    271271        .init_mem_type = vbox_bo_init_mem_type,
    272 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) || defined(RHEL_74)
     272#if RTLNX_VER_MIN(4,10,0) || defined(RHEL_74)
    273273        .eviction_valuable = ttm_bo_eviction_valuable,
    274274#endif
     
    277277        .io_mem_reserve = &vbox_ttm_io_mem_reserve,
    278278        .io_mem_free = &vbox_ttm_io_mem_free,
    279 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL_75)
    280 # if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
     279#if RTLNX_VER_MIN(4,12,0) || defined(RHEL_75)
     280# if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \
    281281  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    282282        .io_mem_pfn = ttm_bo_default_io_mem_pfn,
    283283# endif
    284284#endif
    285 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) \
    286     || defined(RHEL_74)
    287 # ifndef RHEL_75
     285#if (RTLNX_VER_RANGE(4,7,0,  4,11,0) || defined(RHEL_74)) && !defined(RHEL_75)
    288286        .lru_tail = &ttm_bo_default_lru_tail,
    289287        .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
    290 # endif
    291288#endif
    292289};
     
    298295        struct ttm_bo_device *bdev = &vbox->ttm.bdev;
    299296
    300 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     297#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    301298        ret = vbox_ttm_global_init(vbox);
    302299        if (ret)
     
    304301#endif
    305302        ret = ttm_bo_device_init(&vbox->ttm.bdev,
    306 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     303#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    307304                                 vbox->ttm.bo_global_ref.ref.object,
    308305#endif
    309306                                 &vbox_bo_driver,
    310 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL_71)
     307#if RTLNX_VER_MIN(3,15,0) || defined(RHEL_71)
    311308                                 dev->anon_inode->i_mapping,
    312309#endif
    313 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
     310#if RTLNX_VER_MIN(5,5,0)
    314311                                 dev->vma_offset_manager,
    315 #elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && !defined(RHEL_82)
     312#elif RTLNX_VER_MAX(5,2,0) && !defined(RHEL_82)
    316313                                 DRM_FILE_PAGE_OFFSET,
    317314#endif
     
    319316        if (ret) {
    320317                DRM_ERROR("Error initialising bo driver; %d\n", ret);
    321 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     318#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    322319                goto err_ttm_global_release;
    323320#else
     
    345342err_device_release:
    346343        ttm_bo_device_release(&vbox->ttm.bdev);
    347 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     344#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    348345err_ttm_global_release:
    349346        vbox_ttm_global_release(vbox);
     
    362359#endif
    363360        ttm_bo_device_release(&vbox->ttm.bdev);
    364 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81)
     361#if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81)
    365362        vbox_ttm_global_release(vbox);
    366363#endif
     
    370367{
    371368        u32 c = 0;
    372 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_72)
     369#if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72)
    373370        bo->placement.fpfn = 0;
    374371        bo->placement.lpfn = 0;
     
    393390        bo->placement.num_busy_placement = c;
    394391
    395 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
     392#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72)
    396393        for (i = 0; i < c; ++i) {
    397394                bo->placements[i].fpfn = 0;
     
    418415
    419416        vboxbo->bo.bdev = &vbox->ttm.bdev;
    420 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(RHEL_71)
     417#if RTLNX_VER_MAX(3,15,0) && !defined(RHEL_71)
    421418        vboxbo->bo.bdev->dev_mapping = dev->dev_mapping;
    422419#endif
     
    429426        ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size,
    430427                          ttm_bo_type_device, &vboxbo->placement,
    431 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && !defined(RHEL_76) \
     428#if RTLNX_VER_MAX(4,17,0) && !defined(RHEL_76) \
    432429  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    433430                          align >> PAGE_SHIFT, false, NULL, acc_size,
     
    435432                          align >> PAGE_SHIFT, false, acc_size,
    436433#endif
    437 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
     434#if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72)
    438435                          NULL, NULL, vbox_bo_ttm_destroy);
    439436#else
     
    459456int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
    460457{
    461 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76) \
     458#if (RTLNX_VER_MIN(4,16,0)) || defined(RHEL_76) \
    462459  || defined(OPENSUSE_151) || defined(OPENSUSE_125)
    463460        struct ttm_operation_ctx ctx = { false, false };
     
    478475                PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
    479476
    480 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
     477#if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \
    481478  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    482479        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
     
    497494int vbox_bo_unpin(struct vbox_bo *bo)
    498495{
    499 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76) \
     496#if (RTLNX_VER_MIN(4,16,0)) || defined(RHEL_76) \
    500497  || defined(OPENSUSE_151) || defined(OPENSUSE_125)
    501498        struct ttm_operation_ctx ctx = { false, false };
     
    514511                PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT;
    515512
    516 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
     513#if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \
    517514  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    518515        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
     
    533530int vbox_bo_push_sysram(struct vbox_bo *bo)
    534531{
    535 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76) \
     532#if (RTLNX_VER_MIN(4,16,0)) || defined(RHEL_76) \
    536533  || defined(OPENSUSE_151) || defined(OPENSUSE_125)
    537534        struct ttm_operation_ctx ctx = { false, false };
     
    555552                PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
    556553
    557 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
     554#if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \
    558555  && !defined(OPENSUSE_151) && !defined(OPENSUSE_125)
    559556        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette