From patchwork Fri Jul 28 10:47:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 9868459 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0877C6038F for ; Fri, 28 Jul 2017 10:48:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07B10288A0 for ; Fri, 28 Jul 2017 10:48:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0C49288B7; Fri, 28 Jul 2017 10:48:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E9A8288AF for ; Fri, 28 Jul 2017 10:48:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751757AbdG1KsF (ORCPT ); Fri, 28 Jul 2017 06:48:05 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47406 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751747AbdG1KsE (ORCPT ); Fri, 28 Jul 2017 06:48:04 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0F3D860AEE; Fri, 28 Jul 2017 10:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1501238884; bh=TOsvdKpTYJkvh6AGWNOl0ksIvZ6JJ9xVC1IDcRCTYJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJ3Yv2Rzm5efKWYGjz8qbnjtlrgHZ38auFnipCzHYYduGeBR/nKuVXrPk0tzyarNW bkUz7GBcYfH/qyxopl3A9RdQjD2XzdHt7VDK2xUQaSY0inX6pYPOSEGpQXsnpgM57a QahNZo9O1ibzl2oOi4FVm425EY1S2NMLcH3msldU= Received: from localhost (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: architt@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 61ECD60AD6; Fri, 28 Jul 2017 10:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1501238883; bh=TOsvdKpTYJkvh6AGWNOl0ksIvZ6JJ9xVC1IDcRCTYJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JM3PDawxT3jmkSBaKPPXfSN3oZOo1FtLYkpg7HL7Z4DhjciQhNYwOJ+93jXb/3RpM nj4G2kfDMplruueWqDhQXWeO6hWQ7RYdqXNs1nNxgi0se7x+HVyok0QCsjYsleLYOn g3amihh8Wf+u+lmZJYKANLev91RQyh8zsBcxXfHA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 61ECD60AD6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=architt@codeaurora.org From: Archit Taneja To: robdclark@gmail.com Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Archit Taneja Subject: [PATCH 10/10] drm/msm/adreno: Prevent unclocked access when retrieving timestamps Date: Fri, 28 Jul 2017 16:17:08 +0530 Message-Id: <20170728104708.20635-11-architt@codeaurora.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170728104708.20635-1-architt@codeaurora.org> References: <20170728104708.20635-1-architt@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP msm_gpu's get_timestamp() op (called by the MSM_GET_PARAM ioctl) can result in register accesses. We need our power domain and clocks to be active for that. Make sure they are enabled here. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index f1ab2703674a..7414c6bbd582 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -48,8 +48,15 @@ int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value) *value = adreno_gpu->base.fast_rate; return 0; case MSM_PARAM_TIMESTAMP: - if (adreno_gpu->funcs->get_timestamp) - return adreno_gpu->funcs->get_timestamp(gpu, value); + if (adreno_gpu->funcs->get_timestamp) { + int ret; + + pm_runtime_get_sync(&gpu->pdev->dev); + ret = adreno_gpu->funcs->get_timestamp(gpu, value); + pm_runtime_put_autosuspend(&gpu->pdev->dev); + + return ret; + } return -EINVAL; default: DBG("%s: invalid param: %u", gpu->name, param);