Hi Ben, Am 24.06.19 um 06:27 schrieb Benjamin Herrenschmidt: > Hi Christian ! > > While cleaning up & consolidating resource management code accross > archs I stumbled upon this call to pci_assign_unassigned_bus_resources > in amdgpu:amdgpu_device_resize_fb_bar() > > Why do you need this ? My understanding is that pci_resize_resource() > will already be calling pci_reassign_bridge_resources() on the parent > bridge which should have the same effect. Or am I missing something ? > > I'd like to remove that call if possible... Bjorn suggested to do it this way and it indeed proved to be less error prone. Basically amdgpu_device_resize_fb_bar() frees the resources for our VRAM and doorbell BAR: > /* Free the VRAM and doorbell BAR, we most likely need to move > both. */ > amdgpu_device_doorbell_fini(adev); > if (adev->asic_type >= CHIP_BONAIRE) > pci_release_resource(adev->pdev, 2); > > pci_release_resource(adev->pdev, 0); Then we resize the VRAM BAR by calling pci_resize_resource(). That in turn tries to resize and shuffle around the parent bridge resources using pci_reassign_bridge_resources(). But pci_reassign_bridge_resources() does not assign any device resources, it just tries to make sure the upstream bridges have enough space to fit everything in. Independent if we succeeded or failed with handling the bridge(s) we call pci_assign_unassigned_bus_resources() to re-assign the previously freed up VRAM and doorbell BARs. So yeah, this definitely necessary, or otherwise the driver would crash soon after because the resources are not assigned again. Regards, Christian. > > Cheers, > Ben. > >