Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
@ 2026-10-15 12:48 Mario Limonciello
  2026-10-15 12:56 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mario Limonciello @ 2026-10-15 12:48 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, simona, bhelgaas,
	mario.limonciello
  Cc: Reza Nikzad Chaleshori, amd-gfx, dri-devel, linux-pci

The soft filter system introduced by commit 11c141672045f ("drm/amdgpu:
Fix VFCT bus number matching with soft filter") has a deficiency that
it won't work when there are multiple GPUs of the exact same model.

As it was introduced specifically to help the case of pci=realloc, gate
it to only run when that's in use.

Fixes: 11c141672045f ("drm/amdgpu: Fix VFCT bus number matching with soft filter")
Reported-by: Reza Nikzad Chaleshori <rezanikzadch@gmail.com>
Closes: https://lore.kernel.org/amd-gfx/20261014080523.186533-1-rezanikzadch@gmail.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 15 ++++++++-------
 drivers/pci/setup-bus.c                  |  5 +++++
 include/linux/pci.h                      |  1 +
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 08ed1eb695586..75af9a59671ae 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -384,12 +384,10 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
  * @vhdr: VFCT image header to check
  *
  * VFCT entries contain the PCI bus number as recorded during BIOS POST.
- * On systems where the kernel renumbers PCI buses (e.g. pci=realloc or
- * resource conflicts), the runtime bus number may differ from the POST
- * value.  Match by device identity (vendor + device + function) and use
- * the bus number as a preference: exact bus match is preferred, but when
- * the bus numbers disagree we accept the entry if the device identity
- * matches.
+ * On systems where the user requested PCI resource reallocation, the
+ * runtime bus number may differ from the POST value. Match by device
+ * identity (vendor + device + function), but only treat the bus number as
+ * a preference when pci=realloc was explicitly requested.
  *
  * Returns: 0 on match, -ENODEV on no match
  */
@@ -409,7 +407,10 @@ static int amdgpu_acpi_vfct_match(struct amdgpu_device *adev,
 	if (vhdr->PCIBus == adev->pdev->bus->number)
 		return 0;
 
-	/* Bus mismatch but device identity matches (PCI renumbering case) */
+	/* Allow bus renumbering only when the user requested pci=realloc. */
+	if (!pci_realloc_enabled_by_user())
+		return -ENODEV;
+
 	dev_notice(adev->dev,
 		   "VFCT bus number mismatch: table %u != runtime %u, matching by device identity (vendor 0x%04x device 0x%04x)\n",
 		   vhdr->PCIBus, adev->pdev->bus->number,
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ed16ef7c26fa7..d9450585082c0 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1799,6 +1799,11 @@ static bool pci_realloc_enabled(enum enable_type enable)
 	return enable >= user_enabled;
 }
 
+bool pci_realloc_enabled_by_user(void)
+{
+	return pci_realloc_enable == user_enabled;
+}
+
 #if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO)
 static int iov_resources_unassigned(struct pci_dev *dev, void *data)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d31a8d107b1ef..844734da9250f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -610,6 +610,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
 }
 
 struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
+bool pci_realloc_enabled_by_user(void);
 
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
  2026-10-15 12:48 [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc Mario Limonciello
@ 2026-10-15 12:56 ` sashiko-bot
  2026-10-15 12:58   ` Mario Limonciello
  2026-10-15 19:48 ` Bjorn Helgaas
  2026-10-19 20:45 ` kernel test robot
  2 siblings, 1 reply; 7+ messages in thread
From: sashiko-bot @ 2026-10-15 12:56 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: dri-devel, linux-pci

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] pci: missing EXPORT_SYMBOL for pci_realloc_enabled_by_user() breaks amdgpu
--

commit 9eeda1e99dc9a34bbbe5670a252bc894b1208696
Author: Mario Limonciello <mario.limonciello@amd.com>

drm/amdgpu: Gate VFCT bus fallback on pci=realloc

This patch modifies the soft filter system to gate the VFCT bus fallback
so it only runs when pci=realloc is explicitly requested by the user. It
introduces pci_realloc_enabled_by_user() in the PCI core and uses it in
the AMDGPU driver.

Closes: https://lore.kernel.org/amd-gfx/20261014080523.186533-1-rezanikzadch@gmail.com/

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index f9315e0472fe9..9651260278c18 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
[ ... ]
> @@ -459,7 +457,10 @@ static int amdgpu_acpi_vfct_match(struct amdgpu_device *adev,
>  	if (vhdr->PCIBus == adev->pdev->bus->number)
>  		return 0;
>  
> -	/* Bus mismatch but device identity matches (PCI renumbering case) */
> +	/* Allow bus renumbering only when the user requested pci=realloc. */
> +	if (!pci_realloc_enabled_by_user())
> +		return -ENODEV;
> +

[ ... ]

> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index ed16ef7c26fa7..d9450585082c0 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -1799,6 +1799,11 @@ static bool pci_realloc_enabled(enum enable_type enable)
>  	return enable >= user_enabled;
>  }
>  
> +bool pci_realloc_enabled_by_user(void)
> +{
> +	return pci_realloc_enable == user_enabled;
> +}
> +

[Severity: Low]
Will this cause a module build failure (undefined reference) if the amdgpu
driver is compiled as a loadable module (CONFIG_DRM_AMDGPU=m)?

Since setup-bus.c is built into the core kernel and pci_realloc_enabled_by_user()
lacks an EXPORT_SYMBOL or EXPORT_SYMBOL_GPL macro, the linker won't be able
to resolve this symbol during modpost for amdgpu.ko.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015124843.203905-1-mario.limonciello@amd.com?part=1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
  2026-10-15 12:56 ` sashiko-bot
@ 2026-10-15 12:58   ` Mario Limonciello
  0 siblings, 0 replies; 7+ messages in thread
From: Mario Limonciello @ 2026-10-15 12:58 UTC (permalink / raw)
  To: sashiko-reviews, Bjorn Helgaas, Deucher, Alexander; +Cc: dri-devel, linux-pci



On 10/15/26 07:56, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] pci: missing EXPORT_SYMBOL for pci_realloc_enabled_by_user() breaks amdgpu
> --
> 
> commit 9eeda1e99dc9a34bbbe5670a252bc894b1208696
> Author: Mario Limonciello <mario.limonciello@amd.com>
> 
> drm/amdgpu: Gate VFCT bus fallback on pci=realloc
> 
> This patch modifies the soft filter system to gate the VFCT bus fallback
> so it only runs when pci=realloc is explicitly requested by the user. It
> introduces pci_realloc_enabled_by_user() in the PCI core and uses it in
> the AMDGPU driver.
> 
> Closes: https://lore.kernel.org/amd-gfx/20261014080523.186533-1-rezanikzadch@gmail.com/
> 
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> index f9315e0472fe9..9651260278c18 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> [ ... ]
>> @@ -459,7 +457,10 @@ static int amdgpu_acpi_vfct_match(struct amdgpu_device *adev,
>>   	if (vhdr->PCIBus == adev->pdev->bus->number)
>>   		return 0;
>>   
>> -	/* Bus mismatch but device identity matches (PCI renumbering case) */
>> +	/* Allow bus renumbering only when the user requested pci=realloc. */
>> +	if (!pci_realloc_enabled_by_user())
>> +		return -ENODEV;
>> +
> 
> [ ... ]
> 
>> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
>> index ed16ef7c26fa7..d9450585082c0 100644
>> --- a/drivers/pci/setup-bus.c
>> +++ b/drivers/pci/setup-bus.c
>> @@ -1799,6 +1799,11 @@ static bool pci_realloc_enabled(enum enable_type enable)
>>   	return enable >= user_enabled;
>>   }
>>   
>> +bool pci_realloc_enabled_by_user(void)
>> +{
>> +	return pci_realloc_enable == user_enabled;
>> +}
>> +
> 
> [Severity: Low]
> Will this cause a module build failure (undefined reference) if the amdgpu
> driver is compiled as a loadable module (CONFIG_DRM_AMDGPU=m)?
> 
> Since setup-bus.c is built into the core kernel and pci_realloc_enabled_by_user()
> lacks an EXPORT_SYMBOL or EXPORT_SYMBOL_GPL macro, the linker won't be able
> to resolve this symbol during modpost for amdgpu.ko.
> 

