VirtualBox

Changeset 90577 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 9, 2021 9:57:00 AM (3 years ago)
Author:
vboxsync
Message:

Linux Host and Guest drivers: another attempt to introduce initial support for RHEL 8.5 kernels, bugref:4567.

CentOS kernel 4.18.0-326.el8 (RHEL 8,5) has backported commits from vanilla kernel 5.10+.
Fedora kernel 5.9.0-36.eln104 (RHEL 8,99) does not have some of these changes yet.
This commit attempts to move relevant code into RHEL 8,5 specific section. For some
parts of DRM code, changes are only affect RHEL 8,5 (8,99 is excluded) due to missing
commits (on 8,99) from newer kernels.

Location:
trunk/src/VBox/Additions/linux/drm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.c

    r90519 r90577  
    366366#if RTLNX_VER_MAX(3,12,0) && !RTLNX_RHEL_MAJ_PREREQ(7,3)
    367367        .dumb_destroy = vbox_dumb_destroy,
    368 #elif RTLNX_VER_MAX(5,12,0)
     368#elif RTLNX_VER_MAX(5,12,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    369369        .dumb_destroy = drm_gem_dumb_destroy,
    370370#endif
     
    376376        .gem_prime_mmap = vbox_gem_prime_mmap,
    377377
    378 #if RTLNX_VER_MAX(5,11,0)
     378#if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    379379        .dev_priv_size = 0,
    380380# if RTLNX_VER_MIN(4,7,0)
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r90519 r90577  
    177177# include <drm/ttm/ttm_memory.h>
    178178#endif
    179 #if RTLNX_VER_MAX(5,12,0)
     179#if RTLNX_VER_MAX(5,12,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    180180# include <drm/ttm/ttm_module.h>
    181181#endif
  • trunk/src/VBox/Additions/linux/drm/vbox_fb.c

    r90519 r90577  
    304304#if RTLNX_VER_MIN(5,14,0)
    305305        ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.resource->num_pages, &bo->kmap);
    306 #elif RTLNX_VER_MIN(5,12,0)
     306#elif RTLNX_VER_MIN(5,12,0) || RTLNX_RHEL_MAJ_PREREQ(8,5)
    307307        ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.mem.num_pages, &bo->kmap);
    308308#else
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r90519 r90577  
    863863#if RTLNX_VER_MIN(5,14,0)
    864864        ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.resource->num_pages, &uobj_map);
    865 #elif RTLNX_VER_MIN(5,12,0)
     865#elif RTLNX_VER_MIN(5,12,0) || RTLNX_RHEL_MAJ_PREREQ(8,5)
    866866        ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.mem.num_pages, &uobj_map);
    867867#else
  • trunk/src/VBox/Additions/linux/drm/vbox_ttm.c

    r90519 r90577  
    3434 */
    3535#include "vbox_drv.h"
    36 #if RTLNX_VER_MIN(5,11,0)
     36#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_MAJ_PREREQ(8,5)
    3737# include <drm/drm_gem.h>
    3838# include <drm/drm_gem_ttm_helper.h>
     
    141141}
    142142
    143 #if RTLNX_VER_MAX(5,10,0)
     143#if RTLNX_VER_MAX(5,10,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    144144static int
    145145vbox_bo_init_mem_type(struct ttm_bo_device *bdev, u32 type,
     
    187187#endif
    188188
    189 #if RTLNX_VER_MAX(5,10,0)
     189#if RTLNX_VER_MAX(5,10,0) && !RTLNX_RHEL_RANGE(8,5, 8,99)
    190190static int vbox_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
    191191                                   struct ttm_mem_reg *mem)
     
    227227        mem->bus.addr = NULL;
    228228        mem->bus.offset = 0;
    229 # if RTLNX_VER_MAX(5,12,0)
     229# if RTLNX_VER_MAX(5,12,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    230230        mem->size = mem->num_pages << PAGE_SHIFT;
    231231# endif
     
    237237                return 0;
    238238        case TTM_PL_VRAM:
    239 # if RTLNX_VER_MIN(5,11,0)
     239# if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    240240                mem->bus.caching = ttm_write_combined;
    241241# endif
    242 # if RTLNX_VER_MIN(5,10,0)
     242# if RTLNX_VER_MIN(5,10,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    243243                mem->bus.offset = (mem->start << PAGE_SHIFT) + pci_resource_start(VBOX_DRM_TO_PCI_DEV(vbox->dev), 0);
    244244# else
     
    262262{
    263263}
    264 #elif RTLNX_VER_MIN(5,10,0)
     264#elif RTLNX_VER_MIN(5,10,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    265265static void vbox_ttm_io_mem_free(struct ttm_bo_device *bdev,
    266266                                 struct ttm_resource *mem)
     
    280280        kfree(tt);
    281281}
    282 #elif RTLNX_VER_MIN(5,10,0)
     282#elif RTLNX_VER_MIN(5,10,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    283283static void vbox_ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *tt)
    284284{
     
    314314                return NULL;
    315315
    316 #if RTLNX_VER_MAX(5,10,0)
     316#if RTLNX_VER_MAX(5,10,0) && !RTLNX_RHEL_RANGE(8,5, 8,99)
    317317        tt->func = &vbox_tt_backend_func;
    318318#endif
    319319#if RTLNX_VER_MAX(4,17,0) && !RTLNX_RHEL_MAJ_PREREQ(7,6) && !RTLNX_SUSE_MAJ_PREREQ(15,1) && !RTLNX_SUSE_MAJ_PREREQ(12,5)
    320320        if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
    321 #elif RTLNX_VER_MAX(5,11,0)
     321#elif RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_RANGE(8,5, 8,99)
    322322        if (ttm_tt_init(tt, bo, page_flags)) {
    323323#else
     
    351351#endif
    352352
    353 #if RTLNX_VER_MIN(5,11,0)
     353#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    354354static int vbox_bo_move(struct ttm_buffer_object *bo, bool evict,
    355355        struct ttm_operation_ctx *ctx, struct ttm_resource *new_mem,
     
    366366#endif /* < 5.13.0 */
    367367        .ttm_tt_create = vbox_ttm_tt_create,
    368 #if RTLNX_VER_MIN(5,10,0)
     368#if RTLNX_VER_MIN(5,10,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    369369        .ttm_tt_destroy = vbox_ttm_tt_destroy,
    370370#endif
     
    373373        .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,
    374374#endif
    375 #if RTLNX_VER_MAX(5,10,0)
     375#if RTLNX_VER_MAX(5,10,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    376376        .init_mem_type = vbox_bo_init_mem_type,
    377377#endif
     
    394394        .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
    395395#endif
    396 #if RTLNX_VER_MIN(5,11,0)
     396#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    397397        .move = &vbox_bo_move,
    398398#endif
     
    423423#endif
    424424                                 &vbox_bo_driver,
    425 #if RTLNX_VER_MIN(5,11,0)
     425#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    426426                                 dev->dev,
    427427#endif
     
    434434                                 DRM_FILE_PAGE_OFFSET,
    435435#endif
    436 #if RTLNX_VER_MIN(5,11,0)
     436#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    437437                                 false,
    438438#endif
     
    447447        }
    448448
    449 #if RTLNX_VER_MIN(5,10,0)
     449#if RTLNX_VER_MIN(5,10,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    450450        ret = ttm_range_man_init(bdev, TTM_PL_VRAM, false,
    451451                             vbox->available_vram_size >> PAGE_SHIFT);
     
    515515
    516516        if (mem_type & VBOX_MEM_TYPE_VRAM) {
    517 #if RTLNX_VER_MIN(5,11,0)
     517#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    518518                bo->placements[c].mem_type = TTM_PL_VRAM;
    519519                PLACEMENT_FLAGS(bo->placements[c++]) = 0;
     
    528528        }
    529529        if (mem_type & VBOX_MEM_TYPE_SYSTEM) {
    530 #if RTLNX_VER_MIN(5,11,0)
     530#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    531531                bo->placements[c].mem_type = TTM_PL_SYSTEM;
    532532                PLACEMENT_FLAGS(bo->placements[c++]) = 0;
     
    541541        }
    542542        if (!c) {
    543 #if RTLNX_VER_MIN(5,11,0)
     543#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    544544                bo->placements[c].mem_type = TTM_PL_SYSTEM;
    545545                PLACEMENT_FLAGS(bo->placements[c++]) = 0;
     
    565565}
    566566
    567 #if RTLNX_VER_MIN(5,11,0)
     567#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    568568static const struct drm_gem_object_funcs vbox_drm_gem_object_funcs = {
    569569        .free   = vbox_gem_free_object,
     
    593593                goto err_free_vboxbo;
    594594
    595 #if RTLNX_VER_MIN(5,11,0)
     595#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    596596        if (!vboxbo->gem.funcs) {
    597597                vboxbo->gem.funcs = &vbox_drm_gem_object_funcs;
     
    669669#endif
    670670        int ret;
    671 #if RTLNX_VER_MAX(5,11,0)
     671#if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    672672        int i;
    673673#endif
     
    683683        vbox_ttm_placement(bo, mem_type);
    684684
    685 #if RTLNX_VER_MAX(5,11,0)
     685#if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    686686        for (i = 0; i < bo->placement.num_placement; i++)
    687687                PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
     
    698698        bo->pin_count = 1;
    699699
    700 #if RTLNX_VER_MIN(5,11,0)
     700#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    701701        ttm_bo_pin(&bo->bo);
    702702#endif
     
    711711{
    712712#if RTLNX_VER_MIN(4,16,0) || RTLNX_RHEL_MAJ_PREREQ(7,6) || RTLNX_SUSE_MAJ_PREREQ(15,1) || RTLNX_SUSE_MAJ_PREREQ(12,5)
    713 # if RTLNX_VER_MAX(5,11,0)
     713# if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    714714        struct ttm_operation_ctx ctx = { false, false };
    715715# endif
    716716#endif
    717717        int ret = 0;
    718 #if RTLNX_VER_MAX(5,11,0)
     718#if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    719719        int i;
    720720#endif
     
    728728                return 0;
    729729
    730 #if RTLNX_VER_MAX(5,11,0)
     730#if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    731731        for (i = 0; i < bo->placement.num_placement; i++)
    732732                PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT;
     
    735735#if RTLNX_VER_MAX(4,16,0) && !RTLNX_RHEL_MAJ_PREREQ(7,6) && !RTLNX_SUSE_MAJ_PREREQ(15,1) && !RTLNX_SUSE_MAJ_PREREQ(12,5)
    736736        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
    737 #elif RTLNX_VER_MAX(5,11,0)
     737#elif RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    738738        ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
    739739#endif
     
    741741                return ret;
    742742
    743 #if RTLNX_VER_MIN(5,11,0)
     743#if RTLNX_VER_MIN(5,11,0) || RTLNX_RHEL_RANGE(8,5, 8,99)
    744744        ttm_bo_unpin(&bo->bo);
    745745#endif
     
    748748}
    749749
    750 #if RTLNX_VER_MAX(5,11,0)
     750#if RTLNX_VER_MAX(5,11,0) && !RTLNX_RHEL_MAJ_PREREQ(8,5)
    751751/*
    752752 * Move a vbox-owned buffer object to system memory if no one else has it
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette