[PATCH] agp/amd64: Only try host-bridges when agp_try_unsupported is set
Hans de Goede
hansg at kernel.org
Wed Jun 25 13:20:15 UTC 2025
Hi Alex,
On 25-Jun-25 3:11 PM, Alex Deucher wrote:
> + Suravee and Vasant
>
> On Wed, Jun 25, 2025 at 7:24 AM Hans de Goede <hansg at kernel.org> wrote:
>>
>> On modern AMD Ryzen systems the IOMMU code initializes early on adding
>> resources to the "00:00.2 IOMMU" PCI-device without binding a driver to
>> it (because it needs to run early).
>>
>> Subsequently trying to bind a driver to it will then fail with -EBUSY
>> because of this check in drivers/base/dd.c: really_probe():
>>
>> dev_dbg(dev, "bus: '%s': %s: probing driver %s with device\n",
>> drv->bus->name, __func__, drv->name);
>> if (!list_empty(&dev->devres_head)) {
>> dev_crit(dev, "Resources present before probing\n");
>> ret = -EBUSY;
>> goto done;
>> }
>>
>> Notice the dev_crit() logging here, this is a problem because anything
>> logged at critical or higher level will actually get logged to the console
>> even when quiet is present breaking flicker free boot and this is happening
>> on most AMD Ryzen systems, e.g. :
>>
>> [ 1.141358] pci 0000:00:00.0: bus: 'pci': really_probe: probing driver agpgart-amd64 with device
>> [ 1.141441] pci 0000:00:00.2: bus: 'pci': really_probe: probing driver agpgart-amd64 with device
>> [ 1.141444] pci 0000:00:00.2: Resources present before probing
>> [ 1.141450] pci 0000:00:01.0: bus: 'pci': really_probe: probing driver agpgart-amd64 with device
>> [ 1.141496] pci 0000:00:02.0: bus: 'pci': really_probe: probing driver agpgart-amd64 with device
>>
>> The real issue here is that the agpgart-amd64 driver is probing all
>> PCI-devices because the match in agp_amd64_pci_promisc_table[] matches all
>> PCI-devices.
>>
>> As can be seen from the class matches in agp_amd64_pci_table[], AGP support
>> is always part of the host-bridge. Change the match in
>> agp_amd64_pci_promisc_table[] to only match on host-bridges, so that
>> the IOMMU will no longer get probed with the agpgart-amd64 driver.
>>
>> This not only fixes the troublesome dev_crit() logging it should also speed
>> up things in general.
>>
>> Signed-off-by: Hans de Goede <hansg at kernel.org>
>> ---
>> Given how old AGP is I would expect the agp_amd64_pci_table[] to be
>> complete and I wonder if maybe we should not change the default of
>> the AMD specific agp_try_unsupported to 0? Note the global non AMD
>> specific agp_try_unsupported_boot flag already defaults to 0.
>
> No objections from me.
Thank you. To be clear with "No objections from me", I guess
you mean no objections from you to changing the default of
agp_try_unsupported to 0, right ?
Note regardless of changing the default (which would be another
patch) I still think it would be good to also have this change.
Regards,
Hans
>> ---
>> drivers/char/agp/amd64-agp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
>> index bf490967241a..3f9f4fa3a3f5 100644
>> --- a/drivers/char/agp/amd64-agp.c
>> +++ b/drivers/char/agp/amd64-agp.c
>> @@ -721,7 +721,7 @@ static const struct pci_device_id agp_amd64_pci_table[] = {
>> MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table);
>>
>> static const struct pci_device_id agp_amd64_pci_promisc_table[] = {
>> - { PCI_DEVICE_CLASS(0, 0) },
>> + { PCI_DEVICE_CLASS((PCI_CLASS_BRIDGE_HOST << 8), ~0) },
>> { }
>> };
>>
>> --
>> 2.49.0
>>
More information about the dri-devel
mailing list