From patchwork Mon Jun 6 11:47:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carsten Haitzler X-Patchwork-Id: 12870258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61458C43334 for ; Mon, 6 Jun 2022 11:47:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5553C10E7ED; Mon, 6 Jun 2022 11:47:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BBFA10E6D4 for ; Mon, 6 Jun 2022 11:47:47 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 01B691042; Mon, 6 Jun 2022 04:47:47 -0700 (PDT) Received: from e126387.arm.com (unknown [10.57.68.80]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 50D243F73B; Mon, 6 Jun 2022 04:47:46 -0700 (PDT) From: carsten.haitzler@foss.arm.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/komeda - Add legacy FB support so VT's work as expected Date: Mon, 6 Jun 2022 12:47:12 +0100 Message-Id: <20220606114714.175499-1-carsten.haitzler@foss.arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liviu.dudau@arm.com, steven.price@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Carsten Haitzler The komeda driver doesn't come up with a visible text (FB) mode VT by default as it was missing legacy FB support. It's useful to have a working text VT on a system for debug and general usability, so enable it. You can always toggle CONFIG_FRAMEBUFFER_CONSOLE. Signed-off-by: Carsten Haitzler Reviewed-by: Liviu Dudau --- drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index e7933930a657..c0c7933a9631 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "komeda_dev.h" #include "komeda_kms.h" @@ -71,6 +72,7 @@ static int komeda_bind(struct device *dev) } dev_set_drvdata(dev, mdrv); + drm_fbdev_generic_setup(&mdrv->kms->base, 32); return 0; From patchwork Mon Jun 6 11:47:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carsten Haitzler X-Patchwork-Id: 12870259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C1E5C433EF for ; Mon, 6 Jun 2022 11:47:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 92DE810E5CF; Mon, 6 Jun 2022 11:47:49 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 381C710E6D4 for ; Mon, 6 Jun 2022 11:47:48 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CC5DE1596; Mon, 6 Jun 2022 04:47:47 -0700 (PDT) Received: from e126387.arm.com (unknown [10.57.68.80]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A4723F73B; Mon, 6 Jun 2022 04:47:47 -0700 (PDT) From: carsten.haitzler@foss.arm.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/komeda - At init write GCU control block to handle already on DPU Date: Mon, 6 Jun 2022 12:47:13 +0100 Message-Id: <20220606114714.175499-2-carsten.haitzler@foss.arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606114714.175499-1-carsten.haitzler@foss.arm.com> References: <20220606114714.175499-1-carsten.haitzler@foss.arm.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liviu.dudau@arm.com, steven.price@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Carsten Haitzler If something has already set up the DPU before the komeda driver comes up, it will fail to init because it was just writing to the SRST bit in the GCU control register and ignoring others. This resulted in TBU bringup stalling and init failing. By writing completely we also set the mode back to 0 (inactive) too and thus TBU bringup works. Signed-off-by: Carsten Haitzler Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 00fa56c29b3e..39618c1a4c81 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -309,8 +309,7 @@ static int d71_reset(struct d71_dev *d71) u32 __iomem *gcu = d71->gcu_addr; int ret; - malidp_write32_mask(gcu, BLK_CONTROL, - GCU_CONTROL_SRST, GCU_CONTROL_SRST); + malidp_write32(gcu, BLK_CONTROL, GCU_CONTROL_SRST); ret = dp_wait_cond(!(malidp_read32(gcu, BLK_CONTROL) & GCU_CONTROL_SRST), 100, 1000, 10000); From patchwork Mon Jun 6 11:47:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carsten Haitzler X-Patchwork-Id: 12870260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A105C433EF for ; Mon, 6 Jun 2022 11:47:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21A4810E6D4; Mon, 6 Jun 2022 11:47:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id F0FDE10E8DC for ; Mon, 6 Jun 2022 11:47:48 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A29181042; Mon, 6 Jun 2022 04:47:48 -0700 (PDT) Received: from e126387.arm.com (unknown [10.57.68.80]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 010AC3F73B; Mon, 6 Jun 2022 04:47:47 -0700 (PDT) From: carsten.haitzler@foss.arm.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/komeda - Fix handling of pending crtc state commit to avoid lock-up Date: Mon, 6 Jun 2022 12:47:14 +0100 Message-Id: <20220606114714.175499-3-carsten.haitzler@foss.arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220606114714.175499-1-carsten.haitzler@foss.arm.com> References: <20220606114714.175499-1-carsten.haitzler@foss.arm.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liviu.dudau@arm.com, steven.price@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Carsten Haitzler Sometimes there is an extra dcm crtc state in the pipeline whose penting vblank event has not been handled yet. We would previously throw this out and the vblank event never triggers leading to hard lockups higher up the stack where an expected vlank event never comes back (screen freezes). This fixes that by tracking a pending crtc state that needs handling and handle it producing a vlank event next vblank if it had not laready been handled before. This fixes the hangs and ensures our display keeps updating seamlessly and is certainly a much better state to be in than after some time ending up with a mysteriously frozen screen and a lot of kernle messages complaining about this too. Signed-off-by: Carsten Haitzler Reported-by: Carsten Haitzler Signed-off-by: Liviu Dudau --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 10 ++++++++++ .../gpu/drm/arm/display/komeda/komeda_kms.c | 19 ++++++++++++++++++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 59172acb9738..b7f0a5f97222 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -227,6 +227,16 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, complete_all(kcrtc->disable_done); kcrtc->disable_done = NULL; } else if (crtc->state->event) { + if (kcrtc->state_needs_handling) { + event = kcrtc->state_needs_handling->event; + if (event) { + kcrtc->state_needs_handling->event = NULL; + kcrtc->state_needs_handling = NULL; + drm_crtc_send_vblank_event(crtc, event); + } else { + kcrtc->state_needs_handling = NULL; + } + } event = crtc->state->event; /* * Consume event before notifying drm core that flip diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 93b7f09b96ca..bbc051a1896a 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -226,10 +226,27 @@ static int komeda_kms_check(struct drm_device *dev, return 0; } +static int komeda_kms_commit(struct drm_device *drm, + struct drm_atomic_state *state, + bool nonblock) +{ + int i; + struct drm_crtc *crtc; + struct drm_crtc_state *old_crtc_state, *new_crtc_state; + struct komeda_crtc *kcrtc; + + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, + new_crtc_state, i) { + kcrtc = to_kcrtc(crtc); + kcrtc->state_needs_handling = crtc->state; + } + return drm_atomic_helper_commit(drm, state, nonblock); +} + static const struct drm_mode_config_funcs komeda_mode_config_funcs = { .fb_create = komeda_fb_create, .atomic_check = komeda_kms_check, - .atomic_commit = drm_atomic_helper_commit, + .atomic_commit = komeda_kms_commit, }; static void komeda_kms_mode_config_init(struct komeda_kms_dev *kms, diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h index 456f3c435719..8ff3ad04dfe4 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h @@ -84,6 +84,9 @@ struct komeda_crtc { /** @disable_done: this flip_done is for tracing the disable */ struct completion *disable_done; + + /** @state_needs_handling: Has not had it's vblank event handled yet */ + struct drm_crtc_state *state_needs_handling; }; /**