Skip to content

Commit 5f054dd

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Handle being compiled without SI or CIK support better
If compiled without SI or CIK support but amdgpu tries to load it will run into failures with uninitialized callbacks. Show a nicer message in this case and fail probe instead. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4050 Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent b03f181 commit 5f054dd

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,6 @@ static const u16 amdgpu_unsupported_pciidlist[] = {
18091809
};
18101810

18111811
static const struct pci_device_id pciidlist[] = {
1812-
#ifdef CONFIG_DRM_AMDGPU_SI
18131812
{0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
18141813
{0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
18151814
{0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
@@ -1882,8 +1881,6 @@ static const struct pci_device_id pciidlist[] = {
18821881
{0x1002, 0x6665, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
18831882
{0x1002, 0x6667, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
18841883
{0x1002, 0x666F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|AMD_IS_MOBILITY},
1885-
#endif
1886-
#ifdef CONFIG_DRM_AMDGPU_CIK
18871884
/* Kaveri */
18881885
{0x1002, 0x1304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_MOBILITY|AMD_IS_APU},
18891886
{0x1002, 0x1305, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|AMD_IS_APU},
@@ -1966,7 +1963,6 @@ static const struct pci_device_id pciidlist[] = {
19661963
{0x1002, 0x985D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
19671964
{0x1002, 0x985E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
19681965
{0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
1969-
#endif
19701966
/* topaz */
19711967
{0x1002, 0x6900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
19721968
{0x1002, 0x6901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ},
@@ -2313,40 +2309,48 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
23132309
return -ENOTSUPP;
23142310
}
23152311

2312+
switch (flags & AMD_ASIC_MASK) {
2313+
case CHIP_TAHITI:
2314+
case CHIP_PITCAIRN:
2315+
case CHIP_VERDE:
2316+
case CHIP_OLAND:
2317+
case CHIP_HAINAN:
23162318
#ifdef CONFIG_DRM_AMDGPU_SI
2317-
if (!amdgpu_si_support) {
2318-
switch (flags & AMD_ASIC_MASK) {
2319-
case CHIP_TAHITI:
2320-
case CHIP_PITCAIRN:
2321-
case CHIP_VERDE:
2322-
case CHIP_OLAND:
2323-
case CHIP_HAINAN:
2319+
if (!amdgpu_si_support) {
23242320
dev_info(&pdev->dev,
23252321
"SI support provided by radeon.\n");
23262322
dev_info(&pdev->dev,
23272323
"Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
23282324
);
23292325
return -ENODEV;
23302326
}
2331-
}
2327+
break;
2328+
#else
2329+
dev_info(&pdev->dev, "amdgpu is built without SI support.\n");
2330+
return -ENODEV;
23322331
#endif
2332+
case CHIP_KAVERI:
2333+
case CHIP_BONAIRE:
2334+
case CHIP_HAWAII:
2335+
case CHIP_KABINI:
2336+
case CHIP_MULLINS:
23332337
#ifdef CONFIG_DRM_AMDGPU_CIK
2334-
if (!amdgpu_cik_support) {
2335-
switch (flags & AMD_ASIC_MASK) {
2336-
case CHIP_KAVERI:
2337-
case CHIP_BONAIRE:
2338-
case CHIP_HAWAII:
2339-
case CHIP_KABINI:
2340-
case CHIP_MULLINS:
2338+
if (!amdgpu_cik_support) {
23412339
dev_info(&pdev->dev,
23422340
"CIK support provided by radeon.\n");
23432341
dev_info(&pdev->dev,
23442342
"Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
23452343
);
23462344
return -ENODEV;
23472345
}
2348-
}
2346+
break;
2347+
#else
2348+
dev_info(&pdev->dev, "amdgpu is built without CIK support.\n");
2349+
return -ENODEV;
23492350
#endif
2351+
default:
2352+
break;
2353+
}
23502354

23512355
adev = devm_drm_dev_alloc(&pdev->dev, &amdgpu_kms_driver, typeof(*adev), ddev);
23522356
if (IS_ERR(adev))

0 commit comments

Comments
 (0)