From patchwork Sat Sep 5 20:04:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 250386 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.8 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, URIBL_BLOCKED, 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 3EDD8C2BBD0 for ; Sat, 5 Sep 2020 20:04:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A55B2073B for ; Sat, 5 Sep 2020 20:04:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rBj7GWcc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728718AbgIEUEN (ORCPT ); Sat, 5 Sep 2020 16:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728400AbgIEUEL (ORCPT ); Sat, 5 Sep 2020 16:04:11 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E6EFC061244; Sat, 5 Sep 2020 13:04:11 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id y6so224775plt.9; Sat, 05 Sep 2020 13:04:11 -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=eBuEDGfYTy5PPn1RDxCycEVRZJaKkkv9eSmYF9/QNHA=; b=rBj7GWccfosFE5ZBxHIGrVT0r+K4byI3/hnMfzfkdhsP6dHgrnWuatoE2Hcu7egNBN h48KLqcTSVasryom6dH1s1FsCm7iVkSfNO5vxZ24cjYQukx8Rpw0AhWlHnw5qtymJCDK xyhsJ63y+KWEcozt1vkTgde5z8ha20eAV2xWI/GdqdGcD26kwh2Dzmv3NL4uxcU3OA9X BzEcSbi/GINB8iau0JS5h8q+00AELGfirlHFP6u6q0FJORf1fToSiXMSROk0DoLPblam zCpkMoPjbkHSs3rSmkVoM/8nn1REWd32/nW7NKiY1NEuTnI13gcJ8L6WnEsegmWrQQTE 7FVg== 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=eBuEDGfYTy5PPn1RDxCycEVRZJaKkkv9eSmYF9/QNHA=; b=eqlc3k8fzjRXOmFvVnWx1BNlz6HC3+Nkuevfb3+CK/a9NOIp47ewNFxG0L31BmlxpR aFFP5UgEjPpxdJxalK+7QGIJ9WyXxZ1v1f402HFsCW35uV/wSZMpbnxdS6fh5AZ8yF+1 lH8OLSBS8ZyoPZW5uGmEYONntJhZTQwvVUhj1IUQ6JMxX2gdkgU+QwFW+7C9Y4s8PL9t ckjvffq5QNCPMQQQC1xHvrOgw7Y86e6pz3+Dr6FsVC5cvtwRd/Ye4T2OdVkfomt1bZD1 qfgaYxXx7o9weT+MBRlr79MnJhKM2QBuqInT1apcuyaIkfGF+/jeu0TvWwSrn7cjwRdg BrzQ== X-Gm-Message-State: AOAM532/LxvKR0iFjLs5gp3a4fkxKfPHNn2NGMq35+fCA4ueIyz5QHug IR37Ekz7TLSk7o/N84tfldSWmH4AUEXPrL6oy1k= X-Google-Smtp-Source: ABdhPJzbfLaU/Mp1zLSe6ZuOihRa4QPrTK7zg3slAeaOAvr6/R99b+0gyQAeENp1hLMOVDs8q3JHEw== X-Received: by 2002:a17:90a:e545:: with SMTP id ei5mr5624951pjb.45.1599336250560; Sat, 05 Sep 2020 13:04:10 -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 u3sm8034863pjn.29.2020.09.05.13.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 13:04:09 -0700 (PDT) From: Rob Clark To: iommu@lists.linux-foundation.org, dri-devel@lists.freedesktop.org, Will Deacon , Robin Murphy , Joerg Roedel Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Bjorn Andersson , Sibi Sankar , Vivek Gautam , Stephen Boyd , Akhil P Oommen , Rob Clark , Jordan Crouse , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jonathan Marek , Shawn Guo , AngeloGioacchino Del Regno , Sharat Masetty , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v17 04/20] drm/msm: Set adreno_smmu as gpu's drvdata Date: Sat, 5 Sep 2020 13:04:10 -0700 Message-Id: <20200905200454.240929-5-robdclark@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200905200454.240929-1-robdclark@gmail.com> References: <20200905200454.240929-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 Reviewed-by: Jordan Crouse Reviewed-by: Bjorn Andersson --- 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 4c67aedc5c33..144dd63e747e 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 da1ae2263047..1f65aec57a8f 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 @@ -74,6 +75,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; @@ -146,7 +149,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 */