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)
Tue, Oct 22, 5:38 PM
Unknown Object (File)
Oct 9 2024, 6:49 PM
Unknown Object (File)
Sep 16 2024, 7:17 AM
Unknown Object (File)
Sep 8 2024, 10:21 AM
Unknown Object (File)
Sep 8 2024, 4:26 AM
Unknown Object (File)
Sep 5 2024, 2:22 PM
Unknown Object (File)
Aug 29 2024, 3:35 AM
Unknown Object (File)
Aug 18 2024, 11:30 PM
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).