Index: /trunk/src/VBox/Additions/linux/drm/vbox_drv.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_drv.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_drv.c	(revision 68297)
@@ -205,5 +205,5 @@
 	.mmap = vbox_mmap,
 	.poll = drm_poll,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_7)
 	.fasync = drm_fasync,
 #endif
@@ -272,5 +272,5 @@
 	.master_set = vbox_master_set,
 	.master_drop = vbox_master_drop,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_7)
 	.set_busid = drm_pci_set_busid,
 #endif
@@ -288,5 +288,5 @@
 	.dumb_create = vbox_dumb_create,
 	.dumb_map_offset = vbox_dumb_mmap_offset,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_7)
 	.dumb_destroy = vbox_dumb_destroy,
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_drv.h
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_drv.h	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_drv.h	(revision 68297)
@@ -49,5 +49,11 @@
 #include <drm/ttm/ttm_module.h>
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
+# if RHEL_MAJOR == 7 && RHEL_MINOR >= 3
+#  define RHEL_7
+# endif
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_7)
 #include <drm/drm_gem.h>
 #endif
@@ -207,5 +213,5 @@
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(RHEL_7)
 #define CRTC_FB(crtc) ((crtc)->fb)
 #else
@@ -223,5 +229,5 @@
 int vbox_framebuffer_init(struct drm_device *dev,
 			  struct vbox_framebuffer *vbox_fb,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_7)
 			  const
 #endif
@@ -239,5 +245,5 @@
 	struct ttm_bo_kmap_obj kmap;
 	struct drm_gem_object gem;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_7)
 	u32 placements[3];
 #else
@@ -259,5 +265,5 @@
 		     struct drm_device *dev,
 		     struct drm_mode_create_dumb *args);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_7)
 int vbox_dumb_destroy(struct drm_file *file,
 		      struct drm_device *dev, u32 handle);
@@ -314,5 +320,5 @@
 struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj);
 struct drm_gem_object *vbox_gem_prime_import_sg_table(struct drm_device *dev,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_7)
 						      size_t size,
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_fb.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_fb.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_fb.c	(revision 68297)
@@ -409,5 +409,5 @@
 	spin_lock_init(&fbdev->dirty_lock);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(RHEL_7)
 	fbdev->helper.funcs = &vbox_fb_helper_funcs;
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_irq.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_irq.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_irq.c	(revision 68297)
@@ -200,5 +200,5 @@
 
 	vbox_update_mode_hints(vbox);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) || defined(RHEL_7)
 	ret = drm_irq_install(vbox->dev, vbox->dev->pdev->irq);
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_main.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_main.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_main.c	(revision 68297)
@@ -165,5 +165,5 @@
 int vbox_framebuffer_init(struct drm_device *dev,
 			  struct vbox_framebuffer *vbox_fb,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_7)
 			  const
 #endif
@@ -191,5 +191,5 @@
 		struct drm_device *dev,
 		struct drm_file *filp,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_7)
 		const struct drm_mode_fb_cmd2 *mode_cmd)
 #else
@@ -242,5 +242,5 @@
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) && !defined(RHEL_7)
 #define pci_iomap_range(dev, bar, offset, maxlen) \
 	ioremap(pci_resource_start(dev, bar) + (offset), maxlen)
@@ -440,5 +440,5 @@
 	struct vbox_private *vbox = dev->dev_private;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) || defined(RHEL_7)
 	if (vbox->fbdev)
 		drm_fb_helper_restore_fbdev_mode_unlocked(&vbox->fbdev->helper);
@@ -499,5 +499,5 @@
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_7)
 int vbox_dumb_destroy(struct drm_file *file,
 		      struct drm_device *dev, u32 handle)
@@ -529,5 +529,5 @@
 static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(RHEL_7)
 	return bo->bo.addr_space_offset;
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_mode.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_mode.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_mode.c	(revision 68297)
@@ -43,5 +43,5 @@
 #include <linux/export.h>
 #include <drm/drm_crtc_helper.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) && defined(RHEL_7)
 #include <drm/drm_plane_helper.h>
 #endif
@@ -396,5 +396,5 @@
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && !defined(RHEL_7)
 static struct drm_encoder *drm_encoder_find(struct drm_device *dev, u32 id)
 {
@@ -466,5 +466,5 @@
 	drm_encoder_init(dev, &vbox_encoder->base, &vbox_enc_funcs,
 			 DRM_MODE_ENCODER_DAC
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || defined(RHEL_7)
 			 , NULL
 #endif
@@ -593,5 +593,5 @@
 	}
 	vbox_set_edid(connector, preferred_width, preferred_height);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) || defined(RHEL_7)
 	drm_object_property_set_value(
 		&connector->base, vbox->dev->mode_config.suggested_x_property,
@@ -616,5 +616,5 @@
 
 	vbox_connector = to_vbox_connector(connector);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(RHEL_7)
 	drm_sysfs_connector_remove(connector);
 #else
@@ -688,5 +688,5 @@
 	connector->doublescan_allowed = 0;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) || defined(RHEL_7)
 	drm_mode_create_suggested_offset_properties(dev);
 	drm_object_attach_property(&connector->base,
@@ -695,5 +695,5 @@
 				   dev->mode_config.suggested_y_property, -1);
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(RHEL_7)
 	drm_sysfs_connector_add(connector);
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_prime.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_prime.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_prime.c	(revision 68297)
@@ -50,5 +50,5 @@
 
 struct drm_gem_object *vbox_gem_prime_import_sg_table(struct drm_device *dev,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_7)
 						      size_t size,
 #else
Index: /trunk/src/VBox/Additions/linux/drm/vbox_ttm.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_ttm.c	(revision 68296)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_ttm.c	(revision 68297)
@@ -36,5 +36,5 @@
 #include <ttm/ttm_page_alloc.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_7)
 #define PLACEMENT_FLAGS(placement) (placement)
 #else
@@ -290,5 +290,5 @@
 				 vbox->ttm.bo_global_ref.ref.object,
 				 &vbox_bo_driver,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL_7)
 				 dev->anon_inode->i_mapping,
 #endif
@@ -342,5 +342,5 @@
 {
 	u32 c = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_7)
 	bo->placement.fpfn = 0;
 	bo->placement.lpfn = 0;
@@ -364,5 +364,5 @@
 	bo->placement.num_placement = c;
 	bo->placement.num_busy_placement = c;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_7)
 	for (i = 0; i < c; ++i) {
 		bo->placements[i].fpfn = 0;
@@ -391,5 +391,5 @@
 
 	vboxbo->bo.bdev = &vbox->ttm.bdev;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(RHEL_7)
 	vboxbo->bo.bdev->dev_mapping = dev->dev_mapping;
 #endif
@@ -403,5 +403,5 @@
 			  ttm_bo_type_device, &vboxbo->placement,
 			  align >> PAGE_SHIFT, false, NULL, acc_size,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_7)
 			  NULL,
 #endif
