[vbox-dev] Fixes for kernel v5.5

Larry Finger Larry.Finger at lwfinger.net
Tue Dec 24 01:36:22 UTC 2019


On 12/23/19 9:08 AM, Frank Batschulat wrote:
> There are more changes required than this. I am working on it.

I do not know how you are doing, but these patches complete the build of 
vboxvideo under 5.5:

Index: VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_drv.c
===================================================================
--- VirtualBox-6.0.14.orig/src/VBox/Additions/linux/drm/vbox_drv.c
+++ VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_drv.c
@@ -35,8 +35,18 @@
  #include <linux/module.h>
  #include <linux/console.h>
  #include <linux/vt_kern.h>
+#include <linux/version.h>

+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0))
+#include <drm/drm_file.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_device.h>
+#include <linux/pci.h>
+#include <drm/drm_ioctl.h>
+#include <drm/drm_pci.h>
+#else
  #include <drm/drmP.h>
+#endif
  #include <drm/drm_crtc_helper.h>

  #include "vbox_drv.h"
Index: VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_drv.h
===================================================================
--- VirtualBox-6.0.14.orig/src/VBox/Additions/linux/drm/vbox_drv.h
+++ VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_drv.h
@@ -103,7 +103,13 @@
  #define S64_MIN         ((s64)(-S64_MAX - 1))
  #endif

+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0))
+#include <drm/drm_file.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_device.h>
+#else
  #include <drm/drmP.h>
+#endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
  #include <drm/drm_encoder.h>
  #endif
Index: VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_fb.c
===================================================================
--- VirtualBox-6.0.14.orig/src/VBox/Additions/linux/drm/vbox_fb.c
+++ VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_fb.c
@@ -42,7 +42,19 @@
  #include <linux/fb.h>
  #include <linux/init.h>

+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0))
+#include <drm/drm_file.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_device.h>
+#include <linux/pci.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_pci.h>
+#include <drm/drm_ioctl.h>
+#define drm_compat_ioctl NULL
+#else
  #include <drm/drmP.h>
+#endif
  #include <drm/drm_crtc.h>
  #include <drm/drm_fb_helper.h>
  #include <drm/drm_crtc_helper.h>
Index: VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_mode.c
===================================================================
--- VirtualBox-6.0.14.orig/src/VBox/Additions/linux/drm/vbox_mode.c
+++ VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_mode.c
@@ -45,6 +45,9 @@
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(RHEL_81)
  #include <drm/drm_probe_helper.h>
  #endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
+#include <drm/drm_fourcc.h>
+#endif

  #include "VBoxVideo.h"

@@ -356,6 +359,13 @@ static struct drm_encoder *drm_encoder_f
  static struct drm_encoder *vbox_best_single_encoder(struct drm_connector
                                                     *connector)
  {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
+       struct drm_encoder *encoder;
+
+       /* There is only one encoder per connector */
+       drm_connector_for_each_possible_encoder(connector, encoder)
+               return encoder;
+#else
         int enc_id = connector->encoder_ids[0];

         /* pick the encoder ids */
@@ -368,6 +378,7 @@ static struct drm_encoder *vbox_best_sin
  #else
                 return drm_encoder_find(connector->dev, enc_id);
  #endif
+#endif

         return NULL;
  }
Index: VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_ttm.c
===================================================================
--- VirtualBox-6.0.14.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
+++ VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_ttm.c
@@ -34,6 +34,10 @@
   */
  #include "vbox_drv.h"
  #include <ttm/ttm_page_alloc.h>
+#include <linux/pci.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
+#include <drm/drm_fourcc.h>
+#endif

  #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(RHEL_72)
  #define PLACEMENT_FLAGS(placement) (placement)
@@ -310,11 +314,12 @@ int vbox_mm_init(struct vbox_private *vb
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL_71)
                                  dev->anon_inode->i_mapping,
  #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
-                                DRM_FILE_PAGE_OFFSET, true);
-#else
-                                true);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
+                                NULL,
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
+                                DRM_FILE_PAGE_OFFSET,
  #endif
+                                true);
         if (ret) {
                 DRM_ERROR("Error initialising bo driver; %d\n", ret);
  #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && 
!defined(RHEL_81)
Index: VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_irq.c
===================================================================
--- VirtualBox-6.0.14.orig/src/VBox/Additions/linux/drm/vbox_irq.c
+++ VirtualBox-6.0.14/src/VBox/Additions/linux/drm/vbox_irq.c
@@ -42,6 +42,10 @@
  #include <drm/drm_probe_helper.h>
  #endif
  #include <VBoxVideo.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
+#include <drm/drm_irq.h>
+#include <linux/pci.h>
+#endif

  static void vbox_clear_irq(void)
  {


Larry




More information about the vbox-dev mailing list