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

drm/amdgpu: Bail earlier when amdgpu.cik_/si_support is not set to 1

Bail from the pci_driver probe function instead of from the drm_driver
load function.

This avoid /dev/dri/card0 temporarily getting registered and then
unregistered again, sending unwanted add / remove udev events to
userspace.

Specifically this avoids triggering the (userspace) bug fixed by this
plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being a userspace bug, not sending unnecessary
udev events is a good idea in general.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Hans de Goede and committed by
Alex Deucher
402c60d7 44e149bb

+35 -35
+35
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 1021 1021 return -ENODEV; 1022 1022 } 1023 1023 1024 + #ifdef CONFIG_DRM_AMDGPU_SI 1025 + if (!amdgpu_si_support) { 1026 + switch (flags & AMD_ASIC_MASK) { 1027 + case CHIP_TAHITI: 1028 + case CHIP_PITCAIRN: 1029 + case CHIP_VERDE: 1030 + case CHIP_OLAND: 1031 + case CHIP_HAINAN: 1032 + dev_info(&pdev->dev, 1033 + "SI support provided by radeon.\n"); 1034 + dev_info(&pdev->dev, 1035 + "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n" 1036 + ); 1037 + return -ENODEV; 1038 + } 1039 + } 1040 + #endif 1041 + #ifdef CONFIG_DRM_AMDGPU_CIK 1042 + if (!amdgpu_cik_support) { 1043 + switch (flags & AMD_ASIC_MASK) { 1044 + case CHIP_KAVERI: 1045 + case CHIP_BONAIRE: 1046 + case CHIP_HAWAII: 1047 + case CHIP_KABINI: 1048 + case CHIP_MULLINS: 1049 + dev_info(&pdev->dev, 1050 + "CIK support provided by radeon.\n"); 1051 + dev_info(&pdev->dev, 1052 + "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n" 1053 + ); 1054 + return -ENODEV; 1055 + } 1056 + } 1057 + #endif 1058 + 1024 1059 /* Get rid of things like offb */ 1025 1060 ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "amdgpudrmfb"); 1026 1061 if (ret)
-35
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 144 144 struct amdgpu_device *adev; 145 145 int r, acpi_status; 146 146 147 - #ifdef CONFIG_DRM_AMDGPU_SI 148 - if (!amdgpu_si_support) { 149 - switch (flags & AMD_ASIC_MASK) { 150 - case CHIP_TAHITI: 151 - case CHIP_PITCAIRN: 152 - case CHIP_VERDE: 153 - case CHIP_OLAND: 154 - case CHIP_HAINAN: 155 - dev_info(dev->dev, 156 - "SI support provided by radeon.\n"); 157 - dev_info(dev->dev, 158 - "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n" 159 - ); 160 - return -ENODEV; 161 - } 162 - } 163 - #endif 164 - #ifdef CONFIG_DRM_AMDGPU_CIK 165 - if (!amdgpu_cik_support) { 166 - switch (flags & AMD_ASIC_MASK) { 167 - case CHIP_KAVERI: 168 - case CHIP_BONAIRE: 169 - case CHIP_HAWAII: 170 - case CHIP_KABINI: 171 - case CHIP_MULLINS: 172 - dev_info(dev->dev, 173 - "CIK support provided by radeon.\n"); 174 - dev_info(dev->dev, 175 - "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n" 176 - ); 177 - return -ENODEV; 178 - } 179 - } 180 - #endif 181 - 182 147 adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL); 183 148 if (adev == NULL) { 184 149 return -ENOMEM;