freebsd / drm-kmod

drm driver for FreeBSD
155 stars 70 forks source link

Intel Arc A770: Kernel panic on kldload i915kms.ko #315

Open kenrap opened 1 month ago

kenrap commented 1 month ago

Describe the bug From using a drm-kmod build from efd91670c8e0a498f5af9faeb9f3cb4df5f813be, the i915kms driver kernel panics when using an (Acer Predator BiFrost) Intel Arc A770 graphics card. And the kernel panic still persists even when using an Intel onboard GPU with the same graphics card installed.

FreeBSD version

FreeBSD freebsd 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n271909-28294dc92476: Fri Aug 30 08:28:17 PDT 2024     root@freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1500023 1500023

DRM KMOD version My own "custom derived" graphics/drm-66-kmod port with GH_TAGNAME pointing to efd91670c8e0a498f5af9faeb9f3cb4df5f813be.

Also git-clone(1) from linux-firmware and copied all of the i915/dg2_* firmware bins to /boot/modules and renamed them appropriately to match the filename style there.

To Reproduce Boot into the system with either i915kms using kld_list inside /etc/rc.conf or kldload it manually.

Additional context core.txt.0 dump

kenrap commented 1 month ago

My bad, I didn't see about the "Intel DG2 GUC/HUC support" not being implemented yet from PR https://github.com/freebsd/drm-kmod/pull/283.

Closing therefore.

I'm reopening this to have it serve as a milestone issue.

I figured why have it be closed anyway since the issue is still valid and my reporting could be useful?

wulf7 commented 2 weeks ago

dg2_dmc_ver2_08.bin: could not load binary firmware /boot/firmware/dg2_dmc_ver2_08.bin either i915/dg2_dmc_ver2_08.bin: could not load binary firmware /boot/firmware/i915/dg2_dmc_ver2_08.bin either i915_dg2_dmc_ver2_08.bin: could not load binary firmware /boot/firmware/i915_dg2_dmc_ver2_08.bin either i915_dg2_dmc_ver2_08_bin: could not load binary firmware /boot/firmware/i915_dg2_dmc_ver2_08_bin either i915_dg2_dmc_ver2_08_bin: could not load binary firmware /boot/firmware/i915_dg2_dmc_ver2_08_bin either drmn0: could not load firmware image 'i915/dg2_dmc_ver2_08.bin' drmn0: [drm] Failed to load DMC firmware i915/dg2_dmc_ver2_08.bin. Disabling runtime power management. drmn0: [drm] Run pkg install gpu-firmware-kmod to install it

You may start with adding dg2_dmc_ver2_08.bin to firmwares

wulf7 commented 2 weeks ago

But I doubt that it will help

kenrap commented 2 weeks ago

I'll try that out and report back.

I also updated my bug description to be more specific.

kenrap commented 2 weeks ago

But I doubt that it will help

And you're right, it didn't.

After trying a couple more ideas, I spent a good amount of time re-learning how to create a new core dump of the kernel panic with the firmware(s) loaded. Sorry for the delay.

core.txt.1 dump

wulf7 commented 2 weeks ago

After taking a look at the code around faulted line, I have got an impression that it can happen due to missing vmap_pfn() implementation. It is rather easy to check. Just with replacing of return NULL; line in i915_gem_object_map_pfn() function located in drivers/gpu/drm/i915/gem/i915_gem_pages.c file of drm-kmod with panic("oops"); or return ERR_PTR(-ENOSUP);

kenrap commented 2 weeks ago

It seems you're correct about the missing vmap_pfn() implementation. It triggered an "oops" panic by using the panic("oops"); based on your instructions.

What I did was created this custom patch to put into my /usr/ports/graphics/drm-66-kmod/files:

--- drivers/gpu/drm/i915/gem/i915_gem_pages.c.orig
+++ drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -329,7 +329,7 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
 {
 #ifdef __FreeBSD__
        // BSDFIXME: Need vmap_pfn() implementation.
-       return NULL;
+       panic("oops");
 #else
        resource_size_t iomap = obj->mm.region->iomap.base -
                obj->mm.region->region.start;

And rebuilt and reinstalled the package of my derived port. Then I did my usual testing and grabbed a new core dump which shows the "oops" panic. Yay! \o/

core.txt.2