From patchwork Mon May 2 20:00:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 8995461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF0449FC6A for ; Mon, 2 May 2016 20:02:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A83120279 for ; Mon, 2 May 2016 20:02:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7A2A6202C8 for ; Mon, 2 May 2016 20:01:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50FF76E64D; Mon, 2 May 2016 20:01:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x232.google.com (mail-qk0-x232.google.com [IPv6:2607:f8b0:400d:c09::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB6086E639 for ; Mon, 2 May 2016 20:01:30 +0000 (UTC) Received: by mail-qk0-x232.google.com with SMTP id r184so79807017qkc.1 for ; Mon, 02 May 2016 13:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=snTOkkn5cVAozHMiEYV8t9NxZ8kHT3XVfCK2+a6q2MA=; b=o8UtdFaW2waJD19iKuXJB0m4RLmok7xJhAG4bvXMtQ5k4QIaZpPotnPAAv1W91iV50 T1T+i/88XU2Mx21WR8ETQKwGa9QyVaj+8G8UMZXJUBYBv6Pq1lkaoggKwRT7a8yoXmpB zFTjit/Arm1OREvw8jy5WXrtOONdy4oAROq7pv8kk026pxkJ2PEZPNxab17OFSgSkMte sP80ibcCfYPY8uTf20/4n7IRp1GYGRabfBSTLzOsaIecFQy5S4Bk3VzKf9jbQZr9dJM+ X3fiMElJWIoUII3jlwziyqlY+78kIzIBGIeJmW1WbJfb+x7TFnv5ng4fIQqjaztclR/T hJeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=snTOkkn5cVAozHMiEYV8t9NxZ8kHT3XVfCK2+a6q2MA=; b=fyQD5kH2AzNMGIKvG8+mFVRd1vbWRAqFFLvF8CwmCvr1Q5g0S6qrudfQG5qxEiQKyy 6j4XveVZWmrQ7v7YxTTljLc1Swx2BTlrdxcte6+6y6J4X/EUnDyGXuZ47cz91Rq9vVPS UyYE4ePRiQt9/FfaZ44DqmAi+Q4NP7S7GkkrxzEollbUyWjDDR2nLVBiaLoCuRmsZWDl Xkp7NPAQ7UblYdBhN/+NxUacyszoSwSFAR2LWUmOzQk3owtda2gYtJ+pTcd+3BG31MO8 2fzLNYzbceJNVb42BjSlWvsO+47KnuEQHENytJVbg3hBNf+AiQ5nhAYOi9lSt7Dk0dey fPRA== X-Gm-Message-State: AOPr4FVKmKgVWLMWqnY10KrCO69sbqsF2uoupQCCPHeF/vBIWkYBkITOBEiIbPuIU3e/1Q== X-Received: by 10.55.64.133 with SMTP id n127mr36643682qka.126.1462219289617; Mon, 02 May 2016 13:01:29 -0700 (PDT) Received: from cm.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id x189sm9587609qhb.43.2016.05.02.13.01.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 May 2016 13:01:29 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/amd/powerplay: revise reading/writing pptable on Tonga Date: Mon, 2 May 2016 16:00:53 -0400 Message-Id: <1462219259-29806-41-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1462219259-29806-1-git-send-email-alexander.deucher@amd.com> References: <1462219259-29806-1-git-send-email-alexander.deucher@amd.com> Cc: Eric Huang , Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Huang Change the way we store pptables in the driver to better facilitate eventual runtime updates for debugging. Reviewed-by: Alex Deucher Signed-off-by: Eric Huang Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 37 +++++++++++++++-------- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | 2 ++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 9040225..28f5c65 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c @@ -4443,17 +4443,14 @@ int tonga_reset_asic_tasks(struct pp_hwmgr *hwmgr) int tonga_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) { - if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) { - kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); - hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; - } + struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); - if (NULL != hwmgr->backend) { - kfree(hwmgr->backend); - hwmgr->backend = NULL; + if (data->soft_pp_table) { + kfree(data->soft_pp_table); + data->soft_pp_table = NULL; } - return 0; + return phm_hwmgr_backend_fini(hwmgr); } /** @@ -6058,18 +6055,34 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table) { struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); - *table = (char *)&data->smc_state_table; + if (!data->soft_pp_table) { + data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL); + if (!data->soft_pp_table) + return -ENOMEM; + memcpy(data->soft_pp_table, hwmgr->soft_pp_table, + hwmgr->soft_pp_table_size); + } + + *table = (char *)&data->soft_pp_table; - return sizeof(struct SMU72_Discrete_DpmTable); + return hwmgr->soft_pp_table_size; } static int tonga_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t size) { struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); - void *table = (void *)&data->smc_state_table; + if (!data->soft_pp_table) { + data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL); + if (!data->soft_pp_table) + return -ENOMEM; + } + + memcpy(data->soft_pp_table, buf, size); + + hwmgr->soft_pp_table = data->soft_pp_table; - memcpy(table, buf, size); + /* TODO: re-init powerplay to implement modified pptable */ return 0; } diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h index f88d3bb..c6a6b40 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h @@ -353,6 +353,8 @@ struct tonga_hwmgr { bool acp_power_gated; /* 1: gated, 0:not gated */ bool pg_acp_init; + /* soft pptable for re-uploading into smu */ + void *soft_pp_table; }; typedef struct tonga_hwmgr tonga_hwmgr;