]> Gentwo Git Trees - linux/.git/commitdiff
drm/amdgpu: Remove driver side BAR release before resize
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 13 Nov 2025 16:26:27 +0000 (18:26 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Nov 2025 18:34:20 +0000 (12:34 -0600)
PCI core handles releasing device's resources and their rollback in case of
failure of a BAR resizing operation. Releasing resource prior to calling
pci_resize_resource() prevents PCI core from restoring the BARs as they
were.

Remove driver-side release of BARs from the amdgpu driver.

Also remove the driver initiated assignment as pci_resize_resource() should
try to assign as much as possible. If the driver side call manages to get
more required resources assigned in some scenario, such a problem should be
fixed inside pci_resize_resource() instead.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Alex Bennée <alex.bennee@linaro.org> # AVA, AMD GPU
Link: https://patch.msgid.link/20251113162628.5946-11-ilpo.jarvinen@linux.intel.com
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index bf0bc38e1c47f8a6eb589a2cf3f0a712400bcc77..d777454a170a26d689dc00f22b12f963fd0e3aba 100644 (file)
@@ -1729,12 +1729,8 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
        pci_write_config_word(adev->pdev, PCI_COMMAND,
                              cmd & ~PCI_COMMAND_MEMORY);
 
-       /* Free the VRAM and doorbell BAR, we most likely need to move both. */
+       /* Tear down doorbell as resizing will release BARs */
        amdgpu_doorbell_fini(adev);
-       if (adev->asic_type >= CHIP_BONAIRE)
-               pci_release_resource(adev->pdev, 2);
-
-       pci_release_resource(adev->pdev, 0);
 
        r = pci_resize_resource(adev->pdev, 0, rbar_size,
                                (adev->asic_type >= CHIP_BONAIRE) ? 1 << 5
@@ -1745,8 +1741,6 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
        else if (r && r != -ENOTSUPP)
                dev_err(adev->dev, "Problem resizing BAR0 (%d).", r);
 
-       pci_assign_unassigned_bus_resources(adev->pdev->bus);
-
        /* When the doorbell or fb BAR isn't available we have no chance of
         * using the device.
         */