]> git.hungrycats.org Git - linux/commitdiff
drm/amdgpu: check before checking pci bridge registers
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Oct 2015 13:38:45 +0000 (09:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Oct 2015 00:53:42 +0000 (09:53 +0900)
commit e79d5c0870eedce94e5f5a2ffab30511e48fa144 upstream.

Make sure we are not the root device before attempting to
read the pcie bridge registers to check the pcie gen speeed.

Fixes a crash when the device is passed through to a VM.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/cik.c
drivers/gpu/drm/amd/amdgpu/vi.c

index 341c566818419317a0c3d16a3d5b738840e30b46..519fa515c4d86f57238b581c2125f4a009ed9f85 100644 (file)
@@ -1565,6 +1565,9 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev)
        int ret, i;
        u16 tmp16;
 
+       if (pci_is_root_bus(adev->pdev->bus))
+               return;
+
        if (amdgpu_pcie_gen2 == 0)
                return;
 
index 4f58a1e18de68cebe47bd00c749dd7f1a6263ebb..9ffa56cebdbc36acbd5887097c30842b54b4cf0c 100644 (file)
@@ -968,6 +968,9 @@ static void vi_pcie_gen3_enable(struct amdgpu_device *adev)
        u32 mask;
        int ret;
 
+       if (pci_is_root_bus(adev->pdev->bus))
+               return;
+
        if (amdgpu_pcie_gen2 == 0)
                return;