From patchwork Mon Aug 17 22:01:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 250637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BA57C433DF for ; Mon, 17 Aug 2020 22:02:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB3C420674 for ; Mon, 17 Aug 2020 22:02:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xb1xHUOT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728312AbgHQWC6 (ORCPT ); Mon, 17 Aug 2020 18:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729322AbgHQWCj (ORCPT ); Mon, 17 Aug 2020 18:02:39 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869F4C061389; Mon, 17 Aug 2020 15:02:39 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id l60so8462174pjb.3; Mon, 17 Aug 2020 15:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QZSqosPE87e929PMVaJawJzeXi6lq5p/xdY765Ye8VY=; b=Xb1xHUOTotXSCyxa8jjfe45ZOkedLPRBfnNAWdc9VHQVozfEpoDsguD9Ab6aSRr3AJ rv51QvUf8MsSYAM9DRvg0NChRIAO0dhx6Y+TcgycrHOIlvE75qKuUqZLMUjZBsRrCMd+ 2iE+Rcgv1avwdUT6N95hNIhEUrijPn3ydjvnNdhSgZN/RbxJ/Jf7JfM/s+8MvMtNMBc8 nqKlD9GgKav3fy5RjUVrn9Nf99rGyWxanpiAPrpjTyMfjJoifSw1BIQaa2kvWsdsGrGr HAUcfaeQP11X4uf14OQW4pFa63h7PG1aLNrpfaTbGhQxCzdybkwR5etaxG8DAkHzTsRu 2vJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QZSqosPE87e929PMVaJawJzeXi6lq5p/xdY765Ye8VY=; b=TbFKs1L51zmS0Wv4cnyEMBQsXKc8ZlrapJRpxP+kzffGwkqpKH1UfSueMuQ3Ix9NuM H464Y5iMZ/uPQ1RuHSqBgXUq8rhad9Hba/ESs4o4HNPHshdACl5+bSgirycDf0K8cXk9 JY3jKQ6Yrjo4LzA4lgSSORR/Z6bf6bo7CED30Opm42kbN5/haOHpoXgOrX81xcLPTFU1 hXaC7HoDiElnAFKVqypq8319Q0uQfpFkJbjS/L758aP5d0X+YW3eKhPXrbBbpClq6qfT HsMyrVDLrJB9jjxjKfQMLTRDBDCYAxrHsqQ4GKhEz/ktzlDBP72ovV0XNptZpRyjQqi1 FBIA== X-Gm-Message-State: AOAM531xFZo1f52wELP44/AZ65oZeWd7QhTsxi+teWSXtA56cS2kNWQ1 +QT/GLlBF0LigAJYjmWYbctzyOANelvSokA6 X-Google-Smtp-Source: ABdhPJyDCeI07xcIqj4wzprJJRUMrONZ1jmyklTb2+yifvryc/EFsttDdWQQr1OujvvTdZvogkxG+Q== X-Received: by 2002:a17:902:8c8a:: with SMTP id t10mr12862831plo.112.1597701759014; Mon, 17 Aug 2020 15:02:39 -0700 (PDT) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id l22sm18701560pjy.31.2020.08.17.15.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 15:02:37 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-arm-msm@vger.kernel.org Cc: Sai Prakash Ranjan , Will Deacon , freedreno@lists.freedesktop.org, Bjorn Andersson , Sibi Sankar , Vivek Gautam , Stephen Boyd , Robin Murphy , Joerg Roedel , Rob Clark , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jordan Crouse , Jonathan Marek , Sharat Masetty , AngeloGioacchino Del Regno , Shawn Guo , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 07/20] drm/msm: set adreno_smmu as gpu's drvdata Date: Mon, 17 Aug 2020 15:01:32 -0700 Message-Id: <20200817220238.603465-8-robdclark@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200817220238.603465-1-robdclark@gmail.com> References: <20200817220238.603465-1-robdclark@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark This will be populated by adreno-smmu, to provide a way for coordinating enabling/disabling TTBR0 translation. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 -- drivers/gpu/drm/msm/msm_gpu.c | 2 +- drivers/gpu/drm/msm/msm_gpu.h | 6 +++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c index 26664e1b30c0..58e03b20e1c7 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_device.c +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -417,8 +417,6 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) return PTR_ERR(gpu); } - dev_set_drvdata(dev, gpu); - return 0; } diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 6aa9e04e52e7..806eb0957280 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -892,7 +892,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, gpu->gpu_cx = NULL; gpu->pdev = pdev; - platform_set_drvdata(pdev, gpu); + platform_set_drvdata(pdev, &gpu->adreno_smmu); msm_devfreq_init(gpu); diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 8bda7beaed4b..f91b141add75 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -7,6 +7,7 @@ #ifndef __MSM_GPU_H__ #define __MSM_GPU_H__ +#include #include #include #include @@ -73,6 +74,8 @@ struct msm_gpu { struct platform_device *pdev; const struct msm_gpu_funcs *funcs; + struct adreno_smmu_priv adreno_smmu; + /* performance counters (hw & sw): */ spinlock_t perf_lock; bool perfcntr_active; @@ -143,7 +146,8 @@ struct msm_gpu { static inline struct msm_gpu *dev_to_gpu(struct device *dev) { - return dev_get_drvdata(dev); + struct adreno_smmu_priv *adreno_smmu = dev_get_drvdata(dev); + return container_of(adreno_smmu, struct msm_gpu, adreno_smmu); } /* It turns out that all targets use the same ringbuffer size */