From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 454DFC77B7F for ; Sat, 13 May 2023 07:43:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231735AbjEMHnO (ORCPT ); Sat, 13 May 2023 03:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231664AbjEMHnN (ORCPT ); Sat, 13 May 2023 03:43:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 920E4196 for ; Sat, 13 May 2023 00:43:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F03B6097C for ; Sat, 13 May 2023 07:43:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B56F6C433D2; Sat, 13 May 2023 07:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683963791; bh=3pkB9eOV75ZHPETQVtGvM7nrTU1tOS/AaBsDBiXt7aQ=; h=Subject:To:Cc:From:Date:From; b=qmSlu68X10b416i/pt+3T/zVeWDVNNJo9YnqXwZRMkq0uH/RwyDwZ8Kop+pwsPJdw H576m1DMxli6kalrIXNtG1eG13RKaV2YrN4SoPbO5Gn92cjzJ0NDRYbPkfgUXEZLtW qeoe/bAV9xxR309Vc6OliStp24ajK894D2FSd98Q= Subject: FAILED: patch "[PATCH] drm/amd/pm: parse pp_handle under appropriate conditions" failed to apply to 5.4-stable tree To: guchun.chen@amd.com, alexander.deucher@amd.com, mario.limonciello@amd.com Cc: From: Date: Sat, 13 May 2023 16:23:23 +0900 Message-ID: <2023051323-outburst-chaplain-729e@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 58d9b9a14b47c2a3da6effcbb01607ad7edc0275 # git commit -s git send-email --to '' --in-reply-to '2023051323-outburst-chaplain-729e@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: 58d9b9a14b47 ("drm/amd/pm: parse pp_handle under appropriate conditions") ebfc253335af ("drm/amd/pm: do not expose the smu_context structure used internally in power") d698a2c4859d ("drm/amd/pm: move pp_force_state_enabled member to amdgpu_pm structure") 13f5dbd6e3d9 ("drm/amd/pm: do not expose power implementation details to display") 79c65f3fcbb1 ("drm/amd/pm: do not expose power implementation details to amdgpu_pm.c") bc143d8b8387 ("drm/amd/pm: do not expose implementation details to other blocks out of power") 4da8b63944a4 ("drm/amdgpu: Send Message to SMU on aldebaran passthrough for sbr handling") f296a0bcc961 ("drm/amd/pm: skip setting gfx cgpg in the s0ix suspend-resume") 7e31a8585b79 ("drm/amdgpu: move smu_debug_mask to a more proper place") 6ff7fddbd120 ("drm/amdgpu: add support for SMU debug option") 1f5fc7a50955 ("drm/amd/pm: Add debugfs info for STB") 79aae67ef8bb ("drm/amd/pm: Add STB accessors interface") fdcb279d5b79 ("drm/amdgpu: query umc error info from ecc_table v2") edd794208555 ("drm/amd/pm: add message smu to get ecc_table v2") 3ebd8bf02380 ("drm/amdgpu: support new mode-1 reset interface (v2)") 6c08e0ef87b8 ("drm/amd/pm: avoid duplicate powergate/ungate setting") 56c5977eae87 ("drm/amdkfd: replace/remove remaining kgd_dev references") c531a58bb61b ("drm/amdkfd: replace kgd_dev in static gfx v10_3 funcs") 4056b0337746 ("drm/amdkfd: replace kgd_dev in static gfx v10 funcs") 9a17c9b79b4d ("drm/amdkfd: replace kgd_dev in static gfx v9 funcs") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 58d9b9a14b47c2a3da6effcbb01607ad7edc0275 Mon Sep 17 00:00:00 2001 From: Guchun Chen Date: Fri, 5 May 2023 13:20:11 +0800 Subject: [PATCH] drm/amd/pm: parse pp_handle under appropriate conditions amdgpu_dpm_is_overdrive_supported is a common API across all asics, so we should cast pp_handle into correct structure under different power frameworks. v2: using return directly to simplify code v3: SI asic does not carry od_enabled member in pp_handle, and update Fixes tag Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2541 Fixes: eb4900aa4c49 ("drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions") Suggested-by: Mario Limonciello Signed-off-by: Guchun Chen Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c index 300e156b924f..86246f69dbe1 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c @@ -1460,15 +1460,21 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev, int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev) { - struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; - struct smu_context *smu = adev->powerplay.pp_handle; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = adev->powerplay.pp_handle; + + return (smu->od_enabled || smu->is_apu); + } else { + struct pp_hwmgr *hwmgr; - if ((is_support_sw_smu(adev) && smu->od_enabled) || - (is_support_sw_smu(adev) && smu->is_apu) || - (!is_support_sw_smu(adev) && hwmgr->od_enabled)) - return true; + /* SI asic does not carry od_enabled */ + if (adev->family == AMDGPU_FAMILY_SI) + return false; - return false; + hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle; + + return hwmgr->od_enabled; + } } int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,