Page MenuHomeFreeBSD

devmatch ugly hack
Needs ReviewPublic

Authored by johalun0_gmail.com on Aug 10 2018, 5:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 12:57 PM
Unknown Object (File)
Dec 20 2023, 2:40 AM
Unknown Object (File)
Dec 13 2023, 2:43 AM
Unknown Object (File)
Oct 16 2023, 7:49 AM
Unknown Object (File)
Aug 5 2023, 7:46 AM
Unknown Object (File)
Jul 2 2023, 3:56 PM
Unknown Object (File)
Jun 24 2023, 4:35 AM
Unknown Object (File)
May 10 2023, 8:35 AM
Subscribers
None

Details

Reviewers
imp
hselasky
Summary

This is an ugly hack to get devmatch to match drm graphics drivers built out of tree. To make this work I had to work around the following issues

Problem 1: devmatch only uses the first linker.hints it can find.
Fix: With this patch, devmatch now iterates through all paths found in kern.module_path and parses the linker.hints it finds.

Problem 2: devmatch can't match anything on the vgapci bus since there is already a driver attached.
Fix: Ignore "vgapci" and use "pci" and not "vgapci" bus in MODULE_PNP_INFO

I'm not sure of the correct way to solve these issues so I leave that to the developer(s) of devmatch.

Another issue of course is if there the same module is located in for example /boot/kernel and /boot/modules. May I suggest priority order as in listed kern.module_path, except for letting /boot/kernel have the lowest priority (currently it is inserted before any paths set in loader.conf)?

The patch to linuxkpi and i915 driver is here: (WIP for reference)
https://github.com/FreeBSDDesktop/kms-drm/commit/9a0b7d0cebc2f6acf4f05ba6ae4b0a191a16afee

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Ping is this patch still relevant?

Ping is this patch still relevant?

I don't think anything has been done to fix these issues upstream. @imp would know.

I have no clue what this is trying to fix.
I am aware of a bug that we need to read all the files in the path (which part of this does), but the special case for vgapci0 seems unwarranted and dangerous.
So there's some relevance to this, but I have some concerns.

In D16660#376945, @imp wrote:

I have no clue what this is trying to fix.
I am aware of a bug that we need to read all the files in the path (which part of this does), but the special case for vgapci0 seems unwarranted and dangerous.
So there's some relevance to this, but I have some concerns.

Yes, as the title and description says, it's an ugly hack (that highlights the issues) and not a proposed solution.

So why the special case for vgapci0?

In D16660#376951, @imp wrote:

So why the special case for vgapci0?

As I wrote in the description above, devmatch won't match it since a driver (vgapci) is already attached to the same PCI ID as the drm driver is looking for. I don't know the proper way to solve this but this hack made it work for me (even though it is the wrong way to do it).