From patchwork Tue Apr 27 00:18:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 427785 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4161318jao; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5e8cIAxrpFe7wiYcGyojuqzMwMCWWhj1d2ptk6i9Z1gTOEJJkoNu+Ro33wtMU7t2zpdx2 X-Received: by 2002:a05:6402:510f:: with SMTP id m15mr1337666edd.328.1619482717178; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619482717; cv=none; d=google.com; s=arc-20160816; b=RITZ9UwgLtaPaCspXRAfKtu59QkJEIeEcPiYvs6GUgsGKyMhWdoFHd2hbyAMSrQpG/ Ze9hYjmyGSoQnQuYyy5yy4vVryjML5lLaIt+0GPtuRL0wXg1WXakKvpZazqETnYeZsE1 pZZ/IgPFXRzvzBqoHcjO/WrXf83I7NBTeEAhBOlHOluHWL/46zb/7x0eTqDglYqGcrWX tUe2EUG5Q4GHMQsSvAF66QnM/X7zk7zzXBD/5flauuECtm4dVhGDJOIQ3ENnnK07LFTC Gcut5vrGM7OAA2sk7gcbWfP9aa+XDrZ6k1noNkRgFIPHU53J0dG7QVrzlsNsfzXyjacC m8fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JwxuG74uhNga9fKZWEeeRqVpEDpXYceyiLB44T+ycoQ=; b=Dsj/HqoCC3zpsR5qMutku27E5RXRsR04ML4wjbulqqbkOzubaEgtKuhDiAcRlYV55K oF5iFwlsU3CrWkWrZ44zPPJEIlFvMPyIqhKskmzgcNqQ01nSqTmTZ4xd02Zc3sXjPoKt bm/IMcobw9nh/y2xUJ74sdFOGJhZa0stOlhnoYQUL/yhTTk2Fab93cNVcTZSFlQpThwy oMlJtQ+/91WCofUOWF8FN6+z4Jwf+swSAS6vwdDFlrQ3Fog2AJ3XZPf55lGEZxDO3d2N verZT478ZDrSo6enhtmOtKlar/8EfmPhlhE0tv0oJdzUAgwivon+uPr3m9P7YL+WVpxI pGVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpLSCFCE; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1063694edv.309.2021.04.26.17.18.36; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpLSCFCE; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234598AbhD0ATR (ORCPT + 17 others); Mon, 26 Apr 2021 20:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234602AbhD0ATQ (ORCPT ); Mon, 26 Apr 2021 20:19:16 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59056C061756 for ; Mon, 26 Apr 2021 17:18:32 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id d27so34155574lfv.9 for ; Mon, 26 Apr 2021 17:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JwxuG74uhNga9fKZWEeeRqVpEDpXYceyiLB44T+ycoQ=; b=dpLSCFCE3Zj3knOag1qpTpfNYYrNvVe1hJNcih/1b78uavs3DWyLrtGLitMCm9HLAo LjYEkoX4tHhypL4842jDbN75rUtqYBLqDCjlWwWX6QxnyhB9bEJBPfmG92PFT7LwfDp5 S5HJCjWchmFymozr1gCS7eO4ORFTaOPhJvWC9rkzXyTATjXtOIEd9MtDmaStXkjTsi38 A81DMy/tMVuX1iGtXB+G3drL6C68leMXWq+w423p/D42uemKZ78l7npxOTnGlT6mSH+J UktwcXnCoPj+DeQhCious7Fjkix2/oNaJfjJ3C0VMTHjytTDqgd+sOp0DzcT2Sbl6oPM sDtA== 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=JwxuG74uhNga9fKZWEeeRqVpEDpXYceyiLB44T+ycoQ=; b=NbAJ94wnWWWDXrNdVHGWl3xQuxWab29evzrdr/Z2EulDi0hEJ245TxEX/zWwPbunUW tNpXWdT+btKkcWlkU37Cq/0dWg3dAE9AMdWBSnoR8RrTyurcgeOlSlSiokZSOY8IGOAC D7c6zCBLDhlKcfh3+oyqF0/lNQ/6+C2uhc1DEk8bEbHElXwsqjgs6jYS/pa3Rn5PkNT8 M/CbGMY6pFw5zAfL9gfYJG+XHsJsTrS0fNbPtfqKf8Ad5bNaXVqQ6vOLt4W8IV1AdK4p zY0LCoLdawwQaHEnbDBus4cF/H0MCeMzaZqpj/2jnSKd/YSJHzyTYCxwZcYaKeK+tvYm HEeg== X-Gm-Message-State: AOAM531AwS40Q5UoHyL3RTR/yFTR7i+QM/SMQlp4JcyWMnNwjEGatNrX DH8bAUDxsHMR7IcjYkm/M2plxA== X-Received: by 2002:a05:6512:10c6:: with SMTP id k6mr6656918lfg.558.1619482710904; Mon, 26 Apr 2021 17:18:30 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id d15sm1555100lfn.7.2021.04.26.17.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 17:18:30 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 1/4] drm/msm: pass dump state as a function argument Date: Tue, 27 Apr 2021 03:18:25 +0300 Message-Id: <20210427001828.2375555-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> References: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of always getting the disp_state from drm device, pass it as an argument. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 5 +---- drivers/gpu/drm/msm/disp/msm_disp_snapshot.h | 8 -------- .../gpu/drm/msm/disp/msm_disp_snapshot_util.c | 17 +++-------------- drivers/gpu/drm/msm/dp/dp_display.c | 4 +--- drivers/gpu/drm/msm/dsi/dsi.c | 4 ++-- drivers/gpu/drm/msm/dsi/dsi.h | 4 ++-- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +----- drivers/gpu/drm/msm/msm_drv.h | 3 ++- drivers/gpu/drm/msm/msm_kms.h | 2 +- 9 files changed, 13 insertions(+), 40 deletions(-) -- 2.30.2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index ead247864c1b..e500a9294528 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -799,15 +799,12 @@ static void dpu_irq_uninstall(struct msm_kms *kms) dpu_core_irq_uninstall(dpu_kms); } -static void dpu_kms_mdp_snapshot(struct msm_kms *kms) +static void dpu_kms_mdp_snapshot(struct msm_disp_state *disp_state, struct msm_kms *kms) { int i; struct dpu_kms *dpu_kms; struct dpu_mdss_cfg *cat; struct dpu_hw_mdp *top; - struct msm_disp_state *disp_state; - - disp_state = kms->disp_state; dpu_kms = to_dpu_kms(kms); diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h index 7e075e799f0a..32f52799a1ba 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h @@ -104,14 +104,6 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev); */ void msm_disp_snapshot_state(struct drm_device *drm_dev); -/** - * msm_disp_state_get - get the handle to msm_disp_state struct from the drm device - * @drm: handle to drm device - - * Returns: handle to the msm_disp_state struct - */ -struct msm_disp_state *msm_disp_state_get(struct drm_device *drm); - /** * msm_disp_state_print - print out the current dpu state * @disp_state: handle to drm device diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c index 44dc68295ddb..ca6632550337 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -69,17 +69,6 @@ static void msm_disp_state_print_regs(u32 **reg, u32 len, void __iomem *base_add } } -struct msm_disp_state *msm_disp_state_get(struct drm_device *drm) -{ - struct msm_drm_private *priv; - struct msm_kms *kms; - - priv = drm->dev_private; - kms = priv->kms; - - return kms->disp_state; -} - void msm_disp_state_print(struct msm_disp_state *state, struct drm_printer *p) { struct msm_disp_state_block *block, *tmp; @@ -138,17 +127,17 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state) kms = priv->kms; if (priv->dp) - msm_dp_snapshot(priv->dp); + msm_dp_snapshot(disp_state, priv->dp); for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { if (!priv->dsi[i]) continue; - msm_dsi_snapshot(priv->dsi[i]); + msm_dsi_snapshot(disp_state, priv->dsi[i]); } if (kms->funcs->snapshot) - kms->funcs->snapshot(kms); + kms->funcs->snapshot(disp_state, kms); msm_disp_capture_atomic_state(disp_state); } diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 66705588f751..95d0bba7e172 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1009,15 +1009,13 @@ int dp_display_get_test_bpp(struct msm_dp *dp) dp_display->link->test_video.test_bit_depth); } -void msm_dp_snapshot(struct msm_dp *dp) +void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp) { struct dp_display_private *dp_display; struct drm_device *drm; - struct msm_disp_state *disp_state; dp_display = container_of(dp, struct dp_display_private, dp_display); drm = dp->drm_dev; - disp_state = msm_disp_state_get(drm); /* * if we are reading registers we need the link clocks to be on diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index bccc00603aa8..322d2e535df0 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -266,8 +266,8 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, return ret; } -void msm_dsi_snapshot(struct msm_dsi *msm_dsi) +void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi) { - msm_dsi_host_snapshot(msm_dsi->host); + msm_dsi_host_snapshot(disp_state, msm_dsi->host); } diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index e26223c3b6ec..b5679cf89413 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -91,7 +91,7 @@ static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi) return msm_dsi->panel || msm_dsi->external_bridge; } -void msm_dsi_snapshot(struct msm_dsi *msm_dsi); +void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi); struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi); @@ -149,7 +149,7 @@ int dsi_clk_init_v2(struct msm_dsi_host *msm_host); int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host); int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_dual_dsi); int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_dual_dsi); -void msm_dsi_host_snapshot(struct mipi_dsi_host *host); +void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host); /* dsi phy */ struct msm_dsi_phy; struct msm_dsi_phy_shared_timings { diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 899b6fc2b634..1a63368c3912 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2488,13 +2488,9 @@ struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host) return of_drm_find_bridge(msm_host->device_node); } -void msm_dsi_host_snapshot(struct mipi_dsi_host *host) +void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host) { struct msm_dsi_host *msm_host = to_msm_dsi_host(host); - struct drm_device *dev = msm_host->dev; - struct msm_disp_state *disp_state; - - disp_state = msm_disp_state_get(dev); pm_runtime_get_sync(&msm_host->pdev->dev); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9c40bac8a050..15cb34451ded 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -367,7 +367,8 @@ void msm_dp_display_mode_set(struct msm_dp *dp, struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); void msm_dp_irq_postinstall(struct msm_dp *dp_display); -void msm_dp_snapshot(struct msm_dp *dp_display); +struct msm_disp_state; +void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp_display); void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor); diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index b31fdad3f055..146dcab123f4 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -124,7 +124,7 @@ struct msm_kms_funcs { void (*destroy)(struct msm_kms *kms); /* snapshot: */ - void (*snapshot)(struct msm_kms *kms); + void (*snapshot)(struct msm_disp_state *disp_state, struct msm_kms *kms); #ifdef CONFIG_DEBUG_FS /* debugfs: */ From patchwork Tue Apr 27 00:18:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 427786 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4161325jao; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZh/n4/4eJ38aTTQTdY5sVfva+isB4gHZDtVQe8DVjfxBCxY9nyGEh3H03oJHnF2oNGQTu X-Received: by 2002:aa7:d596:: with SMTP id r22mr1345818edq.344.1619482717587; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619482717; cv=none; d=google.com; s=arc-20160816; b=Y9dTRdIINPrxHb5QVXP0D00998itDOfbiZ27kO941k58c2qHy7Milli7Pr9WussCS2 SBWnLH3P92TdbFYkjDR0vUophenP4NA2gBCt2HZH2QPVvhVyHrUk8RtNsDXYAAOX7nLE 2qDNs67KfEnAWgAKNhbdKyCSUC+K9r+Wm0rsXjbePKQMre1JofBAp8jpEBBl6UyaPC9k dTjItJnaeKxO3ZhOdP69dbRav+C2BVFbUjDolZJTjzImU1x3NICCGjC6JtYjynLsdV3r 5A0UpFGnBSbge+20k1wvIhtszXrI2SdVxIUWLyxaZ3zwCEd4p4qE6Oq/tdyjGWZl6MYJ uZFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SmqXEVY0K05AJs0W6VUF+U1KnwrNnhQJK7yss5Ei1AQ=; b=oqZHDEh98mYYU3Z5E2jRSZTBAThxhOJqle+LAs0ettVkjrRdPGdEZ3IaO+inBfVK59 mEw6A7jBoxV8B7FD92HLCICO858MztzA5oAEFolm455rjmE4PUXd64vS3hUwHgXp5Xpk uj0CtWIuV4WWsoZ1OpONQeMdlj0zGyY8TwufG7zP4tLA9aC9R/H9sArz1jlLDS0t59Ia z1bmxTUfE7xe05lHhyroNVanBai3C/v7P7PP3y5JyxddTeYfwo+YVM4wi48mMxZQH+Yp oNj2wF5Zke0Zy+qnXh7U+wQXvBXCVCkaXkGdG0IBTSUNgWH93pd8O1vttx54WdxT59RG x0mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ay4Ak4zX; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1063694edv.309.2021.04.26.17.18.37; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ay4Ak4zX; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234602AbhD0ATR (ORCPT + 17 others); Mon, 26 Apr 2021 20:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234700AbhD0ATR (ORCPT ); Mon, 26 Apr 2021 20:19:17 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F68C06175F for ; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id n138so91118768lfa.3 for ; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SmqXEVY0K05AJs0W6VUF+U1KnwrNnhQJK7yss5Ei1AQ=; b=ay4Ak4zXO5bcxQ8WR4YZ84A1nyD44jsM0S3d4HWrfZaEHWxrkBDxeeDkSCQ94wdiMS sBwIevJeERNLlbQsH/a4SCcRcFRuhbvZvvIhFRBTmsNvs0tQzpEblTn+WK94g4X0KBKV 34JMWMlV8jnqIWQfe4199kUG/ee8oVd3HPpn7KE9A6GsOQxziCKxXS3oz3P3qbQtutBL 4rqE2jPY+xgy8t4XUUv/noPNrzew4b6C+BYrpIAvEA5QVQieywZj3WRCRq1ZmMKwlZ8P 26FG9Msy/cUpSrmKMxIV0u3g5vffg2v4nkufwYgnntOV/gITIo4ZHF1TlSy+wqx4f3SK COnA== 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=SmqXEVY0K05AJs0W6VUF+U1KnwrNnhQJK7yss5Ei1AQ=; b=JGML1I1k0/yNPwTsxNCtAJenWd1LrZ6CqFgmxS+XaQpWtmKxWl70BTjI+B3ntGzLvg P9mTWF8OD6vt1lAWCdHO46A8zCgfAAZCkaIPLhoWdssf+jxDrFy1ltw/xrn0ZQ+7tYVT WBR/8TD01cUZ66jroeJzYbEBn2FqD2Y8vp4KrBjhoZWTp5AmWIWkajyTtsjKugH6cX78 KoiVvG1GSe7ypX2/c+TXQxDB33zBebI3DRrjH8hVXf5fH/kAoHQiKGQxWzaV3XyRet5F Khmj3NWRFA1fTvas1jN41HmQfGP8ZPTO2pKu8j7/nJUyGz7EiF8/bqAaxkYkeIl0shZo taqQ== X-Gm-Message-State: AOAM532AlfkKDtAekQxrtisOdVSr3n3CqVYoyV682XBd/VKbfCkQkQwQ 2CFhrXLX2jj+fsv1CG8EuIvVug== X-Received: by 2002:a19:ed19:: with SMTP id y25mr15402410lfy.44.1619482711782; Mon, 26 Apr 2021 17:18:31 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id d15sm1555100lfn.7.2021.04.26.17.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 17:18:31 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 2/4] drm/msm: make msm_disp_state transient data struct Date: Tue, 27 Apr 2021 03:18:26 +0300 Message-Id: <20210427001828.2375555-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> References: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of allocating snapshotting structure at the driver probe time and later handling concurrent access, actual state, etc, make msm_disp_state transient struct. Allocate one when snapshotting happens and free it after coredump data is read by userspace. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 90 ++++++------------- drivers/gpu/drm/msm/disp/msm_disp_snapshot.h | 13 +-- .../gpu/drm/msm/disp/msm_disp_snapshot_util.c | 5 +- drivers/gpu/drm/msm/msm_kms.h | 6 +- 4 files changed, 37 insertions(+), 77 deletions(-) -- 2.30.2 Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c index 70fd5a1fe13e..a4a7cb06bc87 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c @@ -7,8 +7,7 @@ #include "msm_disp_snapshot.h" -#ifdef CONFIG_DEV_COREDUMP -static ssize_t disp_devcoredump_read(char *buffer, loff_t offset, +static ssize_t __maybe_unused disp_devcoredump_read(char *buffer, loff_t offset, size_t count, void *data, size_t datalen) { struct drm_print_iterator iter; @@ -29,52 +28,47 @@ static ssize_t disp_devcoredump_read(char *buffer, loff_t offset, return count - iter.remain; } -static void disp_devcoredump_free(void *data) +static void _msm_disp_snapshot_work(struct kthread_work *work) { + struct msm_kms *kms = container_of(work, struct msm_kms, dump_work); + struct drm_device *drm_dev = kms->dev; struct msm_disp_state *disp_state; + struct drm_printer p; - disp_state = data; - - msm_disp_state_free(disp_state); + disp_state = kzalloc(sizeof(struct msm_disp_state), GFP_KERNEL); + if (!disp_state) + return; - disp_state->coredump_pending = false; -} -#endif /* CONFIG_DEV_COREDUMP */ + disp_state->dev = drm_dev->dev; + disp_state->drm_dev = drm_dev; -static void _msm_disp_snapshot_work(struct kthread_work *work) -{ - struct msm_disp_state *disp_state = container_of(work, struct msm_disp_state, dump_work); - struct drm_printer p; + INIT_LIST_HEAD(&disp_state->blocks); - mutex_lock(&disp_state->mutex); + /* Serialize dumping here */ + mutex_lock(&kms->dump_mutex); msm_disp_snapshot_capture_state(disp_state); + mutex_unlock(&kms->dump_mutex); + if (MSM_DISP_SNAPSHOT_DUMP_IN_CONSOLE) { p = drm_info_printer(disp_state->drm_dev->dev); msm_disp_state_print(disp_state, &p); } /* - * if devcoredump is not defined free the state immediately - * otherwise it will be freed in the free handler. + * If COREDUMP is disabled, the stub will call the free function. + * If there is a codedump pending for the device, the dev_coredumpm() + * will also free new coredump state. */ -#ifdef CONFIG_DEV_COREDUMP dev_coredumpm(disp_state->dev, THIS_MODULE, disp_state, 0, GFP_KERNEL, - disp_devcoredump_read, disp_devcoredump_free); - disp_state->coredump_pending = true; -#else - msm_disp_state_free(disp_state); -#endif - - mutex_unlock(&disp_state->mutex); + disp_devcoredump_read, msm_disp_state_free); } void msm_disp_snapshot_state(struct drm_device *drm_dev) { struct msm_drm_private *priv; struct msm_kms *kms; - struct msm_disp_state *disp_state; if (!drm_dev) { DRM_ERROR("invalid params\n"); @@ -83,30 +77,13 @@ void msm_disp_snapshot_state(struct drm_device *drm_dev) priv = drm_dev->dev_private; kms = priv->kms; - disp_state = kms->disp_state; - - if (!disp_state) { - DRM_ERROR("invalid params\n"); - return; - } - /* - * if there is a coredump pending return immediately till dump - * if read by userspace or timeout happens - */ - if (disp_state->coredump_pending) { - DRM_DEBUG("coredump is pending read\n"); - return; - } - - kthread_queue_work(disp_state->dump_worker, - &disp_state->dump_work); + kthread_queue_work(kms->dump_worker, &kms->dump_work); } int msm_disp_snapshot_init(struct drm_device *drm_dev) { struct msm_drm_private *priv; - struct msm_disp_state *disp_state; struct msm_kms *kms; if (!drm_dev) { @@ -117,22 +94,13 @@ int msm_disp_snapshot_init(struct drm_device *drm_dev) priv = drm_dev->dev_private; kms = priv->kms; - disp_state = devm_kzalloc(drm_dev->dev, sizeof(struct msm_disp_state), GFP_KERNEL); - - mutex_init(&disp_state->mutex); + mutex_init(&kms->dump_mutex); - disp_state->dev = drm_dev->dev; - disp_state->drm_dev = drm_dev; - - INIT_LIST_HEAD(&disp_state->blocks); - - disp_state->dump_worker = kthread_create_worker(0, "%s", "disp_snapshot"); - if (IS_ERR(disp_state->dump_worker)) + kms->dump_worker = kthread_create_worker(0, "%s", "disp_snapshot"); + if (IS_ERR(kms->dump_worker)) DRM_ERROR("failed to create disp state task\n"); - kthread_init_work(&disp_state->dump_work, _msm_disp_snapshot_work); - - kms->disp_state = disp_state; + kthread_init_work(&kms->dump_work, _msm_disp_snapshot_work); return 0; } @@ -141,7 +109,6 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev) { struct msm_kms *kms; struct msm_drm_private *priv; - struct msm_disp_state *disp_state; if (!drm_dev) { DRM_ERROR("invalid params\n"); @@ -150,12 +117,9 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev) priv = drm_dev->dev_private; kms = priv->kms; - disp_state = kms->disp_state; - - if (disp_state->dump_worker) - kthread_destroy_worker(disp_state->dump_worker); - list_del(&disp_state->blocks); + if (kms->dump_worker) + kthread_destroy_worker(kms->dump_worker); - mutex_destroy(&disp_state->mutex); + mutex_destroy(&kms->dump_mutex); } diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h index 32f52799a1ba..c6174a366095 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h @@ -41,26 +41,17 @@ * struct msm_disp_state - structure to store current dpu state * @dev: device pointer * @drm_dev: drm device pointer - * @mutex: mutex to serialize access to serialze dumps, debugfs access - * @coredump_pending: coredump is pending read from userspace * @atomic_state: atomic state duplicated at the time of the error - * @dump_worker: kworker thread which runs the dump work - * @dump_work: kwork which dumps the registers and drm state * @timestamp: timestamp at which the coredump was captured */ struct msm_disp_state { struct device *dev; struct drm_device *drm_dev; - struct mutex mutex; - - bool coredump_pending; struct list_head blocks; struct drm_atomic_state *atomic_state; - struct kthread_worker *dump_worker; - struct kthread_work dump_work; ktime_t timestamp; }; @@ -123,11 +114,11 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state); /** * msm_disp_state_free - free the memory after the coredump has been read - * @disp_state: handle to struct msm_disp_state + * @data: handle to struct msm_disp_state * Returns: none */ -void msm_disp_state_free(struct msm_disp_state *disp_state); +void msm_disp_state_free(void *data); /** * msm_disp_snapshot_add_block - add a hardware block with its register dump diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c index ca6632550337..cabe15190ec1 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -142,8 +142,9 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state) msm_disp_capture_atomic_state(disp_state); } -void msm_disp_state_free(struct msm_disp_state *disp_state) +void msm_disp_state_free(void *data) { + struct msm_disp_state *disp_state = data; struct msm_disp_state_block *block, *tmp; if (disp_state->atomic_state) { @@ -156,6 +157,8 @@ void msm_disp_state_free(struct msm_disp_state *disp_state) kfree(block->state); kfree(block); } + + kfree(disp_state); } void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len, diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 146dcab123f4..086a2d59b8c8 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -156,8 +156,10 @@ struct msm_kms { /* mapper-id used to request GEM buffer mapped for scanout: */ struct msm_gem_address_space *aspace; - /* handle to disp snapshot state */ - struct msm_disp_state *disp_state; + /* disp snapshot support */ + struct kthread_worker *dump_worker; + struct kthread_work dump_work; + struct mutex dump_mutex; /* * For async commit, where ->flush_commit() and later happens From patchwork Tue Apr 27 00:18:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 427784 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4161315jao; Mon, 26 Apr 2021 17:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6Qetqfy1xAFpFI1ccXZKYitKIBmxAoVpKjP8K/JojIdW/e0Zb0ZfBX/bvJPkgc5XeAIA8 X-Received: by 2002:a17:906:4098:: with SMTP id u24mr2815781ejj.228.1619482716762; Mon, 26 Apr 2021 17:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619482716; cv=none; d=google.com; s=arc-20160816; b=vR4MYfVVLeqK349MYtbaMC4FlNSotEoxbcZ7ppskCc0igYahDwq1+6gL6GiE5i8JxF YvzTIOzNv8i6xyxCciPgAAgS1B2HdvHOx6QrTW2YB1nkM8L+kHXpzEVypOBvDM3owIiu TB9IdbfmWwNu9SbC+QK+0sBAnL0Fdb0YXS90OVpbQ1EKtj2s23YxKytyyq9Twc+jB2BU SOYi6pZEd3NvyXEEaJGUfyYoxR8AvAk33WbVqa7rPQBgUizZAW1Db5/Lhz7oewYNF4NS gz3RTmsrPD7n6ZVQBgX69CDq1T2zb4BIZ5tSa/CBRIMnqeXOb0CRUvrIN3k9FdMh6yqQ 3R1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ijc1U+UMGqLkSaCADs8rAj5/EZ+DPFy6/09GaffQN1o=; b=vjaH7/6ItM8G7BHTPUUQBFozxd2dF7IHxA+b4IiLgcrcVCJ/vcZqn8nWBKzY2/LMQr 9Vav7b3F+r/cJBV09BXHdTYwdcdK2T02GEHXMzyXUPkLduq4iL6Yc11aDgt078UyINzr x1KRU/I2dUBz2bRnPsa4sUS8kv7mptaAToW0+cn7XCQXZVih95WPjSNLTjucVJyTqEk2 oODtQn7Dc2eVrWQk9RPs7L5MkXBvQHogSIYl42tkj9P/Afk0LFtA9zG61FJOAA8xUT48 iilMoXAr3IjveBRQbvmXiB6m1Y05VGNQOxzpZRWHgFg/W/1CKRvxrfB4YzkCqR5hCBap H3ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsAPPWmI; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1063694edv.309.2021.04.26.17.18.36; Mon, 26 Apr 2021 17:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsAPPWmI; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232161AbhD0ATR (ORCPT + 17 others); Mon, 26 Apr 2021 20:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234598AbhD0ATQ (ORCPT ); Mon, 26 Apr 2021 20:19:16 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA0AC061760 for ; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id b23so8411800lfv.8 for ; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ijc1U+UMGqLkSaCADs8rAj5/EZ+DPFy6/09GaffQN1o=; b=tsAPPWmIh2Z+c2VWBZfDmS2mvJxS4xPgUWE5z0UBkAIO5yIis4Pk2zgQiHwxH/gxoS 5PnWjb4K3/SFTLLo8cLuOyM6cDMuBEDRiHmppIxido3wuBErjItr3dECIG31YUX9Xdhr 7+42G+2c/XaDNYf7WtDqabnvAeLSh/mNNGUPyLpmhyP0NivSEAYAWpLwmm053LKbIL1A pAMjDhuIs4IEeAwLlFGl+mR60+WvCNLxwNF4OAHo5XVtkdtXC9mkjRpOP6bAvmpjY/Ie NlveQolNEf7fmaRRx9kxGpFsC1dvIEa/86tqDyoslMMUHshTwNGlG8D4PgJPc1RY2crD mr4g== 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=ijc1U+UMGqLkSaCADs8rAj5/EZ+DPFy6/09GaffQN1o=; b=TkTGitQS6H58Lo3nnW9Wp+ONxNoz8hqOzkeNCrar3KqcqqwSKpfm9HM8Kr6or037xz eY0HteyY/1vwIqdn8rJxWXelixLy7+pcjMC169ymHQb0uMELuatfLP839c2gN8yAOsgy PxKW25A18GjHhiGvW7G6L+B35LvuYlcxKaqBkzKIvFSC4q8s4gJt0OD31HWSPgzVBGqt zjXWZYLsfPVSn2qanJZ9vXkhMt7IHN53yM+X28osSDVw8Pi9EuCOkKRhjbtdJHPGoyTn ZeE0P1OI3/1lVSpv6EGNmuniV2xzduae6Jzwhmj9Ozc2opj3Xr4c74egvRrHQ8YkExDs UYWg== X-Gm-Message-State: AOAM533m1mEdOFDA5bFRdCZi75vSnqbeqKQj/CeALp2RAcEOhMmD5Wkw sh6vniN7bmCSXH0fTDhG8vx8qg== X-Received: by 2002:a19:ad41:: with SMTP id s1mr14570479lfd.306.1619482712483; Mon, 26 Apr 2021 17:18:32 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id d15sm1555100lfn.7.2021.04.26.17.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 17:18:32 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 3/4] drm/msm: get rid of msm_iomap_size Date: Tue, 27 Apr 2021 03:18:27 +0300 Message-Id: <20210427001828.2375555-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> References: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of looping throught the resources each time to get the DSI CTRL area size, get it at the ioremap time. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi_host.c | 5 +++-- drivers/gpu/drm/msm/msm_drv.c | 27 +++++++++------------------ drivers/gpu/drm/msm/msm_drv.h | 3 ++- 3 files changed, 14 insertions(+), 21 deletions(-) -- 2.30.2 Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 1a63368c3912..b3ee5c0bce12 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -102,6 +102,7 @@ struct msm_dsi_host { int id; void __iomem *ctrl_base; + phys_addr_t ctrl_size; struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; struct clk *bus_clks[DSI_BUS_CLK_MAX]; @@ -1839,7 +1840,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) goto fail; } - msm_host->ctrl_base = msm_ioremap(pdev, "dsi_ctrl", "DSI CTRL"); + msm_host->ctrl_base = msm_ioremap_size(pdev, "dsi_ctrl", "DSI CTRL", &msm_host->ctrl_size); if (IS_ERR(msm_host->ctrl_base)) { pr_err("%s: unable to map Dsi ctrl base\n", __func__); ret = PTR_ERR(msm_host->ctrl_base); @@ -2494,7 +2495,7 @@ void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_ho pm_runtime_get_sync(&msm_host->pdev->dev); - msm_disp_snapshot_add_block(disp_state, msm_iomap_size(msm_host->pdev, "dsi_ctrl"), + msm_disp_snapshot_add_block(disp_state, msm_host->ctrl_size, msm_host->ctrl_base, "dsi%d_ctrl", msm_host->id); pm_runtime_put_sync(&msm_host->pdev->dev); diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 92fe844b517b..be578fc4e54f 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -124,7 +124,7 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name) } static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name, - const char *dbgname, bool quiet) + const char *dbgname, bool quiet, phys_addr_t *psize) { struct resource *res; unsigned long size; @@ -153,37 +153,28 @@ static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name if (reglog) printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size); + if (psize) + *psize = size; + return ptr; } void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, const char *dbgname) { - return _msm_ioremap(pdev, name, dbgname, false); + return _msm_ioremap(pdev, name, dbgname, false, NULL); } void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name, const char *dbgname) { - return _msm_ioremap(pdev, name, dbgname, true); + return _msm_ioremap(pdev, name, dbgname, true, NULL); } -unsigned long msm_iomap_size(struct platform_device *pdev, const char *name) +void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, + const char *dbgname, phys_addr_t *psize) { - struct resource *res; - - if (name) - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); - else - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_dbg(&pdev->dev, "failed to get memory resource: %s\n", - name); - return 0; - } - - return resource_size(res); + return _msm_ioremap(pdev, name, dbgname, false, psize); } void msm_writel(u32 data, void __iomem *addr) diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 15cb34451ded..c33fc1293789 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -450,9 +450,10 @@ struct clk *msm_clk_bulk_get_clock(struct clk_bulk_data *bulk, int count, const char *name); void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, const char *dbgname); +void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, + const char *dbgname, phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name, const char *dbgname); -unsigned long msm_iomap_size(struct platform_device *pdev, const char *name); void msm_writel(u32 data, void __iomem *addr); u32 msm_readl(const void __iomem *addr); void msm_rmw(void __iomem *addr, u32 mask, u32 or); From patchwork Tue Apr 27 00:18:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 427787 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4161332jao; Mon, 26 Apr 2021 17:18:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHL2elze2UXOewgzAnrJRpFqsQA/iYaBjdiosi74MDDbK86F1DgzBvpj1y0tw8ZtfIr1ep X-Received: by 2002:a17:906:168f:: with SMTP id s15mr20915008ejd.144.1619482717997; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619482717; cv=none; d=google.com; s=arc-20160816; b=ygxM53OaBFKxk8amEQiVsqPPIQKg9J28mkZ0JN0g9Nb/Gy6WbpZi3U2QO3OQynf6Os nOjL6xanwKM7gBoIjMVwuG1jbIBV8MZQM2ixoYL3qdhUhDN2eW5TlvjPu9NoI03saFhi aaSnwFSOkqiOUszEdiEo02zhs88pip1rl5qasSTNyrtT58hSBSOHDMr4Kn1roKawanYD oeGfnSk4/B8V2IFo+6RCXkLRP521K57x0e1bEt3ILdRxmTGr6at6xtPLHw22MA7OU4iy ag7qXiRQkMF6yDxK1FIURfhE8+/coF334rBXi0fJugx/wG5JwhDhs9PZOcTuvh/2HBsF m9ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ajAD9eEucAq/1mj2QhjuXHx0IT7uBG4GS9vHJTuXZCg=; b=YSDG0NyU86Si7e29Q415WMWg6+dNBY/s99vX43M7y2w+J0v0AZmlawRvgK4eH/YnGa WnVzRPnvcc9E5nybiVojPh59badYqHyO80YzxlfqM2QnBUGvgIAdIUT4Tq6nj4QJceoF KbOdnxwsEPgUcEe4vx7r8oZe2P7Xmbpzkbx333N9bxXq5PIPqTa/sMD+lUl1K0PbEI++ 1d6L2Kacu1GWA0xryfnAJbMLXQaO22/E3oBfOctxfObzVNDKCNRRzs7hrXmkiAixvKJQ F24SrMCuOrsKqxtui2CxM1xLYw1Fuw7/OTzczoHwfE3vZ639M6XSHImYfcKJ5YsEwfM+ WcgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=veIkUjYb; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1063694edv.309.2021.04.26.17.18.37; Mon, 26 Apr 2021 17:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=veIkUjYb; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234743AbhD0ATT (ORCPT + 17 others); Mon, 26 Apr 2021 20:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234700AbhD0ATS (ORCPT ); Mon, 26 Apr 2021 20:19:18 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A58ABC061574 for ; Mon, 26 Apr 2021 17:18:34 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id x19so60613388lfa.2 for ; Mon, 26 Apr 2021 17:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ajAD9eEucAq/1mj2QhjuXHx0IT7uBG4GS9vHJTuXZCg=; b=veIkUjYbGsXFLfQzNqOMf3rMngJ8Yy5CmQ7h+rGuCVoJip6z3Y0JgAwqUiRgZ74X5m zaio9b21O+I5ccOeoJ/qWXjybtpCu5n7mJSpt51gi/QTsYG10UdjLhepB+eGE8TrDwHX COPXpCX6UDDXQVsjKRJwF84qDdkoOxyAhvp0Iuc3fwyGMwCrGITFoSOvG9y9DMPu4x8I 5FAcl4aWJkaGn/0ICC/p9am2jvZvttzC3rnSfoi6RWzOu4jaEadNmxMg44ftAGUubBeP g4AWcVBjVCk+FPW5J1JOfQdvMJvw7bfT9Xz2HvpfBgA0O+epOXTfsNxc7RfrMqhYze0R kElA== 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=ajAD9eEucAq/1mj2QhjuXHx0IT7uBG4GS9vHJTuXZCg=; b=lc3n5m3uJWCFIwWhoEEBMWrBSXNgHiyFNI6Vvhw8TuxbaVkENOesfBqq2OxJcxzY4F w8TqDnRdoEvCBzinVxR6eKpc9XGgYikdqFV3JSjIPq/tlG7zK7eYFtkYh01GYettIZVT 0Q1PMaNiBzem2wDMisaPXQfnW2pf67lsK5SbSqNhbLwnwRsiHeSOMUy59M5O831+FjI9 jtFN1Y/xCc1HPDJjFmg9f236vvrnFkwhyp2VmfFIEBGS5ejkCaSQqO0Lh0o/mjlgaqrS GKmyab2ZuQmEZ067GTl4OXasoNBlky7FdL8OqrDDUtP7+/6pgSYYwfQgMC8NzFAuTCjs yLyQ== X-Gm-Message-State: AOAM531dPcbjjlrHSYC74urJysUk2RuFzChDuUV6AUToxZJLm2j28adg QEtft/aMG6xfvCWGt2gdSdOx2Q== X-Received: by 2002:ac2:58c6:: with SMTP id u6mr14274684lfo.419.1619482713215; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id d15sm1555100lfn.7.2021.04.26.17.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 17:18:32 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 4/4] drm/msm/dsi: add DSI PHY registers to snapshot data Date: Tue, 27 Apr 2021 03:18:28 +0300 Message-Id: <20210427001828.2375555-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> References: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add DSI PHY registers to the msm state snapshots to be able to check their contents. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi.h | 1 + drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 31 +++++++++++++++++++++++---- drivers/gpu/drm/msm/dsi/phy/dsi_phy.h | 4 ++++ 4 files changed, 33 insertions(+), 4 deletions(-) -- 2.30.2 Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 322d2e535df0..75afc12a7b25 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -269,5 +269,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi) { msm_dsi_host_snapshot(disp_state, msm_dsi->host); + msm_dsi_phy_snapshot(disp_state, msm_dsi->phy); } diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index b5679cf89413..cea73f9c4be9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -176,6 +176,7 @@ int msm_dsi_phy_get_clk_provider(struct msm_dsi_phy *phy, struct clk **byte_clk_provider, struct clk **pixel_clk_provider); void msm_dsi_phy_pll_save_state(struct msm_dsi_phy *phy); int msm_dsi_phy_pll_restore_state(struct msm_dsi_phy *phy); +void msm_dsi_phy_snapshot(struct msm_disp_state *disp_state, struct msm_dsi_phy *phy); #endif /* __DSI_CONNECTOR_H__ */ diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index f0a2ddf96a4b..bf7a4c20c13c 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -658,14 +658,14 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) phy->regulator_ldo_mode = of_property_read_bool(dev->of_node, "qcom,dsi-phy-regulator-ldo-mode"); - phy->base = msm_ioremap(pdev, "dsi_phy", "DSI_PHY"); + phy->base = msm_ioremap_size(pdev, "dsi_phy", "DSI_PHY", &phy->base_size); if (IS_ERR(phy->base)) { DRM_DEV_ERROR(dev, "%s: failed to map phy base\n", __func__); ret = -ENOMEM; goto fail; } - phy->pll_base = msm_ioremap(pdev, "dsi_pll", "DSI_PLL"); + phy->pll_base = msm_ioremap_size(pdev, "dsi_pll", "DSI_PLL", &phy->pll_size); if (IS_ERR(phy->pll_base)) { DRM_DEV_ERROR(&pdev->dev, "%s: failed to map pll base\n", __func__); ret = -ENOMEM; @@ -673,7 +673,7 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) } if (phy->cfg->has_phy_lane) { - phy->lane_base = msm_ioremap(pdev, "dsi_phy_lane", "DSI_PHY_LANE"); + phy->lane_base = msm_ioremap_size(pdev, "dsi_phy_lane", "DSI_PHY_LANE", &phy->lane_size); if (IS_ERR(phy->lane_base)) { DRM_DEV_ERROR(&pdev->dev, "%s: failed to map phy lane base\n", __func__); ret = -ENOMEM; @@ -682,7 +682,7 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) } if (phy->cfg->has_phy_regulator) { - phy->reg_base = msm_ioremap(pdev, "dsi_phy_regulator", "DSI_PHY_REG"); + phy->reg_base = msm_ioremap_size(pdev, "dsi_phy_regulator", "DSI_PHY_REG", &phy->reg_size); if (IS_ERR(phy->reg_base)) { DRM_DEV_ERROR(&pdev->dev, "%s: failed to map phy regulator base\n", __func__); ret = -ENOMEM; @@ -868,3 +868,26 @@ int msm_dsi_phy_pll_restore_state(struct msm_dsi_phy *phy) return 0; } + +void msm_dsi_phy_snapshot(struct msm_disp_state *disp_state, struct msm_dsi_phy *phy) +{ + msm_disp_snapshot_add_block(disp_state, + phy->base_size, phy->base, + "dsi%d_phy", phy->id); + + /* Do not try accessing PLL registers if it is switched off */ + if (phy->pll_on) + msm_disp_snapshot_add_block(disp_state, + phy->pll_size, phy->pll_base, + "dsi%d_pll", phy->id); + + if (phy->lane_base) + msm_disp_snapshot_add_block(disp_state, + phy->lane_size, phy->lane_base, + "dsi%d_lane", phy->id); + + if (phy->reg_base) + msm_disp_snapshot_add_block(disp_state, + phy->reg_size, phy->reg_base, + "dsi%d_reg", phy->id); +} diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h index 94a77ac364d3..5b0feef87127 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h @@ -85,6 +85,10 @@ struct msm_dsi_phy { void __iomem *pll_base; void __iomem *reg_base; void __iomem *lane_base; + phys_addr_t base_size; + phys_addr_t pll_size; + phys_addr_t reg_size; + phys_addr_t lane_size; int id; struct clk *ahb_clk;