Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

From: Andi Kleen
Date: Thu Sep 30 2021 - 13:17:24 EST



The "it" that I referred to is the claim that no driver should be
touching hardware in their module init call. Andi seems to think
such drivers are worth working around with a special remap API.
Andi is wrong.

While overall it's a small percentage of the total, there are still quite a few drivers that do touch hardware in init functions. Sometimes for good reasons -- they need to do some extra probing to discover something that is not enumerated -- sometimes just because it's very old legacy code that predates the modern driver model.

The legacy drivers could be fixed, but nobody really wants to touch them anymore and they're impossible to test.

The drivers that probe something that is not enumerated in a standard way have no choice, it cannot be implemented in a different way.

So instead we're using a "firewall" the prevents these drivers from doing bad things by not allowing ioremap access unless opted in, and also do some filtering on the IO ports The device filter is still the primary mechanism, the ioremap filtering is just belts and suspenders for those odd cases.

If you want we can send an exact list, we did some analysis using a patched smatch tool.

-Andi