WIP:
There are some errors in driver.c and mem_mgmt_utils.c with linux 6.6.7 that I fixed. When I have all errors fixed in drivers, and kernel working I will share it.
errors: Error in driver.c: The error struct class has no member named ‘owner’ suggests that the class structure in the kernel you are compiling against does not have an owner field. This field was removed in recent Linux kernel versions. To resolve this, you can simply remove the line setting the owner field, as it’s no longer needed.
So, in your driver.c file, you can comment out or remove the line: FIX:
hwpm_linux->class.owner = THIS_MODULE;
Error in mem_mgmt_utils.c: The error related to get_user_pages function indicates a change in the API of this function in newer kernel versions. The newer get_user_pages function has a reduced number of arguments. You’ll need to update the usage of get_user_pages to match the current kernel API. FIX:
/* ... [previous code] ... */
/* Calculate the number of pages */
alist_buf_size = tegra_hwpm_safe_add_u64(offset, alist_buf_size);
alist_buf_size = tegra_hwpm_safe_sub_u64(
tegra_hwpm_safe_add_u64(alist_buf_size, PAGE_SIZE), 1ULL);
hwpm->alist_map->num_pages = alist_buf_size / PAGE_SIZE;
/* Allocate memory for the pages array */
hwpm->alist_map->pages = (struct page **)tegra_hwpm_kcalloc(
hwpm, hwpm->alist_map->num_pages, sizeof(struct page *));
if (!hwpm->alist_map->pages) {
tegra_hwpm_err(hwpm, "Couldn't allocate memory for pages array");
err = -ENOMEM;
goto fail;
}
/* Set up get_user_pages call */
unsigned int gup_flags = 0; // Modify as needed based on your use case
pinned_pages = get_user_pages(user_va & PAGE_MASK, hwpm->alist_map->num_pages, gup_flags, hwpm->alist_map->pages);
if (pinned_pages != hwpm->alist_map->num_pages) {
tegra_hwpm_err(hwpm, "Requested %llu pages / Got %ld pages",
hwpm->alist_map->num_pages, pinned_pages);
err = -ENOMEM;
goto fail;
}
/* ... [rest of the function] ... */
WIP:
error oot driver:
vm_flags Assignment Error:
The error assignment of read-only member ‘vm_flags’ suggests that the code is trying to modify a read-only structure member. Recent kernel versions may have made vm_flags read-only to prevent direct modification.
Solution: You might need to modify the driver code to use appropriate kernel APIs or mechanisms to achieve the desired functionality without directly modifying vm_flags.
This error suggests that the function pci_disable_pcie_error_reporting is not available or declared in the current kernel headers.
Solution: Check if this function is available in your kernel version. If not, you may need to update the driver code to use an alternative method or conditional compilation.
iommu_map Function Signature Mismatch:
The iommu_map function’s signature has changed in recent kernel versions, and your driver code seems to be using an outdated signature.
Solution: Update the calls to iommu_map in the driver code to match the signature in your kernel version. Check the iommu.h header file for the correct signature.
register_shrinker Signature Mismatch:
Similar to iommu_map, it seems that register_shrinker’s signature in your driver does not match that in the kernel.
Solution: Update the register_shrinker call in the driver code to match the kernel’s expected signature.
I fixed errors and more errors… now is imposible to update easily… I fixed more than 20 errors compilation and still I obtain. The code is outdated, needs to be upgraded for current kernels(6.6.7 in my case)
So I’m sticking with the version that jetpack 6 provides me.
My last error:
The compilation error you're encountering in the `ioctl_ctrl.c`
file within the NVIDIA GPU drivers (`nvgpu` ) seems to be related
to the use of the `mmap_write_trylock` function.
This function is not available or not declared in your environment,
leading to an implicit declaration warning,
which is treated as an error due to the `-Werror` flag.
Build errors with the latest Linux kernels are common and we are continuously working to fix these errors. However, there will always be a lag between new Linux kernels being released and the updates to the NVIDIA drivers being rolled out. The good news is that we have been working to fix the errors you encountered with v6.6 (and later kernels) and the latest drivers are now available on public git repositories.
It is recommended that you use the ‘source_sync.sh’ script to sync these. The Makefile that is provided for building the drivers requires that they are placed in the appropriate location because there are some interdependencies (headers and symbols) between these repositories. Also there is a soft-link that the source_sync.sh script creates between the nvethernetrm and linux-nv-oot repositories.
Correct. The kernel sources that are downloaded is the v5.15 kernel that Jet Pack 6 uses by default.
@jonathanh If i don’t put tag, is it synchronize with master from your repositories? That means WIP code?
I mean because with new tag either I can’t compile
You need to enable CONFIG_ARCH_HAS_PMEM_API in your kernel config and rebuild your kernel. This is required.
Do not use the master branch for the drivers. This does not point to the latest and the master branch is not updated. You need to use the latest tag that is populated.
Are you using the Makefile shipped with the JetPack BSP to build these? This Makefile is located under …
Linux_for_Tegra/source/Makefile
Prior to building the drivers this Makefile runs a script called conftest.sh to detect the versions of the APIs in the kernel. This then creates the necessary definitions for compiling the drivers. Otherwise, yes the build will most likely fail.