Bug 266561 - x11/nvidia-driver: compiler error: nvidia_os.c:283:19: error: incompatible integer to pointer conversion
Summary: x11/nvidia-driver: compiler error: nvidia_os.c:283:19: error: incompatible in...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Alexey Dokuchaev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-23 06:39 UTC by O. Hartmann
Modified: 2022-09-26 10:04 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (danfe)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2022-09-23 06:39:55 UTC
OS: recent 14-CURRENT (after commit 7ae99f80b6661760c5de3edd330b279f04b092a2)
driver: nvidia-driver-510.60.02

error:
[...]
cc  -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"510.60.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-510.60.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_os_registry.o -MTnvidia_os_registry.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wnested-externs -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=iso9899:1999 -c nvidia_os_registry.c -o nvidia_os_registry.o
--- nvidia_pci.o ---
--- nvidia_os.o ---
nvidia_os.c:283:19: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
    pmap_unmapdev((vm_offset_t)address, size);
                  ^~~~~~~~~~~~~~~~~~~~
./machine/pmap.h:511:26: note: passing argument to parameter here
void    pmap_unmapdev(void *, vm_size_t);
Comment 1 Tomoaki AOKI 2022-09-23 08:33:12 UTC
This should be because of 2 commits on git src main below.

  [1] commit	7ae99f80b6661760c5de3edd330b279f04b092a2
      pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.

  [2] commit	f49fd63a6a130ae464cdc7756e6f7d0d747c82c4
      kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.


These have a dedicated bump with the commit below. So we can sanely use the __FreeBSD_version 1400070.

  [3] commit	6bddde307e21eba297ac3f3e534b4cf3be81dfe2
      Bump __FreeBSD_version for pmap_unmap*() and kmem_*() API changes.


Unfortunately, I have not enough workable time to investigate fix now.


[1] https://cgit.freebsd.org/src/commit/?id=7ae99f80b6661760c5de3edd330b279f04b092a2

[2] https://cgit.freebsd.org/src/commit/?id=f49fd63a6a130ae464cdc7756e6f7d0d747c82c4

[3] https://cgit.freebsd.org/src/commit/?id=6bddde307e21eba297ac3f3e534b4cf3be81dfe2
Comment 2 david 2022-09-23 13:08:20 UTC
Also affects x11/nvidia-driver-390:
cc  -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"390.151\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O2 -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -Wno-sign-compare -Wno-format-extra-args -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 /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/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_os.o -MTnvidia_os.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wnested-externs -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=iso9899:1999 -c nvidia_os.c -o nvidia_os.o
nvidia_os.c:280:19: error: incompatible integer to pointer conversion passing 'vm_offset_t' (aka 'unsigned long') to parameter of type 'void *' [-Werror,-Wint-conversion]
    pmap_unmapdev((vm_offset_t)address, size);
                  ^~~~~~~~~~~~~~~~~~~~
./machine/pmap.h:511:26: note: passing argument to parameter here
void    pmap_unmapdev(void *, vm_size_t);
                            ^
1 error generated.
*** Error code 1

Stop.
make[7]: stopped in /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/x11/nvidia-driver-390/work/NVIDIA-FreeBSD-x86_64-390.151/src/nvidia
*** Error code 1


[This was during source update from main-n258133-09ee0fc023c0 to main-n258156-f968cb140fcf with
PORTS_MODULES+=x11/nvidia-driver-390
in /etc/src.conf.]
Comment 3 John Baldwin freebsd_committer freebsd_triage 2022-09-23 16:34:09 UTC
I uploaded a review already for this immediately after the source commit that is waiting on maintainer approval: https://reviews.freebsd.org/D36671
Comment 4 Tomoaki AOKI 2022-09-24 01:26:06 UTC
(In reply to John Baldwin from comment #3)

Thanks! The patch on Phab D36671 you pointed worked fine for me.
Tried both on main at git 00d8a28f19b21ce2955c0cf24a040824ec506da5, amd64 and stable/13 (just to be sure nothing broken there) at 42538fde45d3d768be41b9f89777e0c8b278be20, amd64.

Both are on exactly the same hardware (installed on different physical drive on the same PC).

Tested only for x11/nvidia-driver only, but should work fine for all other x11/nvidia-driver-* ports, as they all are slave ports of x11/nvidia-driver that separately sets DISTVERSION, PORTREVISION and PKGNAMESUFFIX.
Comment 5 O. Hartmann 2022-09-24 06:08:17 UTC
The patch works for me too, but as the former comment also states, I only tested x11/nvidia-driver for nvidia-driver-510.60.02 and x11/nvidia-driver-515.76 (latest from mVidia for FreeBSD). It works so far.
Comment 6 Nuno Teixeira freebsd_committer 2022-09-26 10:04:04 UTC
Just for curiosity, do we need to rebuild nvidia-drivers when tracking current?

For a long time that I only update nvidia pkg...

I will wait for review to fix current build and start using:
---
SYSDIR=path/to/src/sys
PORTS_MODULES=graphics/drm-kmod x11/nvidia-driver
---
this way I rebuild nvidia (dedicated) and intel (onboard).

Thanks