From: jsg Date: Thu, 25 Jan 2024 09:05:54 +0000 (+0000) Subject: call amdgpu_driver_load_kms() instead of doing the equivalent X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=21faacacf503df921161fe64cef80b9328e04bb4;p=openbsd call amdgpu_driver_load_kms() instead of doing the equivalent --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c index ce87f697081..648408ea841 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c @@ -3478,63 +3478,9 @@ amdgpu_attachhook(struct device *self) struct drm_gem_object *obj; struct amdgpu_bo *rbo; - /* from amdgpu_driver_load_kms() */ - - /* amdgpu_device_init should report only fatal error - * like memory allocation failure or iomapping failure, - * or memory manager initialization failure, it must - * properly initialize the GPU MC controller and permit - * VRAM allocation - */ - r = amdgpu_device_init(adev, adev->flags); - if (r) { - dev_err(&dev->pdev->dev, "Fatal error during GPU init\n"); + r = amdgpu_driver_load_kms(adev, adev->flags); + if (r) goto out; - } - - adev->pm.rpm_mode = AMDGPU_RUNPM_NONE; - if (amdgpu_device_supports_px(dev) && - (amdgpu_runtime_pm != 0)) { /* enable PX as runtime mode */ - adev->pm.rpm_mode = AMDGPU_RUNPM_PX; - dev_info(adev->dev, "Using ATPX for runtime pm\n"); - } else if (amdgpu_device_supports_boco(dev) && - (amdgpu_runtime_pm != 0)) { /* enable boco as runtime mode */ - adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO; - dev_info(adev->dev, "Using BOCO for runtime pm\n"); - } else if (amdgpu_device_supports_baco(dev) && - (amdgpu_runtime_pm != 0)) { - switch (adev->asic_type) { - case CHIP_VEGA20: - case CHIP_ARCTURUS: - /* enable BACO as runpm mode if runpm=1 */ - if (amdgpu_runtime_pm > 0) - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO; - break; - case CHIP_VEGA10: - /* enable BACO as runpm mode if noretry=0 */ - if (!adev->gmc.noretry) - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO; - break; - default: - /* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO; - break; - } - - if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) - dev_info(adev->dev, "Using BACO for runtime pm\n"); - } - - /* Call ACPI methods: require modeset init - * but failure is not fatal - */ - - acpi_status = amdgpu_acpi_init(adev); - if (acpi_status) - dev_dbg(dev->dev, "Error during ACPI methods call\n"); - - if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_LOAD)) - DRM_WARN("smart shift update failed\n"); /* * 1. don't init fbdev on hw without DCE diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c index 7e82a802cc0..e47abc6c445 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c @@ -69,7 +69,6 @@ void amdgpu_unregister_gpu_instance(struct amdgpu_device *adev) mutex_unlock(&mgpu_info.mutex); } -#ifdef __linux__ /** * amdgpu_driver_unload_kms - Main unload function for KMS. * @@ -96,7 +95,6 @@ void amdgpu_driver_unload_kms(struct drm_device *dev) amdgpu_acpi_fini(adev); amdgpu_device_fini_hw(adev); } -#endif /* __linux__ */ void amdgpu_register_gpu_instance(struct amdgpu_device *adev) { @@ -123,7 +121,6 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev) mutex_unlock(&mgpu_info.mutex); } -#ifdef __linux__ /** * amdgpu_driver_load_kms - Main load function for KMS. * @@ -202,7 +199,6 @@ out: return r; } -#endif /* __linux__ */ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info, struct drm_amdgpu_query_fw *query_fw,