Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Remove driver side BAR release before resize

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

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
db92e3fe 4efaa80b

+1 -7
+1 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1729 1729 pci_write_config_word(adev->pdev, PCI_COMMAND, 1730 1730 cmd & ~PCI_COMMAND_MEMORY); 1731 1731 1732 - /* Free the VRAM and doorbell BAR, we most likely need to move both. */ 1732 + /* Tear down doorbell as resizing will release BARs */ 1733 1733 amdgpu_doorbell_fini(adev); 1734 - if (adev->asic_type >= CHIP_BONAIRE) 1735 - pci_release_resource(adev->pdev, 2); 1736 - 1737 - pci_release_resource(adev->pdev, 0); 1738 1734 1739 1735 r = pci_resize_resource(adev->pdev, 0, rbar_size, 1740 1736 (adev->asic_type >= CHIP_BONAIRE) ? 1 << 5 ··· 1740 1744 "Not enough PCI address space for a large BAR."); 1741 1745 else if (r && r != -ENOTSUPP) 1742 1746 dev_err(adev->dev, "Problem resizing BAR0 (%d).", r); 1743 - 1744 - pci_assign_unassigned_bus_resources(adev->pdev->bus); 1745 1747 1746 1748 /* When the doorbell or fb BAR isn't available we have no chance of 1747 1749 * using the device.