Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1568643iob; Thu, 5 May 2022 04:17:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF00OTGjhYKjbCuxII2xWbk6YVz8e7+e9wPZFY4TwBJ8wcD7C6m1VX0ztT9z/Db+A/8Wqt X-Received: by 2002:a17:902:db05:b0:15e:89c9:e805 with SMTP id m5-20020a170902db0500b0015e89c9e805mr26738254plx.107.1651749455726; Thu, 05 May 2022 04:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651749455; cv=none; d=google.com; s=arc-20160816; b=Om2NT7wj/VPLnZvLkYhB2pFFJ0VqTa++fn1YqbdRSoS7DVQjYri+pLKPCBCkTDlh84 l4uEhcBiIZSpmSLhswlUPd3e4duGwKqfAEAYZCfgjKKEArETXTBy0IWZThD8UwCUib68 6VQgP8GD+B331PRVDO9GJwIn4LUfN1ngfq3xrsnTbZjNgDnoeBG6N6XLNRqZwGQ+ZLgR 3Ox9jf2LivLFQmU1VZ3kmmAOLScNpuJfR75pjMTe7CdfoMAYKXyVAc4Z9uGk/vFUiz2J HFAoXwyKNMkpm0qThNUPhvNQf+Sw85L/DRfi6Ld4+XaGCHl7AGOp0pOuPv+BZz4uFic/ Bl1w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=dijXTkiQHrfrlF4ID+znm8V5fZSPJC1gmyuClDGbRpM=; b=acN2zP/MsdfdwLB56acyN1p9YTioUbZKeKERxcY2lqXz8SlLN5gffEjrLwI/6VEtae 7GNppqHbcUp7sm8k0bG4sI65fgS59sRyokqsiFpkNezI8VdWt1T0JH54DxLbKf34LoFA sMbBAKr0PHJquoVXN2p11d4Atqj4dK3gChwMFuBRJrphVqtWnZvirqXbUj4uYM8NxrC4 kw3aa59YeM9qgJHACE56JCmbaTzSRZcgKE2XvWHqFrSaZb1wXkiBd/JjPCRJDCdCMy78 IxRpoX1rrTcBpgtsglAeR5ki7+UENp3v38KXoSGkEOQgz3Ogj+fH38yIUdNwLfEP3Dnn W24g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KnQUKihb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a65594b000000b003ab2f9d11d3si1314730pgu.596.2022.05.05.04.17.20; Thu, 05 May 2022 04:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KnQUKihb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379107AbiEDWxP (ORCPT + 99 others); Wed, 4 May 2022 18:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346758AbiEDWxJ (ORCPT ); Wed, 4 May 2022 18:53:09 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 129D253724 for ; Wed, 4 May 2022 15:49:31 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id x52so2232490pfu.11 for ; Wed, 04 May 2022 15:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dijXTkiQHrfrlF4ID+znm8V5fZSPJC1gmyuClDGbRpM=; b=KnQUKihb/oVI0KbzvzptyFH6gHyzwx78tuSQzyxRYYtkAIdDOZTWZhlQZhLFlBeWOp j8RKG5i1b4ugEU754VQCuM8t49ONqK8c8R+I2vGT2BEGRs92ej0IZ2N9VXvkWqu4ClDi Diq2ZeuXYyv4WvhnGPBn1lRcHUKVUIOCL2kVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dijXTkiQHrfrlF4ID+znm8V5fZSPJC1gmyuClDGbRpM=; b=TrkfFRi4tkO0h4FDY/e+k3dt7jIUeVZhpqrMeAo7ozzkxJUh3CNiCo3NcxLqAjpSpq sj30SW6DmAVWTAEYFzn3j7Y2z2Zrjwj3HqN6jzWzYcHuQh6gWtRiU0bBOQUwW9PtQgvq rjDmfydoCiCwCiElxc+SwY4HVZN8mtVvdqJtpMbu8SkznWA2FXN32x8ofbzHxiwHpziP rdJi7Ggx6Er0uKlvIFHUktxDxBu9oKqD/TarDOXFbFr/icimFzL2/fJMd1F0DVVlOvMN VpLW1dEMzKfgSrZc6St4Lhar9AKbipJsLSO1kwSQwBKhDH+ZBW9TIFaXV86F20q9DdNz 0xhQ== X-Gm-Message-State: AOAM532JsyODr0r/n/nP6smp4QeVEIgQRZQIS4tOhX1SdJHAUEHfVG90 kLYJ2zvdo4k66DNIZFMaUNJKOA== X-Received: by 2002:a05:6a02:19c:b0:3aa:1bf8:7388 with SMTP id bj28-20020a056a02019c00b003aa1bf87388mr19780091pgb.455.1651704571489; Wed, 04 May 2022 15:49:31 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:1da3:6a8e:557c:da09]) by smtp.gmail.com with ESMTPSA id s21-20020aa78295000000b0050dc76281b7sm9034473pfm.145.2022.05.04.15.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 15:49:31 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Dmitry Baryshkov Cc: Abhinav Kumar , Stephen Boyd , Douglas Anderson , AngeloGioacchino Del Regno , Bjorn Andersson , Daniel Vetter , David Airlie , Lv Ruyi , Sean Paul , Vinod Polimera , Xu Wang , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/msm: Fix shutdown Date: Wed, 4 May 2022 15:49:26 -0700 Message-Id: <20220504154909.1.Iaebd35e60160fc0f2a50fac3a0bf3b298c0637c8@changeid> X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When rebooting on my sc7280-herobrine based device, I got a crash. Upon debugging, I found that I was in msm_drv_shutdown() and my "pdev" was the one associated with mdss_probe(). From source, I found that mdss_probe() has the line: platform_set_drvdata(pdev, mdss); ...where "mdss" is of type "struct msm_mdss *". Also from source, I saw that in msm_drv_shutdown() we have the line: struct msm_drm_private *priv = platform_get_drvdata(pdev); This is a mismatch and is the root of the problem. Further digging made it apparent that msm_drv_shutdown() is only supposed to be used for parts of the msm display framework that also call msm_drv_probe() but mdss_probe() doesn't call msm_drv_probe(). Let's remove the shutdown functon from msm_mdss.c. Digging a little further, code inspection found that two drivers that use msm_drv_probe() weren't calling msm_drv_shutdown(). Let's add it to them. Fixes: ecb23f2e3009 ("drm/msm: split the main platform driver") Signed-off-by: Douglas Anderson --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 + drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 1 + drivers/gpu/drm/msm/msm_mdss.c | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 143d6643be53..2b9d931474e0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1350,6 +1350,7 @@ MODULE_DEVICE_TABLE(of, dpu_dt_match); static struct platform_driver dpu_driver = { .probe = dpu_dev_probe, .remove = dpu_dev_remove, + .shutdown = msm_drv_shutdown, .driver = { .name = "msm_dpu", .of_match_table = dpu_dt_match, diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 9b7bbc3adb97..3d5621a68f85 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -1009,6 +1009,7 @@ MODULE_DEVICE_TABLE(of, mdp5_dt_match); static struct platform_driver mdp5_driver = { .probe = mdp5_dev_probe, .remove = mdp5_dev_remove, + .shutdown = msm_drv_shutdown, .driver = { .name = "msm_mdp", .of_match_table = mdp5_dt_match, diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index 20f154dda9cf..0454a571adf7 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -397,7 +397,6 @@ MODULE_DEVICE_TABLE(of, mdss_dt_match); static struct platform_driver mdss_platform_driver = { .probe = mdss_probe, .remove = mdss_remove, - .shutdown = msm_drv_shutdown, .driver = { .name = "msm-mdss", .of_match_table = mdss_dt_match, -- 2.36.0.464.gb9c8b46e94-goog