Comments

Kernel – 5.18-rc1 Released. Breaks VMware and NVIDIA. VMware Fix Available. — 23 Comments

  1. Try this for nvidia patch for 5.18-rc1 …

    — nvidia-510.54/nvidia/nv.c 2022-02-08 13:41:43.000000000 +0800
    +++ nvidia-510.54/nvidia/nv.c 2022-04-04 13:15:50.459893021 +0800
    @@ -22,6 +22,7 @@
    */

    #include “nvmisc.h”
    +#include “linux/dma-mapping.h”
    #include “os-interface.h”
    #include “nv-linux.h”
    #include “nv-p2p.h”
    @@ -2765,13 +2766,13 @@
    */
    if (!nvl->tce_bypass_enabled)
    {
    – pci_set_dma_mask(nvl->pci_dev, new_mask);
    + dma_set_mask((struct device *) &nvl->pci_dev, new_mask);
    /* Certain kernels have a bug which causes pci_set_consistent_dma_mask
    * to call GPL sme_active symbol, this bug has already been fixed in a
    * minor release update but detect the failure scenario here to prevent
    * an installation regression */
    #if !NV_IS_EXPORT_SYMBOL_GPL_sme_active
    – pci_set_consistent_dma_mask(nvl->pci_dev, new_mask);
    + dma_set_coherent_mask((struct device *) &nvl->pci_dev, new_mask);
    #endif
    }
    }
    — nvidia-510.54/nvidia/linux_nvswitch.c 2022-02-08 13:41:43.000000000 +0800
    +++ nvidia-510.54/nvidia/linux_nvswitch.c 2022-04-04 13:44:31.179882519 +0800
    @@ -21,9 +21,8 @@

    *******************************************************************************/
    #include “linux_nvswitch.h”

    #include

    +#include “linux/dma-direction.h”
    #include “conftest.h”
    #include “nvlink_errors.h”
    #include “nvlink_linux.h”
    @@ -2140,11 +2139,11 @@
    )
    {
    if (direction == NVSWITCH_DMA_DIR_TO_SYSMEM)
    – return PCI_DMA_FROMDEVICE;
    + return DMA_FROM_DEVICE;
    else if (direction == NVSWITCH_DMA_DIR_FROM_SYSMEM)
    – return PCI_DMA_TODEVICE;
    + return DMA_TO_DEVICE;
    else
    – return PCI_DMA_BIDIRECTIONAL;
    + return DMA_BIDIRECTIONAL;
    }

    NvlStatus
    @@ -2165,9 +2164,9 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – *dma_handle = (NvU64)pci_map_single(pdev, cpu_addr, size, dma_dir);
    + *dma_handle = (NvU64)dma_map_single(&pdev->dev, cpu_addr, size, (enum dma_data_direction) dma_dir);

    – if (pci_dma_mapping_error(pdev, *dma_handle))
    + if (dma_mapping_error(&pdev->dev, *dma_handle))
    {
    pr_err(“nvidia-nvswitch: unable to create PCI DMA mapping\n”);
    return -NVL_ERR_GENERIC;
    @@ -2194,7 +2193,7 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_unmap_single(pdev, dma_handle, size, dma_dir);
    + dma_unmap_single(&pdev->dev, dma_handle, size, (enum dma_data_direction) dma_dir);

    return NVL_SUCCESS;
    }
    @@ -2211,7 +2210,7 @@
    if (!pdev)
    return -NVL_BAD_ARGS;

    – if (pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_addr_width)))
    + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_addr_width)))
    return -NVL_ERR_GENERIC;

    return NVL_SUCCESS;
    @@ -2234,7 +2233,7 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_dma_sync_single_for_cpu(pdev, dma_handle, size, dma_dir);
    + dma_sync_single_for_cpu(&pdev->dev, dma_handle, size, dma_dir);

    return NVL_SUCCESS;
    }
    @@ -2256,7 +2255,7 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_dma_sync_single_for_device(pdev, dma_handle, size, dma_dir);
    + dma_sync_single_for_device(&pdev->dev, dma_handle, size, (enum dma_data_direction)dma_dir);

    return NVL_SUCCESS;
    }

    • Besides that, (at least in Ubuntu) it is needed to fix the following errors:

      /var/lib/dkms/nvidia/510.60.02/build/nvidia-drm/nvidia-drm-gem.c:73:8: error: invalid use of undefined type ‘struct dma_buf_map’
      due to dma_buf_map: Rename to iosys_map -> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20220325&id=7938f4218168ae9fc4bdddb15976f9ebbae41999

      /var/lib/dkms/nvidia/510.60.02/build/nvidia-drm/nvidia-drm-drv.c:257:21: error: ‘struct drm_mode_config’ has no member named ‘allow_fb_modifiers’
      257 | dev->mode_config.allow_fb_modifiers = true;
      due to drm/sprd: remove allow_fb_modifiers setting -> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=cf1c7fee7ef37cfc09b5e704eb52d9466ca49012

      After to fix this, it still fails due to:
      ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘cc_mkdec’
      Which I think is caused by x86/coco: Add API to handle encryption mask -> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b577f542f93cbba57f8d6185ef1fb13a41ddf162
      That one I don’t know how to fix.

      • I patched with this below and with previous patch I posted, everything compiled fine. I’m using NVIDIA-Linux-x86_64-510.54.run and Linux 5.18.0-rc1.

        — nvidia-510.54/nvidia-drm/nvidia-drm-drv.c 2022-03-25 09:16:55.819991621 +0800
        +++ nvidia-510.54/nvidia-drm/nvidia-drm-drv.c 2022-03-25 09:17:36.219991374 +0800
        @@ -251,12 +251,6 @@
        dev->mode_config.async_page_flip = false;
        #endif

        -#if defined(NV_DRM_FORMAT_MODIFIERS_PRESENT)
        – /* Allow clients to define framebuffer layouts using DRM format modifiers */

        – dev->mode_config.allow_fb_modifiers = true;
        -#endif

        /* Initialize output polling support */

        drm_kms_helper_poll_init(dev);
        — nvidia-510.54/nvidia-drm/nvidia-drm-gem.c 2022-03-25 09:22:40.249989518 +0800
        +++ nvidia-510.54/nvidia-drm/nvidia-drm-gem.c 2022-03-25 09:23:07.849989350 +0800
        @@ -68,7 +68,7 @@
        #if !defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS) && \
        defined(NV_DRM_GEM_OBJECT_VMAP_HAS_MAP_ARG)
        static int nv_drm_gem_vmap(struct drm_gem_object *gem,
        – struct dma_buf_map *map)
        + struct iosys_map *map)
        {
        map->vaddr = nv_drm_gem_prime_vmap(gem);
        if (map->vaddr == NULL) {
        @@ -79,7 +79,7 @@
        }

        static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
        – struct dma_buf_map *map)
        + struct iosys_map *map)
        {
        nv_drm_gem_prime_vunmap(gem, map->vaddr);
        map->vaddr = NULL;

  2. Sorry, first patch has one issue … fixed … now card is detected with nvidia-smi …

    — nvidia-510.54/nvidia/nv.c 2022-02-08 13:41:43.000000000 +0800
    +++ nvidia-510.54/nvidia/nv.c 2022-04-04 13:15:50.459893021 +0800
    @@ -22,6 +22,7 @@
    */

    #include “nvmisc.h”
    +#include “linux/dma-mapping.h”
    #include “os-interface.h”
    #include “nv-linux.h”
    #include “nv-p2p.h”
    @@ -2765,13 +2766,13 @@
    */
    if (!nvl->tce_bypass_enabled)
    {
    – pci_set_dma_mask(nvl->pci_dev, new_mask);
    + dma_set_mask(&nvl->pci_dev->dev, new_mask);
    /* Certain kernels have a bug which causes pci_set_consistent_dma_mask
    * to call GPL sme_active symbol, this bug has already been fixed in a
    * minor release update but detect the failure scenario here to prevent
    * an installation regression */
    #if !NV_IS_EXPORT_SYMBOL_GPL_sme_active
    – pci_set_consistent_dma_mask(nvl->pci_dev, new_mask);
    + dma_set_coherent_mask(&nvl->pci_dev->dev, new_mask);
    #endif
    }
    }
    — nvidia-510.54/nvidia/linux_nvswitch.c 2022-02-08 13:41:43.000000000 +0800
    +++ nvidia-510.54/nvidia/linux_nvswitch.c 2022-04-04 13:44:31.179882519 +0800
    @@ -21,9 +21,8 @@

    *******************************************************************************/
    #include “linux_nvswitch.h”

    #include

    +#include “linux/dma-direction.h”
    #include “conftest.h”
    #include “nvlink_errors.h”
    #include “nvlink_linux.h”
    @@ -2140,11 +2139,11 @@
    )
    {
    if (direction == NVSWITCH_DMA_DIR_TO_SYSMEM)
    – return PCI_DMA_FROMDEVICE;
    + return DMA_FROM_DEVICE;
    else if (direction == NVSWITCH_DMA_DIR_FROM_SYSMEM)
    – return PCI_DMA_TODEVICE;
    + return DMA_TO_DEVICE;
    else
    – return PCI_DMA_BIDIRECTIONAL;
    + return DMA_BIDIRECTIONAL;
    }

    NvlStatus
    @@ -2165,9 +2164,9 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – *dma_handle = (NvU64)pci_map_single(pdev, cpu_addr, size, dma_dir);
    + *dma_handle = (NvU64)dma_map_single(&pdev->dev, cpu_addr, size, (enum dma_data_direction) dma_dir);

    – if (pci_dma_mapping_error(pdev, *dma_handle))
    + if (dma_mapping_error(&pdev->dev, *dma_handle))
    {
    pr_err(“nvidia-nvswitch: unable to create PCI DMA mapping\n”);
    return -NVL_ERR_GENERIC;
    @@ -2194,7 +2193,7 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_unmap_single(pdev, dma_handle, size, dma_dir);
    + dma_unmap_single(&pdev->dev, dma_handle, size, (enum dma_data_direction) dma_dir);

    return NVL_SUCCESS;
    }
    @@ -2211,7 +2210,7 @@
    if (!pdev)
    return -NVL_BAD_ARGS;

    – if (pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_addr_width)))
    + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_addr_width)))
    return -NVL_ERR_GENERIC;

    return NVL_SUCCESS;
    @@ -2234,7 +2233,7 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_dma_sync_single_for_cpu(pdev, dma_handle, size, dma_dir);
    + dma_sync_single_for_cpu(&pdev->dev, dma_handle, size, dma_dir);

    return NVL_SUCCESS;
    }
    @@ -2256,7 +2255,7 @@

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_dma_sync_single_for_device(pdev, dma_handle, size, dma_dir);
    + dma_sync_single_for_device(&pdev->dev, dma_handle, size, (enum dma_data_direction)dma_dir);

    return NVL_SUCCESS;
    }

  3. Hi!
    AFAIK I applied all the changes, but still get the GPL-only symbol error, which Cristiano mentioned. Did I miss something? Do you have any idea how to fix this?

    make -f ./scripts/Makefile.modpost
    sed ‘s/\.ko$/\.o/’ /var/lib/dkms/nvidia/510.54/build/modules.order | scripts/mod/modpost -m -a -o /var/lib/dkms/nvidia/510.54/build/Module.symvers -e -i Module.symvers -T –
    ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘cc_mkdec’
    make[2]: *** [scripts/Makefile.modpost:134: /var/lib/dkms/nvidia/510.54/build/Module.symvers] Error 1
    make[2]: *** Deleting file ‘/var/lib/dkms/nvidia/510.54/build/Module.symvers’
    make[1]: *** [Makefile:1755: modules] Error 2
    make[1]: Leaving directory ‘/usr/src/linux-headers-5.18.0-051800rc1-generic’
    make: *** [Makefile:82: modules] Error 2

  4. Cristiano, Gabor,

    > ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘cc_mkdec’

    This errror seems to come from the linux kernel coco … try using the latest kernel git version, compile and install that, then try compiling nvidia again.

    Thanks,
    Jeff

  5. Same error when kernel 5.18-rc1 is compiled from kernel.org. I haven’t tried from .run but it probably just doesn’t like the .deb files for the kernel. I’m sure Nvidia will get around to it “soon”.

    Compiled with Ubuntu 21.10 kernel 5.17.2 (self compiled) using gcc 11.2

    • I think that, as a workaround, we need to change the
      EXPORT_SYMBOL_GPL(cc_platform_has);
      by
      EXPORT_SYMBOL(cc_platform_has);
      in arch/x86/coco/core.c
      … and I don’t know if it is legal to do that, since we are changing the module licence type.

      to whom should we report this? Nvidia or kernel developers?

  6. When in doubt send it to both and let them fight each other over it claiming ignorance on our part! 🙂

    I would think that removing EXPORT_SYMBOL_GPL(cc_platform_has); with EXPORT_SYMBOL(cc_platform_has);
    is ok as long as you are not publishing a binary made from that change. They’re RC’s anyways. It’s expected that they will be torn to shreds and rewritten.

    That change for core.c gave the same error anyways when installing the packaged 5.18-rc1.deb files I compiled.

  7. I made the following in export.h and it installed and compiled (along with the other fixes from above). If it crashes i’ll update here.

    — 518rc1/linux-5.18-rc1/include/linux/export.h 2022-04-03 17:08:21.000000000 -0400
    +++ 518rc1/linux-5.18-rc1/include/linux/export.h 2022-04-09 20:07:30.536480202 -0400
    @@ -161,9 +161,9 @@
    #endif

    #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, “”)
    -#define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, “_gpl”)
    +#define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, “”)

    #define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, “”, #ns)
    -#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, “_gpl”, #ns)
    +#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, “”, #ns)

    #endif /* !__ASSEMBLY__ */

  8. Changing arch/x86/coco/core.c requires recompiling the kernel, if I’m not mistaken. An easier workaround, at least for me, was changing all instances of MODULE_LICENSE(“NVIDIA”) to MODULE_LICENSE(“GPL”). This is for sure “illegal”, but I’m willing to accept that until there is an official fix from Nvidia. With the patches posted above _and_ this change the module loads and so far also seems to work.

  9. Here’s my attempt for a patch. It’s for nvidia-510.60.02, Ubuntu 20.04.4 latest(?) version. I have adapted Joan Bruguera’s ‘Tentative fix for NVIDIA 470.103.01 driver for Linux 5.18-rc1+’ (https://gist.github.com/joanbm/c00f9e19731d80269a4badc595f63b68) and it patches cleanly with this nvidia version. It compiles and the system boots, nvidia-smi works and no GPL errors… Hope it works for the later versions people above are using…

    diff -rupN nvidia-510.60.02/common/inc/nv-linux.h nvidia-510.60.02p/common/inc/nv-linux.h
    — nvidia-510.60.02/common/inc/nv-linux.h 2022-03-16 13:01:09.000000000 +0100
    +++ nvidia-510.60.02p/common/inc/nv-linux.h 2022-04-12 22:24:58.508053548 +0200
    @@ -24,6 +24,8 @@
    #ifndef _NV_LINUX_H_
    #define _NV_LINUX_H_

    +#warning Do not buy NVIDIA for your next GPU!
    +#include
    #include “nvstatus.h”
    #include “nv.h”
    #include “nv-ioctl-numa.h”
    @@ -984,8 +986,13 @@ static inline pgprot_t nv_adjust_pgprot(
    * When AMD memory encryption is enabled, device memory mappings with the
    * C-bit set read as 0xFF, so ensure the bit is cleared for user mappings.
    */
    +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) && defined(_ASM_X86_PGTABLE_H))
    + // Rel. commit “x86/coco: Add API to handle encryption mask” (Kirill A. Shutemov, 22 Feb 2022)
    + prot = __pgprot(__sme_clr(pgprot_val(prot)));
    +#else
    prot = pgprot_decrypted(prot);
    #endif
    +#endif
    return prot;
    }

    diff -rupN nvidia-510.60.02/nvidia/linux_nvswitch.c nvidia-510.60.02p/nvidia/linux_nvswitch.c
    — nvidia-510.60.02/nvidia/linux_nvswitch.c 2022-03-16 13:00:50.000000000 +0100
    +++ nvidia-510.60.02p/nvidia/linux_nvswitch.c 2022-04-12 22:24:58.512053558 +0200
    @@ -2140,11 +2140,11 @@ _nvswitch_to_pci_dma_direction
    )
    {
    if (direction == NVSWITCH_DMA_DIR_TO_SYSMEM)
    – return PCI_DMA_FROMDEVICE;
    + return DMA_FROM_DEVICE;
    else if (direction == NVSWITCH_DMA_DIR_FROM_SYSMEM)
    – return PCI_DMA_TODEVICE;
    + return DMA_TO_DEVICE;
    else
    – return PCI_DMA_BIDIRECTIONAL;
    + return DMA_BIDIRECTIONAL;
    }

    NvlStatus
    @@ -2165,9 +2165,9 @@ nvswitch_os_map_dma_region

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – *dma_handle = (NvU64)pci_map_single(pdev, cpu_addr, size, dma_dir);
    + *dma_handle = (NvU64) dma_map_single(&pdev->dev, cpu_addr, size, dma_dir);

    – if (pci_dma_mapping_error(pdev, *dma_handle))
    + if (dma_mapping_error(&pdev->dev, *dma_handle))
    {
    pr_err(“nvidia-nvswitch: unable to create PCI DMA mapping\n”);
    return -NVL_ERR_GENERIC;
    @@ -2194,7 +2194,7 @@ nvswitch_os_unmap_dma_region

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_unmap_single(pdev, dma_handle, size, dma_dir);
    + dma_unmap_single(&pdev->dev, dma_handle, size, dma_dir);

    return NVL_SUCCESS;
    }
    @@ -2211,7 +2211,7 @@ nvswitch_os_set_dma_mask
    if (!pdev)
    return -NVL_BAD_ARGS;

    – if (pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_addr_width)))
    + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_addr_width)))
    return -NVL_ERR_GENERIC;

    return NVL_SUCCESS;
    @@ -2234,7 +2234,7 @@ nvswitch_os_sync_dma_region_for_cpu

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_dma_sync_single_for_cpu(pdev, dma_handle, size, dma_dir);
    + dma_sync_single_for_cpu(&pdev->dev, dma_handle, size, dma_dir);

    return NVL_SUCCESS;
    }
    @@ -2256,7 +2256,7 @@ nvswitch_os_sync_dma_region_for_device

    dma_dir = _nvswitch_to_pci_dma_direction(direction);

    – pci_dma_sync_single_for_device(pdev, dma_handle, size, dma_dir);
    + dma_sync_single_for_device(&pdev->dev, dma_handle, size, dma_dir);

    return NVL_SUCCESS;
    }
    diff -rupN nvidia-510.60.02/nvidia/nv-acpi.c nvidia-510.60.02p/nvidia/nv-acpi.c
    — nvidia-510.60.02/nvidia/nv-acpi.c 2022-03-16 13:01:07.000000000 +0100
    +++ nvidia-510.60.02p/nvidia/nv-acpi.c 2022-04-12 22:24:58.512053558 +0200
    @@ -29,7 +29,8 @@

    #include

    -#if defined(NV_LINUX_ACPI_EVENTS_SUPPORTED)
    +#include
    +#if defined(NV_LINUX_ACPI_EVENTS_SUPPORTED) && (LINUX_VERSION_CODE tce_bypass_enabled)
    {
    – pci_set_dma_mask(nvl->pci_dev, new_mask);
    + dma_set_mask(&nvl->pci_dev->dev, new_mask);
    /* Certain kernels have a bug which causes pci_set_consistent_dma_mask
    * to call GPL sme_active symbol, this bug has already been fixed in a
    * minor release update but detect the failure scenario here to prevent
    * an installation regression */
    #if !NV_IS_EXPORT_SYMBOL_GPL_sme_active
    – pci_set_consistent_dma_mask(nvl->pci_dev, new_mask);
    + dma_set_coherent_mask(&nvl->pci_dev->dev, new_mask);
    #endif
    }
    }
    @@ -4514,19 +4514,19 @@ NvU64 NV_API_CALL nv_get_dma_start_addre
    * as the starting address for all DMA mappings.
    */
    saved_dma_mask = pci_dev->dma_mask;
    – if (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(64)) != 0)
    + if (dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(64)) != 0)
    {
    goto done;
    }

    – dma_addr = pci_map_single(pci_dev, NULL, 1, DMA_BIDIRECTIONAL);
    – if (pci_dma_mapping_error(pci_dev, dma_addr))
    + dma_addr = dma_map_single(&pci_dev->dev, NULL, 1, DMA_BIDIRECTIONAL);
    + if (dma_mapping_error(&pci_dev->dev, dma_addr))
    {
    – pci_set_dma_mask(pci_dev, saved_dma_mask);
    + dma_set_mask(&pci_dev->dev, saved_dma_mask);
    goto done;
    }

    – pci_unmap_single(pci_dev, dma_addr, 1, DMA_BIDIRECTIONAL);
    + dma_unmap_single(&pci_dev->dev, dma_addr, 1, DMA_BIDIRECTIONAL);

    /*
    * From IBM: “For IODA2, native DMA bypass or KVM TCE-based implementation
    @@ -4558,7 +4558,7 @@ NvU64 NV_API_CALL nv_get_dma_start_addre
    */
    nv_printf(NV_DBG_WARNINGS,
    “NVRM: DMA window limited by platform\n”);
    – pci_set_dma_mask(pci_dev, saved_dma_mask);
    + dma_set_mask(&pci_dev->dev, saved_dma_mask);
    goto done;
    }
    else if ((dma_addr & saved_dma_mask) != 0)
    @@ -4577,7 +4577,7 @@ NvU64 NV_API_CALL nv_get_dma_start_addre
    */
    nv_printf(NV_DBG_WARNINGS,
    “NVRM: DMA window limited by memory size\n”);
    – pci_set_dma_mask(pci_dev, saved_dma_mask);
    + dma_set_mask(&pci_dev->dev, saved_dma_mask);
    goto done;
    }
    }
    diff -rupN nvidia-510.60.02/nvidia-drm/nvidia-drm-drv.c nvidia-510.60.02p/nvidia-drm/nvidia-drm-drv.c
    — nvidia-510.60.02/nvidia-drm/nvidia-drm-drv.c 2022-03-16 12:15:44.000000000 +0100
    +++ nvidia-510.60.02p/nvidia-drm/nvidia-drm-drv.c 2022-04-12 22:24:58.508053548 +0200
    @@ -20,6 +20,7 @@
    * DEALINGS IN THE SOFTWARE.
    */

    +#include
    #include “nvidia-drm-conftest.h” /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */

    #include “nvidia-drm-priv.h”
    @@ -254,8 +255,11 @@ nv_drm_init_mode_config(struct nv_drm_de
    #if defined(NV_DRM_FORMAT_MODIFIERS_PRESENT)
    /* Allow clients to define framebuffer layouts using DRM format modifiers */

    +#if (LINUX_VERSION_CODE mode_config.allow_fb_modifiers = true;
    #endif
    +#endif

    /* Initialize output polling support */

    diff -rupN nvidia-510.60.02/nvidia-drm/nvidia-drm-gem.c nvidia-510.60.02p/nvidia-drm/nvidia-drm-gem.c
    — nvidia-510.60.02/nvidia-drm/nvidia-drm-gem.c 2022-03-16 12:15:44.000000000 +0100
    +++ nvidia-510.60.02p/nvidia-drm/nvidia-drm-gem.c 2022-04-12 22:24:58.508053548 +0200
    @@ -51,6 +51,12 @@

    #include “nv-mm.h”

    +#include
    +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
    +// Rel. commit “dma-buf-map: Rename to iosys-map” (Lucas De Marchi, 4 Feb 2022)
    +#define dma_buf_map iosys_map
    +#endif
    +
    void nv_drm_gem_free(struct drm_gem_object *gem)
    {
    struct nv_drm_gem_object *nv_gem = to_nv_gem_object(gem);

  10. Hi,

    All the above are now fixed in NVIDIA-Linux-x86_64-510.68.02.run .. I’ve tested on Linux-5.18.0-rc4. All good.

    Jeff

    • Hi Jeff,

      Do you mean error like this also got fixed ? After updated your NVIDIA-driver to version 510.68.02 ?
      My Linux kernel is 5.17.14-300 and NVIDIA driver is 510.60.02. Good news to me 🙂

      “`
      NVIDIA-Linux-x86_64-510.60.02/kernel/nvidia/nv.c:2774:9: error: implicit declaration of function ‘pci_set_consistent_dma_mask’ [-Werror=implicit-function-declaration]
      2774 | pci_set_consistent_dma_mask(nvl->pci_dev, new_mask);
      “`

      Thanks

      • Issue solved as what Jeff said: update my nvidia driver first.
        The error occurs when linux kernel version and nvidia dkms version mismatch each other

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.