forked from pool/virtualbox
- Updated the fixes for kernel 4.16.
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=409
This commit is contained in:
parent
6ddb4b0ea4
commit
6a6192668a
@ -28,3 +28,131 @@ Index: VirtualBox-5.2.8/src/VBox/Additions/linux/drm/vbox_ttm.c
|
||||
|
||||
static void vbox_ttm_backend_destroy(struct ttm_tt *tt)
|
||||
{
|
||||
@@ -244,16 +256,48 @@ static struct ttm_tt *vbox_ttm_tt_create
|
||||
return tt;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+static int vbox_ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
|
||||
+{
|
||||
+ return ttm_pool_populate(ttm, ctx);
|
||||
+}
|
||||
+#else
|
||||
static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
|
||||
{
|
||||
return ttm_pool_populate(ttm);
|
||||
}
|
||||
+#endif
|
||||
|
||||
static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm)
|
||||
{
|
||||
ttm_pool_unpopulate(ttm);
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+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);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
struct ttm_bo_driver vbox_bo_driver = {
|
||||
.ttm_tt_create = vbox_ttm_tt_create,
|
||||
.ttm_tt_populate = vbox_ttm_tt_populate,
|
||||
@@ -268,8 +312,12 @@ 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)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ .io_mem_pfn = vbox_ttm_io_mem_pfn,
|
||||
+#else
|
||||
.io_mem_pfn = ttm_bo_default_io_mem_pfn,
|
||||
#endif
|
||||
+#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) \
|
||||
|| defined(RHEL_74)
|
||||
.lru_tail = &ttm_bo_default_lru_tail,
|
||||
@@ -422,6 +470,9 @@ static inline u64 vbox_bo_gpu_offset(str
|
||||
|
||||
int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ struct ttm_operation_ctx ctx = {false, false};
|
||||
+#endif
|
||||
int i, ret;
|
||||
|
||||
if (bo->pin_count) {
|
||||
@@ -437,7 +488,11 @@ 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;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
|
||||
+#else
|
||||
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
|
||||
+#endif
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -451,6 +506,9 @@ int vbox_bo_pin(struct vbox_bo *bo, u32
|
||||
|
||||
int vbox_bo_unpin(struct vbox_bo *bo)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ struct ttm_operation_ctx ctx = {false, false};
|
||||
+#endif
|
||||
int i, ret;
|
||||
|
||||
if (!bo->pin_count) {
|
||||
@@ -464,7 +522,11 @@ 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;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
|
||||
+#else
|
||||
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
|
||||
+#endif
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -478,6 +540,9 @@ int vbox_bo_unpin(struct vbox_bo *bo)
|
||||
*/
|
||||
int vbox_bo_push_sysram(struct vbox_bo *bo)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ struct ttm_operation_ctx ctx = {false, false};
|
||||
+#endif
|
||||
int i, ret;
|
||||
|
||||
if (!bo->pin_count) {
|
||||
@@ -496,7 +561,11 @@ 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;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
|
||||
+ ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
|
||||
+#else
|
||||
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
|
||||
+#endif
|
||||
if (ret) {
|
||||
DRM_ERROR("pushing to VRAM failed\n");
|
||||
return ret;
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 9 01:41:56 UTC 2018 - Larry.Finger@lwfinger.net
|
||||
|
||||
- Updated the fixes for kernel 4.16.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Mar 3 19:15:12 UTC 2018 - Larry.Finger@lwfinger.net
|
||||
|
||||
|
@ -38,7 +38,7 @@ Url: http://www.virtualbox.org/
|
||||
# so you don't need to repack virtualbox by hand, just add new release of VirtualBox-x.x.x.tar.bz2 and line below with
|
||||
# script virtualbox-patch-source.sh will do the job :)
|
||||
# WARNING: This is not a comment, but the real command to repack souce
|
||||
##\%(bash %{_sourcedir}/virtualbox-patch-source.sh VirtualBox-%{version}.tar.bz2)
|
||||
#%%(bash %%{_sourcedir}/virtualbox-patch-source.sh VirtualBox-%%{version}.tar.bz2)
|
||||
Source0: VirtualBox-%{version}-patched.tar.bz2
|
||||
Source1: UserManual.pdf
|
||||
Source3: %{name}-60-vboxguest.rules
|
||||
@ -138,7 +138,7 @@ BuildRequires: e2fsprogs-devel
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: glibc-devel-static
|
||||
BuildRequires: glibc-devel-static >= 2.27
|
||||
BuildRequires: gsoap-devel
|
||||
BuildRequires: java-devel >= 1.6.0
|
||||
BuildRequires: kbuild >= 0.1.9998svn3101
|
||||
@ -251,7 +251,7 @@ websrv GUI part for %{name}.
|
||||
|
||||
%package host-KMP
|
||||
Summary: Host kernel module for VirtualBox
|
||||
##\%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE7} -n %{name}-host -f %{SOURCE5} -x kdump um xen pae xenpae pv
|
||||
##\%kernel_module_package -t %%{_builddir}/virtualbox-kmp-template -p %%{SOURCE7} -n %%{name}-host -f %%{SOURCE5} -x kdump um xen pae xenpae pv
|
||||
Group: System/Emulators/PC
|
||||
Requires: %{kernel_module_package_buildreqs}
|
||||
|
||||
@ -947,8 +947,8 @@ export DISABLE_RESTART_ON_UPDATE=yes
|
||||
%{_bindir}/VBoxClient
|
||||
%{_libdir}/VBoxOGL*.so
|
||||
%{_libdir}/VBoxEGL*.so
|
||||
##\%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so
|
||||
##\%{_libdir}/dri/vboxvideo_dri.so
|
||||
#%%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so
|
||||
#%%{_libdir}/dri/vboxvideo_dri.so
|
||||
%{_sysconfdir}/X11/xinit/xinitrc.d/vboxadd-xclient.sh
|
||||
|
||||
%files guest-tools
|
||||
|
Loading…
Reference in New Issue
Block a user