Bug 285069 - x11/nvidia-driver-470: update from 470.161.03 to 470.256.02 or greater
Summary: x11/nvidia-driver-470: update from 470.161.03 to 470.256.02 or greater
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Austin Shafer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-27 18:18 UTC by Graham Perrin
Modified: 2025-04-02 17:04 UTC (History)
2 users (show)

See Also:


Attachments
Patch to upgrade x11/nvidia-driver-470 and x11/linux-nvidia-libs-470 to 470.256.02 (3.02 KB, patch)
2025-03-18 10:00 UTC, Tomoaki AOKI
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin 2025-02-27 18:18:34 UTC
<https://www.freshports.org/x11/nvidia-driver-470/>

<https://www.nvidia.com/en-us/drivers/details/226762/>

> FreeBSD Display Driver – x64 470.256.02 | FreeBSD x64 | NVIDIA

- released June 2024. 

Thanks
Comment 1 Tomoaki AOKI 2025-03-03 13:41:16 UTC
(In reply to Graham Perrin from comment #0)
The required fix doesn't seem to be simple.
First, failing of a patch can be fixed relatively easy (but causes future complexities for maintainance, and possibly more would be needed if other legacy branches need same fix).
But other build failures still remains. Not investigating deeper, but possibly non-trivial (backports or brand-new fix would be needed).

Giving up at least for now, as I'm already working on latest Production Branch of driver (570.124.04).

The fix for failed patch would be as below. But just single part of required fix.
More to be required.

--- a/x11/nvidia-driver/Makefile
+++ b/x11/nvidia-driver/Makefile
@@ -71,7 +71,7 @@
 SUB_PATCHES+=	extra-patch-src-nvidia_dev.c \
 		extra-patch-src-nvidia_pci.c
 .endif
-.if ${NVVERSION} < 530.03002
+.if ${NVVERSION} < 470.25602 || ${NVVERSION} > 480.00000 && ${NVVERSION} < 530.03002
 SUB_PATCHES+=	extra-patch-src-nvidia_subr.c
 .endif
Comment 2 Graham Perrin 2025-03-09 06:40:43 UTC
Thanks, 

(In reply to Tomoaki AOKI from comment #1)

> other build failures 

Is what's below part of the problem? 

<https://forums.developer.nvidia.com/t/-/325448?u=grahamperrin>

> Make install fails for FreeBSD x64 display driver 470.256.02: 
> src/nvidia/opt_global.h file not found

– via <https://matrix.to/#/!DYLObmCRRvLlOSHQkG:matrix-dev.freebsd.org/$zyciPdE8UzRlqVJlemkvSq8PsgNq-m93BkdAE3R4Uwk?via=matrix-dev.freebsd.org&via=matrix.org&via=bsd.cafe>
Comment 3 Tomoaki AOKI 2025-03-09 16:12:20 UTC
(In reply to Graham Perrin from comment #2)
Failure mode after applying the diff in comment #1 is as below.
I should have seen this before, so assuminf I can determine which part is the fix for this by tracking old (closed) PRs, if I can take enough time for this.

Note that diff at Differential Revision D49245 on Phablicator to upgrade to the latest Production Branch of driver 570.124.04 is applied, too (as I'm the submitter).

  https://reviews.freebsd.org/D49245

At /usr/ports/x11/nvidia-driver:

# make DISTVERSION=470.256.02 -DNO_CHECKSUM 
===>  License NVIDIA accepted by the user
===>   nvidia-driver-470.256.02.1402504 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by nvidia-driver-470.256.02.1402504 for building
===>  Extracting for nvidia-driver-470.256.02.1402504
===>  Patching for nvidia-driver-470.256.02.1402504
===>   nvidia-driver-470.256.02.1402504 depends on executable: gsed - found
===>  Applying extra patch /usr/ports/x11/nvidia-driver/files/460-patch-src-nvidia-nvidia_ctl.c
===>  Applying extra patch /usr/ports/x11/nvidia-driver/files/460-patch-src-nvidia-nvidia_linux.c
===>  Applying extra patch /usr/ports/x11/nvidia-driver/files/460-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c
===>  Applying extra patch /usr/ports/x11/nvidia-driver/work/extra-patch-src-Makefile
===>  Applying extra patch /usr/ports/x11/nvidia-driver/work/extra-patch-src-nv-freebsd.h
===>  Applying extra patch /usr/ports/x11/nvidia-driver/work/extra-patch-src-nvidia_dev.c
===>  Applying extra patch /usr/ports/x11/nvidia-driver/work/extra-patch-src-nvidia_pci.c
No such line 404 in input file, ignoring
===>  Applying FreeBSD patches for nvidia-driver-470.256.02.1402504 from /usr/ports/x11/nvidia-driver/files
===>   nvidia-driver-470.256.02.1402504 depends on executable: pkg-config - found
===>   nvidia-driver-470.256.02.1402504 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   nvidia-driver-470.256.02.1402504 depends on file: /usr/local/libdata/pkgconfig/xorg-server.pc - found
===>   nvidia-driver-470.256.02.1402504 depends on file: /usr/local/libdata/pkgconfig/xext.pc - found
===>   nvidia-driver-470.256.02.1402504 depends on shared library: libOpenGL.so - found (/usr/local/lib/libOpenGL.so)
===>   nvidia-driver-470.256.02.1402504 depends on shared library: libnvidia-egl-wayland.so - found (/usr/local/lib/libnvidia-egl-wayland.so)
===>  Configuring for nvidia-driver-470.256.02.1402504
===>  Building for nvidia-driver-470.256.02.1402504

     (snip)

cc  -O2 -pipe -march=haswell -fno-strict-aliasing -DNV_VERSION_STRING=\"470.256.02\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -UDEBUG -U_DEBUG -DNDEBUG -DNV_SPECTRE_V2=1 -DNV_KERNEL_INTERFACE_LAYER -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I../common/inc -include /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02/src/nvidia/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD  -MF.depend.nvidia_subr.o -MTnvidia_subr.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=gnu99 -c nvidia_subr.c -o nvidia_subr.o
--- nvidia_sysctl.o ---
cc  -O2 -pipe -march=haswell -fno-strict-aliasing -DNV_VERSION_STRING=\"470.256.02\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -UDEBUG -U_DEBUG -DNDEBUG -DNV_SPECTRE_V2=1 -DNV_KERNEL_INTERFACE_LAYER -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I../common/inc -include /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02/src/nvidia/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD  -MF.depend.nvidia_sysctl.o -MTnvidia_sysctl.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=gnu99 -c nvidia_sysctl.c -o nvidia_sysctl.o
--- nvlink_freebsd.o ---
cc  -O2 -pipe -march=haswell -fno-strict-aliasing -DNV_VERSION_STRING=\"470.256.02\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -UDEBUG -U_DEBUG -DNDEBUG -DNV_SPECTRE_V2=1 -DNV_KERNEL_INTERFACE_LAYER -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I../common/inc -include /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02/src/nvidia/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD  -MF.depend.nvlink_freebsd.o -MTnvlink_freebsd.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=gnu99 -c nvlink_freebsd.c -o nvlink_freebsd.o
--- nvidia_subr.o ---
nvidia_subr.c:1176:13: error: incompatible integer to pointer conversion assigning to 'void *' from 'vm_offset_t' (aka 'unsigned long') [-Wint-conversion]
 1176 |     address = NV_KMEM_ALLOC_CONTIG(size, flags, 0,
      |             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1177 |             high_addr, PAGE_SIZE, 0, attr);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvidia_subr.c:1308:17: error: incompatible integer to pointer conversion assigning to 'void *' from 'vm_offset_t' (aka 'unsigned long') [-Wint-conversion]
 1308 |         address = NV_KMEM_ALLOC_CONTIG(PAGE_SIZE, flags, 0,
      |                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1309 |                 high_addr, PAGE_SIZE, 0, attr);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
*** [nvidia_subr.o] Error code 1

make[2]: stopped in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02/src/nvidia
1 error

make[2]: stopped in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02/src/nvidia

make[1]: stopped in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02/src

make: stopped in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-470.256.02
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/x11/nvidia-driver
*** Error code 1

Stop.
make: stopped in /usr/ports/x11/nvidia-driver
#
Comment 4 Tomoaki AOKI 2025-03-09 16:46:24 UTC
Additional note.

`make DISTVERSION=470.256.02 -DNO_CHECKSUM` and following `make DISTVERSION=470.256.02 -DNO_CHECKSUM package` in /usr/ports/x11/linux-nvidia-libs succeeded.
So for x11/linux-nvidia-libs-470, updating version string in /usr/x11/linux-nvidia-libs-470/Makefile and updating /usr/ports/x11/linux-nvidia-libs/distinfo seem to be sufficient.

And as graphics/nvidia-drm-*-kmod supports only 550 series and later, they aren't under consideration. (From 550 series of driver, upstream tarball includes Austin's work for nvidia-drm.ko.)
Comment 5 Tomoaki AOKI 2025-03-09 17:15:23 UTC
(In reply to Tomoaki AOKI from comment #3)
I've found the fix (was far more easier than I thought).

But please be patient!
I don't want additional delay for Bug285139 / D49245 to land.
So I'll upload patch after the above hit the tree.
(Created x11/nvidia-driver/Makefile part only, currently.
 Not yet for distinfo and others.)
Comment 6 Tomoaki AOKI 2025-03-18 10:00:18 UTC
Created attachment 258760 [details]
Patch to upgrade x11/nvidia-driver-470 and x11/linux-nvidia-libs-470 to 470.256.02

Patch to upgrade x11/nvidia-driver-470 and x11/linux-nvidia-libs-470 to 470.256.02.
Tested `make` and `make package` only, on stable/14, amd64 at commit 7215aed7974cc4b7d3197ca5e5fcf545d3a28c0f as I myself am not using 470 series of driver anymore.
Comment 7 Graham Perrin 2025-03-22 16:00:24 UTC
Thanks!

Patched, then built with WBINVD=off (the default). Testing with GENERIC on FreeBSD 15.0-CURRENT (I normally use GENERIC-NODEBUG). 

OK so far, no sense of regression. I'll test with WBINVD=on. 

grahamperrin:~ % date ; uptime
Sat 22 Mar 2025 15:45:37 GMT
 3:45p.m.  up 16 mins, 6 users, load averages: 3.51, 3.08, 1.90
grahamperrin:~ % bectl list -c creation | tail -n 2
1500034-026-base             -      -          797M  2025-03-21 03:45
1500034-027-base-ports       NR     /          268G  2025-03-22 13:31
grahamperrin:~ % pkg info -A nvidia-driver-470
nvidia-driver-470-470.256.02.1500034_1:
        FreeBSD_version: 1500034
        build_timestamp: 2025-03-22T13:21:22+00:00
        built_by       : poudriere-git-3.4.99.20250209
        port_checkout_unclean: yes
        port_git_hash  : cbbce9a123d
        ports_top_checkout_unclean: yes
        ports_top_git_hash: 65a29c6fe44
        repo_type      : binary
        repository     : local-current
grahamperrin:~ % pkg version -CU -vRL= | grep -v orphaned
libedit-3.1.20250104,1             >   succeeds remote (remote has 3.1.20240808,1)
libidn2-2.3.8                      >   succeeds remote (remote has 2.3.7)
linux-nvidia-libs-470-470.256.02   >   succeeds remote (remote has 470.161.03)
nvidia-driver-470-470.256.02.1500034_1 >   succeeds remote (remote has 470.161.03.1500034_1)
talloc-2.4.2                       >   succeeds remote (remote has 2.4.1_1)
tevent-0.16.1                      >   succeeds remote (remote has 0.15.0_1)
grahamperrin:~ % grep -e BOOT -e suspend /var/log/messages
Mar 21 08:05:49 mowa219-gjp4-zbook-freebsd acpi[17880]: suspend at 20250321 08:05:49
Mar 21 09:00:07 mowa219-gjp4-zbook-freebsd acpi[20270]: suspend at 20250321 09:00:07
Mar 21 16:29:24 mowa219-gjp4-zbook-freebsd acpi[53805]: suspend at 20250321 16:29:24
Mar 22 07:43:48 mowa219-gjp4-zbook-freebsd acpi[86884]: suspend at 20250322 07:43:48
Mar 22 14:32:12 mowa219-gjp4-zbook-freebsd kernel: ---<<BOOT>>---
Mar 22 15:12:24 mowa219-gjp4-zbook-freebsd acpi[7803]: suspend at 20250322 15:12:24
Mar 22 15:22:32 mowa219-gjp4-zbook-freebsd acpi[9336]: suspend at 20250322 15:22:32
Mar 22 15:25:43 mowa219-gjp4-zbook-freebsd acpi[10201]: suspend at 20250322 15:25:43
Mar 22 15:30:45 mowa219-gjp4-zbook-freebsd kernel: ---<<BOOT>>---
Mar 22 15:30:45 mowa219-gjp4-zbook-freebsd kernel: ---<<BOOT>>---
grahamperrin:~ % zpool status -x
all pools are healthy
grahamperrin:~ % zpool list -v august
NAME                  SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
august                912G   741G   171G        -         -    74%    81%  1.00x    ONLINE  -
  ada1p3.eli          915G   741G   171G        -         -    74%  81.2%      -    ONLINE
cache                    -      -      -        -         -      -      -      -         -
  gpt/cache1-august  14.4G  13.5G   907M        -         -     0%  93.9%      -    ONLINE
  gpt/cache2-august  14.7G   339M  14.3G        -         -     0%  2.25%      -    ONLINE
  gpt/cache3-august  28.8G  27.3G  1.48G        -         -     0%  94.9%      -    ONLINE
grahamperrin:~ % uname -aKU
FreeBSD mowa219-gjp4-zbook-freebsd 15.0-CURRENT FreeBSD 15.0-CURRENT main-n276044-5648c1d6f3b0 GENERIC amd64 1500034 1500034
grahamperrin:~ % kldstat | grep nvidia
12    1 0xffffffff84534000   107330 nvidia-modeset.ko
13    1 0xffffffff84800000  1fe1ef0 nvidia.ko
grahamperrin:~ %
Comment 8 Tomoaki AOKI 2025-03-23 03:24:01 UTC
(In reply to Graham Perrin from comment #7)
Thanks for testing!
I've opened review D49457 for this to be (hopefully) handled earlier by maintainers / committers related with recent nvidia things.
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-04-02 13:54:25 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a569017b31f7c967a25fa22e0ead826361c51a07

commit a569017b31f7c967a25fa22e0ead826361c51a07
Author:     Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
AuthorDate: 2025-04-02 13:46:06 +0000
Commit:     Austin Shafer <ashafer@FreeBSD.org>
CommitDate: 2025-04-02 13:52:33 +0000

    x11/nvidia-driver-470, x11/linux-nvidia-libs-470: Update to 470.256.02

    Requested updating 470 series of legacy version of driver to 470.256.02
    at Bug 285069 - x11/nvidia-driver-470: update from 470.161.03 to
    470.256.02.

    Tested (by myself) make and make package only, on stable/14, amd64 at
    commit 7215aed7974cc4b7d3197ca5e5fcf545d3a28c0f as I myself am not using
    470 series of driver anymore.

    PR:             285069
    Tested by:      grahamperrin
    Reviewed by:    ashafer, kbowling (mentor)
    Differential Revision:  https://reviews.freebsd.org/D49457

 x11/linux-nvidia-libs-470/Makefile | 2 +-
 x11/linux-nvidia-libs/distinfo     | 4 ++--
 x11/nvidia-driver-470/Makefile     | 2 +-
 x11/nvidia-driver/Makefile         | 4 ++--
 x11/nvidia-driver/distinfo         | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)
Comment 10 Graham Perrin freebsd_committer freebsd_triage 2025-04-02 17:04:25 UTC
Thanks!

<https://www.freshports.org/x11/nvidia-driver-470/#history>