Re: Build failure for graphics/drm-515-kmod in CURRENT

From: Michael Butler <imb_at_protected-networks.net>
Date: Thu, 14 Mar 2024 14:27:49 UTC
While I'm not using 515, I needed something like this patch to build 
drm-61 after the BUS_RELEASE_RESOURCE changes in commit 9dbf5b0:
--- drivers/gpu/drm/i915/intel_freebsd.c.orig   2024-02-24 10:15:24 UTC
+++ drivers/gpu/drm/i915/intel_freebsd.c
@@ -74,9 +74,9 @@ bsd_intel_pci_bus_release_mem(device_t dev, int rid, v

         vga = device_get_parent(dev);
         BUS_DEACTIVATE_RESOURCE(device_get_parent(vga),
-           dev, SYS_RES_MEMORY, rid, res);
+           dev, res);
         BUS_RELEASE_RESOURCE(device_get_parent(vga),
-           dev, SYS_RES_MEMORY, rid, res);
+           dev, res);
  }

  bool


On 3/14/24 09:49, David Wolfskill wrote:
> This is on my laptop, during a source-based update from
> main-n268772-906521f8176b to main-n268800-6a6ec90681cf, in the "make
> buildkernel" phase, as a result of:
>
> g1-70(15.0-C)[3] grep PORT /etc/src.conf
> PORTS_MODULES+=x11/nvidia-driver-390
> PORTS_MODULES+=graphics/drm-515-kmod
>
> (which has been there at least since 06 December, while tracking head
> daily).
>
> My ports tree is at main-n655899-de3ac29011f1; all installed ports were
> previously updated to that point (while the laptop was running
> stable/14-n266980-9a2b4665958e, from a different slice).  /usr/local is
> the same file system regardless of which slice gets booted.
>
> The complete build typescript may be found at
> https://www.catwhisker.org/~david/FreeBSD/ports/drm-515-kmod/
>
> The fatal whine appears (to me) to be:
>
> ...
> --- i915_irq.o ---
> cc  -O2 -pipe -fno-strict-aliasing -DLINUXKPI_VERSION=51501 '-DKBUILD_MODNAME="i915kms"' '-DLINUXKPI_PARAM_PREFIX=i915_' -DDRM_SYSCTL_PARAM_PREFIX=_i915kms -DCONFIG_DRM_AMDGPU_CIK -DCONFIG_DRM_AMDGPU_SI -DCONFIG_DRM_AMD_DC -DCONFIG_DRM_AMD_DC_SI -DCONFIG_AMD_PMC -DCONFIG_DRM_I915_FORCE_PROBE='"*"' -DCONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -DCONFIG_DRM_I915_CAPTURE_ERROR -DCONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -DCONFIG_DRM_I915_STOP_TIMEOUT=100 -DCONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -DCONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -DCONFIG_DRM_I915_TIMESLICE_DURATION=1 -DCONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -DCONFIG_DRM_I915_FENCE_TIMEOUT=10000 -DCONFIG_DRM_MIPI_DSI -DCONFIG_DRM_PANEL_ORIENTATION_QUIRKS -DCONFIG_DRM_FBDEV_EMULATION -DCONFIG_DRM_FBDEV_OVERALLOC=100 -DCONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG -DCONFIG_BACKLIGHT_CLASS_DEVICE -DCONFIG_DEBUG_FS -DCONFIG_DMI -DCONFIG_FB -DCONFIG_MTRR -DCONFIG_PCI -DCONFIG_PM -DCONFIG_PM_SLEEP -DCONFIG_SMP -DCONFIG_SUSPEND -DCONFIG_ACPI -DCONFIG_ACPI_SLEEP -DCONFIG_X86 -DCONFIG_X86_PAT -DCONFIG_64BIT -DCONFIG_AS_MOVNTDQA -DCONFIG_COMPAT -DCONFIG_X86_64 -DCONFIG_DRM_AMD_DC_DCN -DCONFIG_DRM_AMD_DC_DCN3_0 -DCONFIG_DRM_AMD_DC_DCN3_01 -DCONFIG_DRM_AMD_DC_DCN3_02 -DCONFIG_DRM_AMD_DC_DCN3_1  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/linuxkpi/gplv2/include -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/linuxkpi/bsd/include -I/usr/src/sys/compat/linuxkpi/common/include -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/linuxkpi/dummy/include -I/usr/src/sys/compat/linuxkpi/dummy/include -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/include -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/include/drm -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/include/uapi -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/drivers/gpu -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/drivers/gpu/drm/i915 -I/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/drivers/gpu/drm/i915/display -include /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/obj/common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/i915/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.i915_irq.o -MTi915_irq.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 -Wno-pointer-arith -Wno-format -Wno-cast-qual -Wno-unused-but-set-variable  -mno-aes -mno-avx  -std=gnu99 -c /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/drivers/gpu/drm/i915/i915_irq.c -o i915_irq.o
> --- i915_drv.o ---
> /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/drivers/gpu/drm/i915/i915_drv.c:238:50: error: too many arguments to function call, expected 3, have 5
>    237 |                 BUS_DEACTIVATE_RESOURCE(device_get_parent(vga),
>        |                 ~~~~~~~~~~~~~~~~~~~~~~~
>    238 |                     dev_priv->drm.dev->bsddev, SYS_RES_MEMORY, dev_priv->mch_res_rid,
>        |                                                                ^~~~~~~~~~~~~~~~~~~~~~
>    239 |                     dev_priv->mch_res.bsd_res);
>        |                     ~~~~~~~~~~~~~~~~~~~~~~~~~
> ./bus_if.h:432:21: note: 'BUS_DEACTIVATE_RESOURCE' declared here
>    432 | static __inline int BUS_DEACTIVATE_RESOURCE(device_t _dev, device_t _child,
>        |                     ^                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    433 |                                             struct resource *_r)
>        |                                             ~~~~~~~~~~~~~~~~~~~
> /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/drivers/gpu/drm/i915/i915_drv.c:241:50: error: too many arguments to function call, expected 3, have 5
>    240 |                 BUS_RELEASE_RESOURCE(device_get_parent(vga),
>        |                 ~~~~~~~~~~~~~~~~~~~~
>    241 |                     dev_priv->drm.dev->bsddev, SYS_RES_MEMORY, dev_priv->mch_res_rid,
>        |                                                                ^~~~~~~~~~~~~~~~~~~~~~
>    242 |                     dev_priv->mch_res.bsd_res);
>        |                     ~~~~~~~~~~~~~~~~~~~~~~~~~
> ./bus_if.h:520:21: note: 'BUS_RELEASE_RESOURCE' declared here
>    520 | static __inline int BUS_RELEASE_RESOURCE(device_t _dev, device_t _child,
>        |                     ^                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    521 |                                          struct resource *_res)
>        |                                          ~~~~~~~~~~~~~~~~~~~~~
> 2 errors generated.
> *** [i915_drv.o] Error code 1
>
> make[1]: stopped in /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/i915
> make[1]: 1 error
>
> make[1]: stopped in /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4/i915
>
> make: stopped in /common/S4/obj/usr/src/amd64.amd64/sys/CANARY/common/ports/graphics/drm-515-kmod/work/drm-kmod-drm_v5.15.118_4
> ===> Compilation failed unexpectedly.
> Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
> the maintainer.
> *** Error code 1
>
> Stop.
> make[4]: stopped in /common/ports/graphics/drm-515-kmod
> *** Error code 1
>
> Stop.
> make[3]: stopped in /common/ports/graphics/drm-515-kmod
> *** [all] Error code 1
>
> make[2]: stopped in /common/S4/obj/usr/src/amd64.amd64/sys/CANARY
> .ERROR_TARGET='all'
> .ERROR_META_FILE=''
> .MAKE.LEVEL='2'
> MAKEFILE=''
> .MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose curdirOk=yes'
> _ERROR_CMD='.PHONY'
> .CURDIR='/common/S4/obj/usr/src/amd64.amd64/sys/CANARY'
> .MAKE='make'
> .OBJDIR='/common/S4/obj/usr/src/amd64.amd64/sys/CANARY'
> .TARGETS='all'
> CPUTYPE=''
> DESTDIR=''
> LD_LIBRARY_PATH=''
> MACHINE='amd64'
> MACHINE_ARCH='amd64'
> MACHINE_CPUARCH='amd64'
> MAKEOBJDIRPREFIX=''
> MAKESYSPATH='/usr/src/share/mk'
> MAKE_VERSION='20240108'
>
>
> make[2]: stopped in /common/S4/obj/usr/src/amd64.amd64/sys/CANARY
> .ERROR_TARGET='all'
> .ERROR_META_FILE=''
> .MAKE.LEVEL='2'
> MAKEFILE=''
> .MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose curdirOk=yes'
> _ERROR_CMD='.PHONY'
> .CURDIR='/common/S4/obj/usr/src/amd64.amd64/sys/CANARY'
> .MAKE='make'
> .OBJDIR='/common/S4/obj/usr/src/amd64.amd64/sys/CANARY'
> .TARGETS='all'
> CPUTYPE=''
> DESTDIR=''
> LD_LIBRARY_PATH=''
> MACHINE='amd64'
> MACHINE_ARCH='amd64'
> MACHINE_CPUARCH='amd64'
> MAKEOBJDIRPREFIX=''
> MAKESYSPATH='/usr/src/share/mk'
> MAKE_VERSION='20240108'
> PATH='/common/S4/obj/usr/src/amd64.amd64/tmp/bin:/common/S4/obj/usr/src/amd64.amd64/tmp/usr/sbin:/common/S4/obj/usr/src/amd64.amd64/tmp/usr/bin:/common/S4/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/common/S4/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/common/S4/obj/usr/src/amd64.amd64/tmp/legacy/bin:/common/S4/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin'
> SRCTOP='/usr/src'
> OBJTOP='/usr/src'
> .MAKE.MAKEFILES='/usr/src/share/mk/sys.mk /usr/src/share/mk/local.sys.env.mk /usr/src/share/mk/src.sys.env.mk /etc/src-env.conf /usr/src/share/mk/bsd.mkopt.mk /usr/src/share/mk/src.sys.obj.mk /usr/src/share/mk/local.sys.machine.mk /usr/src/share/mk/meta.sys.mk /usr/src/share/mk/local.meta.sys.env.mk /usr/src/share/mk/auto.obj.mk /usr/src/share/mk/bsd.suffixes.mk /etc/make.conf /usr/src/share/mk/local.sys.mk /usr/src/share/mk/src.sys.mk /etc/src.conf Makefile /usr/src/sys/conf/kern.pre.mk /usr/src/share/mk/bsd.own.mk /usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk /usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.endian.mk /usr/src/share/mk/bsd.linker.mk /usr/src/sys/conf/kern.opts.mk /usr/src/sys/conf/kern.post.mk /usr/src/sys/conf/kern.mk /dev/null'
> .PATH='. /common/S4/obj/usr/src/amd64.amd64/sys/CANARY'
>        808.12 real      5840.78 user       315.27 sys
>
> make[1]: stopped in /usr/src
>
>
> Any suggestions?
>
> Thanks!
>
> Peace,
> david