Yeah; this is a valid issue.  If we're aligned directionally on this 
I'll fix that in a v2.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
  2026-10-15 12:48 [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc Mario Limonciello
  2026-10-15 12:56 ` sashiko-bot
@ 2026-10-15 19:48 ` Bjorn Helgaas
  2026-10-15 20:25   ` Mario Limonciello
  2026-10-19 20:45 ` kernel test robot
  2 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2026-10-15 19:48 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: alexander.deucher, christian.koenig, airlied, simona, bhelgaas,
	Reza Nikzad Chaleshori, amd-gfx, dri-devel, linux-pci,
	Alex Williamson, Ilpo Järvinen, Lukas Wunner, linux-acpi

[+cc Alex, Ilpo, Lukas, linux-acpi]

On Thu, Oct 15, 2026 at 07:48:42AM -0500, Mario Limonciello wrote:
> The soft filter system introduced by commit 11c141672045f ("drm/amdgpu:
> Fix VFCT bus number matching with soft filter") has a deficiency that
> it won't work when there are multiple GPUs of the exact same model.
> 
> As it was introduced specifically to help the case of pci=realloc, gate
> it to only run when that's in use.
> 
> Fixes: 11c141672045f ("drm/amdgpu: Fix VFCT bus number matching with soft filter")
> Reported-by: Reza Nikzad Chaleshori <rezanikzadch@gmail.com>
> Closes: https://lore.kernel.org/amd-gfx/20261014080523.186533-1-rezanikzadch@gmail.com/
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 15 ++++++++-------
>  drivers/pci/setup-bus.c                  |  5 +++++
>  include/linux/pci.h                      |  1 +
>  3 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index 08ed1eb695586..75af9a59671ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -384,12 +384,10 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
>   * @vhdr: VFCT image header to check
>   *
>   * VFCT entries contain the PCI bus number as recorded during BIOS POST.
> - * On systems where the kernel renumbers PCI buses (e.g. pci=realloc or
> - * resource conflicts), the runtime bus number may differ from the POST
> - * value.  Match by device identity (vendor + device + function) and use
> - * the bus number as a preference: exact bus match is preferred, but when
> - * the bus numbers disagree we accept the entry if the device identity
> - * matches.
> + * On systems where the user requested PCI resource reallocation, the
> + * runtime bus number may differ from the POST value. Match by device
> + * identity (vendor + device + function), but only treat the bus number as
> + * a preference when pci=realloc was explicitly requested.

This is a generic problem, isn't it?  

I think any table from firmware that has PCI bus numbers in it could
trip over issues like this.  Seems like we need a more generic
solution.

>   *
>   * Returns: 0 on match, -ENODEV on no match
>   */
> @@ -409,7 +407,10 @@ static int amdgpu_acpi_vfct_match(struct amdgpu_device *adev,
>  	if (vhdr->PCIBus == adev->pdev->bus->number)
>  		return 0;
>  
> -	/* Bus mismatch but device identity matches (PCI renumbering case) */
> +	/* Allow bus renumbering only when the user requested pci=realloc. */
> +	if (!pci_realloc_enabled_by_user())
> +		return -ENODEV;
> +
>  	dev_notice(adev->dev,
>  		   "VFCT bus number mismatch: table %u != runtime %u, matching by device identity (vendor 0x%04x device 0x%04x)\n",
>  		   vhdr->PCIBus, adev->pdev->bus->number,
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index ed16ef7c26fa7..d9450585082c0 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -1799,6 +1799,11 @@ static bool pci_realloc_enabled(enum enable_type enable)
>  	return enable >= user_enabled;
>  }
>  
> +bool pci_realloc_enabled_by_user(void)
> +{
> +	return pci_realloc_enable == user_enabled;
> +}

I don't like this.  I think the same bus renumbering can happen in the
"auto_enabled" case, and I don't think we set pci_realloc_enable in
that case.

But more generally, I think ultimately the PCI core should be able to
reassign bus numbers arbitrarily to accommodate hotplugs (given the
appropriate driver support to tolerate that, of course).

>  #if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO)
>  static int iov_resources_unassigned(struct pci_dev *dev, void *data)
>  {
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index d31a8d107b1ef..844734da9250f 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -610,6 +610,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
>  }
>  
>  struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
> +bool pci_realloc_enabled_by_user(void);
>  
>  #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
>  #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
  2026-10-15 19:48 ` Bjorn Helgaas
@ 2026-10-15 20:25   ` Mario Limonciello
  2026-10-19 22:19     ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Mario Limonciello @ 2026-10-15 20:25 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: alexander.deucher, christian.koenig, airlied, simona, bhelgaas,
	Reza Nikzad Chaleshori, amd-gfx, dri-devel, linux-pci,
	Alex Williamson, Ilpo Järvinen, Lukas Wunner, linux-acpi



On 10/15/26 14:48, Bjorn Helgaas wrote:
> [+cc Alex, Ilpo, Lukas, linux-acpi]
> 
> On Thu, Oct 15, 2026 at 07:48:42AM -0500, Mario Limonciello wrote:
>> The soft filter system introduced by commit 11c141672045f ("drm/amdgpu:
>> Fix VFCT bus number matching with soft filter") has a deficiency that
>> it won't work when there are multiple GPUs of the exact same model.
>>
>> As it was introduced specifically to help the case of pci=realloc, gate
>> it to only run when that's in use.
>>
>> Fixes: 11c141672045f ("drm/amdgpu: Fix VFCT bus number matching with soft filter")
>> Reported-by: Reza Nikzad Chaleshori <rezanikzadch@gmail.com>
>> Closes: https://lore.kernel.org/amd-gfx/20261014080523.186533-1-rezanikzadch@gmail.com/
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 15 ++++++++-------
>>   drivers/pci/setup-bus.c                  |  5 +++++
>>   include/linux/pci.h                      |  1 +
>>   3 files changed, 14 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> index 08ed1eb695586..75af9a59671ae 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
>> @@ -384,12 +384,10 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
>>    * @vhdr: VFCT image header to check
>>    *
>>    * VFCT entries contain the PCI bus number as recorded during BIOS POST.
>> - * On systems where the kernel renumbers PCI buses (e.g. pci=realloc or
>> - * resource conflicts), the runtime bus number may differ from the POST
>> - * value.  Match by device identity (vendor + device + function) and use
>> - * the bus number as a preference: exact bus match is preferred, but when
>> - * the bus numbers disagree we accept the entry if the device identity
>> - * matches.
>> + * On systems where the user requested PCI resource reallocation, the
>> + * runtime bus number may differ from the POST value. Match by device
>> + * identity (vendor + device + function), but only treat the bus number as
>> + * a preference when pci=realloc was explicitly requested.
> 
> This is a generic problem, isn't it?
> 
> I think any table from firmware that has PCI bus numbers in it could
> trip over issues like this.  Seems like we need a more generic
> solution.
> 

Yeah; it's a generic issue which was triggered by pci=realloc which is 
why I did a soft filter in 11c141672045f.

But this causes problems when you have two (or more) of the exact same 
device.  You might match the wrong thing.

>>    *
>>    * Returns: 0 on match, -ENODEV on no match
>>    */
>> @@ -409,7 +407,10 @@ static int amdgpu_acpi_vfct_match(struct amdgpu_device *adev,
>>   	if (vhdr->PCIBus == adev->pdev->bus->number)
>>   		return 0;
>>   
>> -	/* Bus mismatch but device identity matches (PCI renumbering case) */
>> +	/* Allow bus renumbering only when the user requested pci=realloc. */
>> +	if (!pci_realloc_enabled_by_user())
>> +		return -ENODEV;
>> +
>>   	dev_notice(adev->dev,
>>   		   "VFCT bus number mismatch: table %u != runtime %u, matching by device identity (vendor 0x%04x device 0x%04x)\n",
>>   		   vhdr->PCIBus, adev->pdev->bus->number,
>> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
>> index ed16ef7c26fa7..d9450585082c0 100644
>> --- a/drivers/pci/setup-bus.c
>> +++ b/drivers/pci/setup-bus.c
>> @@ -1799,6 +1799,11 @@ static bool pci_realloc_enabled(enum enable_type enable)
>>   	return enable >= user_enabled;
>>   }
>>   
>> +bool pci_realloc_enabled_by_user(void)
>> +{
>> +	return pci_realloc_enable == user_enabled;
>> +}
> 
> I don't like this.  I think the same bus renumbering can happen in the
> "auto_enabled" case, and I don't think we set pci_realloc_enable in
> that case.
> 
> But more generally, I think ultimately the PCI core should be able to
> reassign bus numbers arbitrarily to accommodate hotplugs (given the
> appropriate driver support to tolerate that, of course).
> 

Could we keep track of the original perhaps?  Then drivers can know what 
it was reassigned from?

>>   #if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO)
>>   static int iov_resources_unassigned(struct pci_dev *dev, void *data)
>>   {
>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>> index d31a8d107b1ef..844734da9250f 100644
>> --- a/include/linux/pci.h
>> +++ b/include/linux/pci.h
>> @@ -610,6 +610,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
>>   }
>>   
>>   struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
>> +bool pci_realloc_enabled_by_user(void);
>>   
>>   #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
>>   #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
>> -- 
>> 2.43.0
>>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
  2026-10-15 12:48 [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc Mario Limonciello
  2026-10-15 12:56 ` sashiko-bot
  2026-10-15 19:48 ` Bjorn Helgaas
@ 2026-10-19 20:45 ` kernel test robot
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-10-19 20:45 UTC (permalink / raw)
  To: Mario Limonciello, alexander.deucher, christian.koenig, airlied,
	simona, bhelgaas
  Cc: llvm, oe-kbuild-all, Reza Nikzad Chaleshori, amd-gfx, dri-devel,
	linux-pci

Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus drm-misc/drm-misc-next daeinki-drm-exynos/exynos-drm-next drm/drm-next drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-tip/drm-tip linus/master v7.3 next-20261016]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-amdgpu-Gate-VFCT-bus-fallback-on-pci-realloc/20261015-074842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/20261015124843.203905-1-mario.limonciello%40amd.com
patch subject: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20261020/202610200440.fq7Zgnxm-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261020/202610200440.fq7Zgnxm-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610200440.fq7Zgnxm-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: drivers/gpu/drm/amd/amdgpu/amdgpu.ko: symbol 'pci_realloc_enabled_by_user' undefined!

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc
  2026-10-15 20:25   ` Mario Limonciello
@ 2026-10-19 22:19     ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2026-10-19 22:19 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: alexander.deucher, christian.koenig, airlied, simona, bhelgaas,
	Reza Nikzad Chaleshori, amd-gfx, dri-devel, linux-pci,
	Alex Williamson, Ilpo Järvinen, Lukas Wunner, linux-acpi

On Thu, Oct 15, 2026 at 03:25:17PM -0500, Mario Limonciello wrote:
> On 10/15/26 14:48, Bjorn Helgaas wrote:
> > [+cc Alex, Ilpo, Lukas, linux-acpi]
> > 
> > On Thu, Oct 15, 2026 at 07:48:42AM -0500, Mario Limonciello wrote:
> > > The soft filter system introduced by commit 11c141672045f ("drm/amdgpu:
> > > Fix VFCT bus number matching with soft filter") has a deficiency that
> > > it won't work when there are multiple GPUs of the exact same model.
> > > 
> > > As it was introduced specifically to help the case of pci=realloc, gate
> > > it to only run when that's in use.
> > > 
> > > Fixes: 11c141672045f ("drm/amdgpu: Fix VFCT bus number matching with soft filter")
> > > Reported-by: Reza Nikzad Chaleshori <rezanikzadch@gmail.com>
> > > Closes: https://lore.kernel.org/amd-gfx/20261014080523.186533-1-rezanikzadch@gmail.com/
> > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> > > ---
> > >   drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 15 ++++++++-------
> > >   drivers/pci/setup-bus.c                  |  5 +++++
> > >   include/linux/pci.h                      |  1 +
> > >   3 files changed, 14 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> > > index 08ed1eb695586..75af9a59671ae 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> > > @@ -384,12 +384,10 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
> > >    * @vhdr: VFCT image header to check
> > >    *
> > >    * VFCT entries contain the PCI bus number as recorded during BIOS POST.
> > > - * On systems where the kernel renumbers PCI buses (e.g. pci=realloc or
> > > - * resource conflicts), the runtime bus number may differ from the POST
> > > - * value.  Match by device identity (vendor + device + function) and use
> > > - * the bus number as a preference: exact bus match is preferred, but when
> > > - * the bus numbers disagree we accept the entry if the device identity
> > > - * matches.
> > > + * On systems where the user requested PCI resource reallocation, the
> > > + * runtime bus number may differ from the POST value. Match by device
> > > + * identity (vendor + device + function), but only treat the bus number as
> > > + * a preference when pci=realloc was explicitly requested.
> > 
> > This is a generic problem, isn't it?
> > 
> > I think any table from firmware that has PCI bus numbers in it could
> > trip over issues like this.  Seems like we need a more generic
> > solution.
> 
> Yeah; it's a generic issue which was triggered by pci=realloc which is why I
> did a soft filter in 11c141672045f.
> 
> But this causes problems when you have two (or more) of the exact same
> device.  You might match the wrong thing.
> 
> > >    *
> > >    * Returns: 0 on match, -ENODEV on no match
> > >    */
> > > @@ -409,7 +407,10 @@ static int amdgpu_acpi_vfct_match(struct amdgpu_device *adev,
> > >   	if (vhdr->PCIBus == adev->pdev->bus->number)
> > >   		return 0;
> > > -	/* Bus mismatch but device identity matches (PCI renumbering case) */
> > > +	/* Allow bus renumbering only when the user requested pci=realloc. */
> > > +	if (!pci_realloc_enabled_by_user())
> > > +		return -ENODEV;
> > > +
> > >   	dev_notice(adev->dev,
> > >   		   "VFCT bus number mismatch: table %u != runtime %u, matching by device identity (vendor 0x%04x device 0x%04x)\n",
> > >   		   vhdr->PCIBus, adev->pdev->bus->number,
> > > diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> > > index ed16ef7c26fa7..d9450585082c0 100644
> > > --- a/drivers/pci/setup-bus.c
> > > +++ b/drivers/pci/setup-bus.c
> > > @@ -1799,6 +1799,11 @@ static bool pci_realloc_enabled(enum enable_type enable)
> > >   	return enable >= user_enabled;
> > >   }
> > > +bool pci_realloc_enabled_by_user(void)
> > > +{
> > > +	return pci_realloc_enable == user_enabled;
> > > +}
> > 
> > I don't like this.  I think the same bus renumbering can happen in the
> > "auto_enabled" case, and I don't think we set pci_realloc_enable in
> > that case.
> > 
> > But more generally, I think ultimately the PCI core should be able to
> > reassign bus numbers arbitrarily to accommodate hotplugs (given the
> > appropriate driver support to tolerate that, of course).
> 
> Could we keep track of the original perhaps?  Then drivers can know
> what it was reassigned from?

I think the only thing that can change is the bus number, and saving
the original bus number in a struct pci_bus or similar might be
practical?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-19 22:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 12:48 [PATCH] drm/amdgpu: Gate VFCT bus fallback on pci=realloc Mario Limonciello
2026-10-15 12:56 ` sashiko-bot
2026-10-15 12:58   ` Mario Limonciello
2026-10-15 19:48 ` Bjorn Helgaas
2026-10-15 20:25   ` Mario Limonciello
2026-10-19 22:19     ` Bjorn Helgaas
2026-10-19 20:45 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox