Ticket #20914: vbox-linux-5.19.patch
| File vbox-linux-5.19.patch, 14.3 KB (added by , 2 years ago) |
|---|
-
include/VBox/sup.h
2142 2142 */ 2143 2143 SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void); 2144 2144 2145 /** 2146 * Notification from R0 VMM prior to loading the guest-FPU register state. 2147 * 2148 * @returns Whether the host-FPU register state has been saved by the host kernel. 2149 * @param fCtxHook Whether thread-context hooks are enabled. 2150 * 2151 * @remarks Called with preemption disabled. 2152 */ 2153 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook); 2154 2155 /** 2156 * Notification from R0 VMM after saving the guest-FPU register state (and 2157 * potentially restoring the host-FPU register state) in ring-0. 2158 * 2159 * @param fCtxHook Whether thread-context hooks are enabled. 2160 * 2161 * @remarks Called with preemption disabled. 2162 */ 2163 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook); 2164 2145 2165 /** @copydoc RTLogGetDefaultInstanceEx 2146 2166 * @remarks To allow overriding RTLogGetDefaultInstanceEx locally. */ 2147 2167 SUPR0DECL(struct RTLOGGER *) SUPR0GetDefaultLogInstanceEx(uint32_t fFlagsAndGroup); -
src/VBox/Additions/linux/drm/vbox_fb.c
362 362 info->screen_size = size; 363 363 364 364 #ifdef CONFIG_FB_DEFERRED_IO 365 # if RTLNX_VER_MIN(5,19,0) 366 info->fix.smem_len = info->screen_size; 367 # endif 365 368 info->fbdefio = &vbox_defio; 366 369 fb_deferred_io_init(info); 367 370 #endif -
src/VBox/Additions/linux/drm/vbox_ttm.c
320 320 if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) { 321 321 #elif RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_RANGE(8,5, 8,99) 322 322 if (ttm_tt_init(tt, bo, page_flags)) { 323 #elif RTLNX_VER_MAX(5,19,0) 324 if (ttm_tt_init(tt, bo, page_flags, ttm_write_combined)) { 323 325 #else 324 if (ttm_tt_init(tt, bo, page_flags, ttm_write_combined )) {326 if (ttm_tt_init(tt, bo, page_flags, ttm_write_combined, 0)) { 325 327 #endif 326 328 kfree(tt); 327 329 return NULL; -
src/VBox/Additions/linux/sharedfolders/regops.c
3581 3581 * Needed for mmap and reads+writes when the file is mmapped in a 3582 3582 * shared+writeable fashion. 3583 3583 */ 3584 #if RTLNX_VER_MIN(5,19,0) 3585 static int vbsf_read_folio(struct file *file, struct folio *folio) 3586 { 3587 struct page *page = &folio->page; 3588 #else 3584 3589 static int vbsf_readpage(struct file *file, struct page *page) 3585 3590 { 3591 #endif 3586 3592 struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode; 3587 3593 int err; 3588 3594 … … 3728 3734 /** 3729 3735 * Called when writing thru the page cache (which we shouldn't be doing). 3730 3736 */ 3731 int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, 3732 unsigned len, unsigned flags, struct page **pagep, void **fsdata) 3737 static inline void vbsf_write_begin_warn(loff_t pos, unsigned len, unsigned flags) 3733 3738 { 3734 3739 /** @todo r=bird: We shouldn't ever get here, should we? Because we don't use 3735 3740 * the page cache for any writes AFAIK. We could just as well use … … 3745 3750 WARN_ON(1); 3746 3751 # endif 3747 3752 } 3753 } 3754 3755 # if RTLNX_VER_MIN(5,19,0) 3756 int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, 3757 unsigned len, struct page **pagep, void **fsdata) 3758 { 3759 vbsf_write_begin_warn(pos, len, 0); 3760 return simple_write_begin(file, mapping, pos, len, pagep, fsdata); 3761 } 3762 # else 3763 int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, 3764 unsigned len, unsigned flags, struct page **pagep, void **fsdata) 3765 { 3766 vbsf_write_begin_warn(pos, len, flags); 3748 3767 return simple_write_begin(file, mapping, pos, len, flags, pagep, fsdata); 3749 3768 } 3769 # endif 3770 3750 3771 #endif /* KERNEL_VERSION >= 2.6.24 */ 3751 3772 3752 3773 #if RTLNX_VER_MIN(5,14,0) … … 3820 3841 * @todo the FsPerf touch/flush (mmap) test fails on 4.4.0 (ubuntu 16.04 lts). 3821 3842 */ 3822 3843 struct address_space_operations vbsf_reg_aops = { 3844 #if RTLNX_VER_MIN(5,19,0) 3845 .read_folio = vbsf_read_folio, 3846 #else 3823 3847 .readpage = vbsf_readpage, 3848 #endif 3824 3849 .writepage = vbsf_writepage, 3825 3850 /** @todo Need .writepages if we want msync performance... */ 3826 #if RTLNX_VER_MIN(2,5,12) 3851 #if RTLNX_VER_MIN(5,18,0) 3852 .dirty_folio = filemap_dirty_folio, 3853 #elif RTLNX_VER_MIN(2,5,12) 3827 3854 .set_page_dirty = __set_page_dirty_buffers, 3828 3855 #endif 3829 3856 #if RTLNX_VER_MIN(5,14,0) … … 3840 3867 .direct_IO = vbsf_direct_IO, 3841 3868 #endif 3842 3869 }; 3843 -
src/VBox/Additions
-
src/VBox/HostDrivers/Support/SUPDrv.cpp
Property changes on: src/VBox/Additions ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,2 ## Merged /trunk/src/VBox/Additions:r150844,151718-151720 Merged /branches/VBox-6.1/src/VBox/Additions:r151572,151833-151835
98 98 # endif 99 99 #endif 100 100 101 #if defined(RT_OS_LINUX) && !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE) 102 /* In Linux 5.18-rc1, memcpy became a wrapper which does fortify checks 103 * before triggering __underlying_memcpy() call. We do not pass these checks here, 104 * so bypass them for now. */ 105 # if RTLNX_VER_MIN(5,18,0) 106 # define SUPDRV_MEMCPY __underlying_memcpy 107 # else 108 # define SUPDRV_MEMCPY memcpy 109 # endif 110 #else 111 # define SUPDRV_MEMCPY memcpy 112 #endif 101 113 102 114 /* 103 115 * Logging assignments: … … 266 278 SUPEXP_STK_BACK( 2, SUPR0ContFree), 267 279 SUPEXP_STK_BACK( 2, SUPR0ChangeCR4), 268 280 SUPEXP_STK_BACK( 1, SUPR0EnableVTx), 281 SUPEXP_STK_OKAY( 1, SUPR0FpuBegin), 282 SUPEXP_STK_OKAY( 1, SUPR0FpuEnd), 269 283 SUPEXP_STK_BACK( 0, SUPR0SuspendVTxOnCpu), 270 284 SUPEXP_STK_BACK( 1, SUPR0ResumeVTxOnCpu), 271 285 SUPEXP_STK_OKAY( 1, SUPR0GetCurrentGdtRw), … … 1742 1756 1743 1757 /* execute */ 1744 1758 pReq->u.Out.cFunctions = RT_ELEMENTS(g_aFunctions); 1745 memcpy(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions));1759 SUPDRV_MEMCPY(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions)); 1746 1760 pReq->Hdr.rc = VINF_SUCCESS; 1747 1761 return 0; 1748 1762 } -
src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
2002 2002 } 2003 2003 2004 2004 2005 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) 2006 { 2007 RT_NOREF(fCtxHook); 2008 return false; 2009 } 2010 2011 2012 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) 2013 { 2014 RT_NOREF(fCtxHook); 2015 } 2016 2005 2017 /* 2006 2018 * 2007 2019 * org_virtualbox_SupDrv -
src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
640 640 return 0; 641 641 } 642 642 643 644 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) 645 { 646 RT_NOREF(fCtxHook); 647 return false; 648 } 649 650 651 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) 652 { 653 RT_NOREF(fCtxHook); 654 } 655 -
src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
40 40 #include <iprt/semaphore.h> 41 41 #include <iprt/initterm.h> 42 42 #include <iprt/process.h> 43 #include <iprt/thread.h> 43 44 #include <VBox/err.h> 44 45 #include <iprt/mem.h> 45 46 #include <VBox/log.h> … … 1454 1455 } 1455 1456 1456 1457 1458 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) 1459 { 1460 RT_NOREF(fCtxHook); 1461 #if RTLNX_VER_MIN(4,19,0) /* Going back to 4.19.0 for better coverage, we 1462 probably only need 5.17.7+ in the end. */ 1463 /* 1464 * HACK ALERT! 1465 * 1466 * We'd like to use the old __kernel_fpu_begin() API which was removed in 1467 * early 2019, because we typically run with preemption enabled and have an 1468 * preemption hook installed which will call kernel_fpu_end() in case we're 1469 * scheduled out after getting in here. The preemption hook is almost 1470 * useless if we run with preemption disabled. 1471 * 1472 * For the case where the kernel does not have preemption hooks, we get here 1473 * with preemption already disabled and one more count doesn't make any 1474 * difference. 1475 * 1476 * So, after the kernel_fpu_begin() call we undo the implicit preempt_disable() 1477 * call it does, so the preemption hook can do its work and the VBox user has 1478 * a more responsive system. 1479 * 1480 * See @bugref{10209#c12} and onwards for more details. 1481 */ 1482 Assert(fCtxHook || !RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 1483 kernel_fpu_begin(); 1484 # if 0 /* Always do it for now for better test coverage. */ 1485 if (fCtxHook) 1486 # endif 1487 preempt_enable(); 1488 return false; /** @todo Not sure if we have license to use any extended state, or 1489 * if we're limited to the SSE & x87 FPU. If it's the former, 1490 * we should return @a true and the caller can skip 1491 * saving+restoring the host state and save some time. */ 1492 #else 1493 return false; 1494 #endif 1495 } 1496 1497 1498 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) 1499 { 1500 RT_NOREF(fCtxHook); 1501 #if RTLNX_VER_MIN(4,19,0) 1502 /* HACK ALERT! See SUPR0FpuBegin for an explanation of this. */ 1503 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 1504 # if 0 /* Always do it for now for better test coverage. */ 1505 if (fCtxHook) 1506 # endif 1507 preempt_disable(); 1508 kernel_fpu_end(); 1509 #endif 1510 } 1511 1512 1457 1513 int VBOXCALL supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw) 1458 1514 { 1459 1515 #if RTLNX_VER_MIN(4,12,0) -
src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
541 541 return 0; 542 542 } 543 543 544 545 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) 546 { 547 RT_NOREF(fCtxHook); 548 return false; 549 } 550 551 552 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) 553 { 554 RT_NOREF(fCtxHook); 555 } 556 -
src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
1309 1309 return 0; 1310 1310 } 1311 1311 1312 1313 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) 1314 { 1315 RT_NOREF(fCtxHook); 1316 return false; 1317 } 1318 1319 1320 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) 1321 { 1322 RT_NOREF(fCtxHook); 1323 } 1324 -
src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
2704 2704 } 2705 2705 2706 2706 2707 SUPR0DECL(bool) SUPR0FpuBegin(bool fCtxHook) 2708 { 2709 RT_NOREF(fCtxHook); 2710 return false; 2711 } 2712 2713 2714 SUPR0DECL(void) SUPR0FpuEnd(bool fCtxHook) 2715 { 2716 RT_NOREF(fCtxHook); 2717 } 2718 2719 2707 2720 SUPR0DECL(int) SUPR0IoCtlSetupForHandle(PSUPDRVSESSION pSession, intptr_t hHandle, uint32_t fFlags, PSUPR0IOCTLCTX *ppCtx) 2708 2721 { 2709 2722 /* -
src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
2311 2311 vboxNetFltDumpPacket(pSG, true, "host", (fDst & INTNETTRUNKDIR_WIRE) ? 0 : 1); 2312 2312 Log6(("vboxNetFltPortOsXmit: pBuf->cb dump:\n%.*Rhxd\n", sizeof(pBuf->cb), pBuf->cb)); 2313 2313 Log6(("vboxNetFltPortOsXmit: netif_rx_ni(%p)\n", pBuf)); 2314 #if RTLNX_VER_MIN(5,18,0) 2315 local_bh_disable(); 2316 err = netif_rx(pBuf); 2317 local_bh_enable(); 2318 #else 2314 2319 err = netif_rx_ni(pBuf); 2320 #endif 2315 2321 if (err) 2316 2322 rc = RTErrConvertFromErrno(err); 2317 2323 } -
src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
184 184 # include <asm/tlbflush.h> 185 185 #endif 186 186 187 /* for kernel_fpu_begin / kernel_fpu_end() */ 188 #if RTLNX_VER_MIN(4,2,0) 189 # include <asm/fpu/api.h> 190 #endif 191 187 192 #if RTLNX_VER_MIN(3,7,0) 188 193 # include <asm/smap.h> 189 194 #else -
src/VBox/VMM/VMMR0/CPUMR0.cpp
440 440 Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST)); 441 441 Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_SYNC_FPU_STATE)); 442 442 443 /* Notify the support driver prior to loading the guest-FPU register state. */ 444 SUPR0FpuBegin(VMMR0ThreadCtxHookIsEnabled(pVCpu)); 445 /** @todo use return value? Currently skipping that to be on the safe side 446 * wrt. extended state (linux). */ 447 443 448 if (!pVM->cpum.s.HostFeatures.fLeakyFxSR) 444 449 { 445 450 Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE)); … … 504 509 cpumR0SaveGuestRestoreHostFPUState(&pVCpu->cpum.s); 505 510 pVCpu->cpum.s.fUseFlags &= ~CPUM_USED_MANUAL_XMM_RESTORE; 506 511 } 512 513 /* Notify the support driver after loading the host-FPU register state. */ 514 SUPR0FpuEnd(VMMR0ThreadCtxHookIsEnabled(pVCpu)); 507 515 } 508 516 else 509 517 fSavedGuest = false;

