From 3d213d7ef99bf1ff0a1b38faa6b0fbf41d23dc2f58355ddb00aca64101b9c362 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Thu, 22 Mar 2018 19:33:56 +0000 Subject: [PATCH] - Further updates for Leap 15 kernel API changes. OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=414 --- fixes_for_leap15.patch | 136 ++++------------------------------------- virtualbox.changes | 5 ++ 2 files changed, 16 insertions(+), 125 deletions(-) diff --git a/fixes_for_leap15.patch b/fixes_for_leap15.patch index 3d00248..36b74de 100644 --- a/fixes_for_leap15.patch +++ b/fixes_for_leap15.patch @@ -26,133 +26,19 @@ Index: VirtualBox-5.2.8/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0) # define VBOX_HAVE_SKB_VLAN #else -Index: VirtualBox-5.2.8/src/VBox/Additions/linux/drm/vbox_ttm.c +Index: VirtualBox-5.2.8/src/VBox/Additions/linux/drm/vbox_mode.c =================================================================== ---- VirtualBox-5.2.8.orig/src/VBox/Additions/linux/drm/vbox_ttm.c -+++ VirtualBox-5.2.8/src/VBox/Additions/linux/drm/vbox_ttm.c -@@ -198,19 +198,13 @@ static void vbox_ttm_io_mem_free(struct - { - } +--- VirtualBox-5.2.8.orig/src/VBox/Additions/linux/drm/vbox_mode.c ++++ VirtualBox-5.2.8/src/VBox/Additions/linux/drm/vbox_mode.c +@@ -401,11 +401,7 @@ static struct drm_encoder *vbox_best_sin --static int vbox_bo_move(struct ttm_buffer_object *bo, -- bool evict, bool interruptible, -- bool no_wait_gpu, struct ttm_mem_reg *new_mem) -+static int vbox_bo_move(struct ttm_buffer_object *bo, bool evict, -+ struct ttm_operation_ctx *ctx, -+ struct ttm_mem_reg *new_mem) - { - int r; - --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) && !defined(RHEL_74) -- r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem); --#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) && !defined(RHEL_74) -- r = ttm_bo_move_memcpy(bo, evict, interruptible, no_wait_gpu, new_mem); + /* pick the encoder ids */ + if (enc_id) +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + return drm_encoder_find(connector->dev, NULL, enc_id); -#else -- r = ttm_bo_move_memcpy(bo, interruptible, no_wait_gpu, new_mem); +- return drm_encoder_find(connector->dev, enc_id); -#endif -+ r = ttm_bo_move_memcpy(bo, ctx, new_mem); - return r; + + return NULL; } - -@@ -244,9 +238,9 @@ static struct ttm_tt *vbox_ttm_tt_create - return tt; - } - --static int vbox_ttm_tt_populate(struct ttm_tt *ttm) -+static int vbox_ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) - { -- return ttm_pool_populate(ttm); -+ return ttm_pool_populate(ttm, ctx); - } - - static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm) -@@ -254,6 +248,29 @@ static void vbox_ttm_tt_unpopulate(struc - ttm_pool_unpopulate(ttm); - } - -+static struct drm_mm_node *vbox_find_mm_node(struct ttm_mem_reg *mem, -+ unsigned long *offset) -+{ -+ struct drm_mm_node *mm_node = mem->mm_node; -+ -+ while (*offset >= (mm_node->size << PAGE_SHIFT)) { -+ *offset -= (mm_node->size << PAGE_SHIFT); -+ ++mm_node; -+ } -+ return mm_node; -+} -+ -+static unsigned long vbox_ttm_io_mem_pfn(struct ttm_buffer_object *bo, -+ unsigned long page_offset) -+{ -+ struct drm_mm_node *mm; -+ unsigned long offset = (page_offset << PAGE_SHIFT); -+ -+ mm = vbox_find_mm_node(&bo->mem, &offset); -+ return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start + -+ (offset >> PAGE_SHIFT); -+} -+ - struct ttm_bo_driver vbox_bo_driver = { - .ttm_tt_create = vbox_ttm_tt_create, - .ttm_tt_populate = vbox_ttm_tt_populate, -@@ -268,7 +285,7 @@ struct ttm_bo_driver vbox_bo_driver = { - .io_mem_reserve = &vbox_ttm_io_mem_reserve, - .io_mem_free = &vbox_ttm_io_mem_free, - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) -- .io_mem_pfn = ttm_bo_default_io_mem_pfn, -+ .io_mem_pfn = vbox_ttm_io_mem_pfn, - #endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) \ - || defined(RHEL_74) -@@ -422,6 +439,7 @@ static inline u64 vbox_bo_gpu_offset(str - - int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr) - { -+ struct ttm_operation_ctx ctx = {false, false}; - int i, ret; - - if (bo->pin_count) { -@@ -437,7 +455,7 @@ int vbox_bo_pin(struct vbox_bo *bo, u32 - for (i = 0; i < bo->placement.num_placement; i++) - PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT; - -- ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); -+ ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx); - if (ret) - return ret; - -@@ -451,6 +469,7 @@ int vbox_bo_pin(struct vbox_bo *bo, u32 - - int vbox_bo_unpin(struct vbox_bo *bo) - { -+ struct ttm_operation_ctx ctx = {false, false}; - int i, ret; - - if (!bo->pin_count) { -@@ -464,7 +483,7 @@ int vbox_bo_unpin(struct vbox_bo *bo) - for (i = 0; i < bo->placement.num_placement; i++) - PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT; - -- ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); -+ ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx); - if (ret) - return ret; - -@@ -478,6 +497,7 @@ int vbox_bo_unpin(struct vbox_bo *bo) - */ - int vbox_bo_push_sysram(struct vbox_bo *bo) - { -+ struct ttm_operation_ctx ctx = {false, false}; - int i, ret; - - if (!bo->pin_count) { -@@ -496,7 +516,7 @@ int vbox_bo_push_sysram(struct vbox_bo * - for (i = 0; i < bo->placement.num_placement; i++) - PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT; - -- ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); -+ ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx); - if (ret) { - DRM_ERROR("pushing to VRAM failed\n"); - return ret; diff --git a/virtualbox.changes b/virtualbox.changes index 378e33a..2abc344 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Mar 22 19:32:44 UTC 2018 - Larry.Finger@lwfinger.net + +- Further updates for Leap 15 kernel API changes. + ------------------------------------------------------------------- Wed Mar 21 15:28:52 UTC 2018 - Larry.Finger@lwfinger.net