Commit fcc0735b authored by Ma Jun's avatar Ma Jun Committed by Alex Deucher

drm/amdgpu: Add support for BAMACO mode checking

Optimize the code to add support for BAMACO mode checking
Signed-off-by: default avatarMa Jun <Jun.Ma2@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 166a3c73
...@@ -2744,7 +2744,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) ...@@ -2744,7 +2744,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO) { } else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO) {
/* nothing to do */ /* nothing to do */
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) { } else if ((adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) ||
(adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)) {
amdgpu_device_baco_enter(drm_dev); amdgpu_device_baco_enter(drm_dev);
} }
...@@ -2784,7 +2785,8 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) ...@@ -2784,7 +2785,8 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
* PCI core handles it for _PR3. * PCI core handles it for _PR3.
*/ */
pci_set_master(pdev); pci_set_master(pdev);
} else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) { } else if ((adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) ||
(adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)) {
amdgpu_device_baco_exit(drm_dev); amdgpu_device_baco_exit(drm_dev);
} }
ret = amdgpu_device_resume(drm_dev, false); ret = amdgpu_device_resume(drm_dev, false);
......
...@@ -133,6 +133,7 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev) ...@@ -133,6 +133,7 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)
int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
{ {
struct drm_device *dev; struct drm_device *dev;
int bamaco_support = 0;
int r, acpi_status; int r, acpi_status;
dev = adev_to_drm(adev); dev = adev_to_drm(adev);
...@@ -158,8 +159,12 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) ...@@ -158,8 +159,12 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
(amdgpu_runtime_pm != 0)) { /* enable boco as runtime mode */ (amdgpu_runtime_pm != 0)) { /* enable boco as runtime mode */
adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO; adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
dev_info(adev->dev, "Using BOCO for runtime pm\n"); dev_info(adev->dev, "Using BOCO for runtime pm\n");
} else if (amdgpu_device_supports_baco(dev) && } else if (amdgpu_runtime_pm != 0) {
(amdgpu_runtime_pm != 0)) { bamaco_support = amdgpu_device_supports_baco(dev);
if (!bamaco_support)
goto no_runtime_pm;
switch (adev->asic_type) { switch (adev->asic_type) {
case CHIP_VEGA20: case CHIP_VEGA20:
case CHIP_ARCTURUS: case CHIP_ARCTURUS:
...@@ -178,10 +183,20 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) ...@@ -178,10 +183,20 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
break; break;
} }
if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) {
dev_info(adev->dev, "Using BACO for runtime pm\n"); if (bamaco_support & MACO_SUPPORT) {
adev->pm.rpm_mode = AMDGPU_RUNPM_BAMACO;
dev_info(adev->dev, "Using BAMACO for runtime pm\n");
} else {
dev_info(adev->dev, "Using BACO for runtime pm\n");
}
}
} }
no_runtime_pm:
if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE)
dev_info(adev->dev, "NO pm mode for runtime pm\n");
/* Call ACPI methods: require modeset init /* Call ACPI methods: require modeset init
* but failure is not fatal * but failure is not fatal
*/ */
......
...@@ -2622,7 +2622,8 @@ static int psp_load_p2s_table(struct psp_context *psp) ...@@ -2622,7 +2622,8 @@ static int psp_load_p2s_table(struct psp_context *psp)
struct amdgpu_firmware_info *ucode = struct amdgpu_firmware_info *ucode =
&adev->firmware.ucode[AMDGPU_UCODE_ID_P2S_TABLE]; &adev->firmware.ucode[AMDGPU_UCODE_ID_P2S_TABLE];
if (adev->in_runpm && (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO)) if (adev->in_runpm && ((adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) ||
(adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)))
return 0; return 0;
if (amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 6)) { if (amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 6)) {
...@@ -2652,7 +2653,8 @@ static int psp_load_smu_fw(struct psp_context *psp) ...@@ -2652,7 +2653,8 @@ static int psp_load_smu_fw(struct psp_context *psp)
* Skip SMU FW reloading in case of using BACO for runpm only, * Skip SMU FW reloading in case of using BACO for runpm only,
* as SMU is always alive. * as SMU is always alive.
*/ */
if (adev->in_runpm && (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO)) if (adev->in_runpm && ((adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) ||
(adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)))
return 0; return 0;
if (!ucode->fw || amdgpu_sriov_vf(psp->adev)) if (!ucode->fw || amdgpu_sriov_vf(psp->adev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment