From patchwork Mon Nov 22 06:52:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12693265 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0EA62C433EF for ; Mon, 22 Nov 2021 06:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dc62DuW/LtBBNj+bmRVL80qKo0Kprb60UiUpcJJ6id4=; b=hytC/eTieNHupP Bjr9SI8UsQQ/I+LrHBGcxDRju+qJHFSujd1yas0cKaeBIRcIRfvx3hoC+aRm8QEYhFxxaq1bmIrG1 9iPKU2+AwEyNdFxJk6ZoDzaYXAe38Kr5+d9T82fqdSFTtQyLTE/zmuaqZL1gldU0D4VVsmmHJFOHT rpos8lzVjSIncIBPFQxGqAl0zCGrmyFwD8GM6b1TKDNl/AtY4W34Ctrp10VqsNsUCZr/VHQyhz4tI mxnzNYf8JznNqtjqwFc1vZyYOjGEqf6nfy0uSEtLnWCqtPiAIwImBcwiLtBmhfXnLOSysV9LZ5sVT CqsRfjfdUT9IOUZlfFjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp3Ct-00EzKH-D7; Mon, 22 Nov 2021 06:53:39 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp3Cg-00EzG0-BP for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 06:53:28 +0000 Received: by mail-pj1-x1036.google.com with SMTP id iq11so12990676pjb.3 for ; Sun, 21 Nov 2021 22:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pkAuQsnw7QbljD+R+QwG40X6FsjkHXAAeazRxjeItzs=; b=o6wWL1yjsAfCZDtrmIbaY0nuTaL2UJLOiEhMmhAOJ9xqLCdMsgo6gmQ2GUb+z2NXOh Z5iAUQ/WRbJcEEUaf7WKkrhsz2NPSn8ukbh1GyoVOHbgsMCwXB8sdOaeDGedwh1cM2rB J/Nn7VHtHzyMkOcBdwJeTzo2q92ni2zJHp7U0= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=pkAuQsnw7QbljD+R+QwG40X6FsjkHXAAeazRxjeItzs=; b=B33mgZxrwlnbBGKrJUo1DX8mGnMezzkQ7kef0KYf4zgj+CkGzU9ZjCsdnjhy5K4XH6 mnEHOA7rVAVjTQLeUbEpU8+kq1NRB6+2u0ixZQbldLIaGlCqgoVgbVf7mvM8y8eIbNoP sqAgyVbrg0cenFfda1+EiyI+UADSY14fGmllIpsjZRh9AM9d6YWralHmEXKuTuRBc2xC ZWm7G7vpoCeBXi1efAu0cCIQxJPpRN0QWLCTHEQG3pLsha/m0VCpebsxYQ9KEMhwN3PP 8ux6S1ObRwASK9dyK+BeGTk+zptSKJQ0W4j7BD1m4000r+TCJFknB/MJvVuT3UMHptw4 wKlw== X-Gm-Message-State: AOAM532pnmqVNyulqF6IpGw+OpoKfZ3Zz0ZdzeXgQxV6E8xxbXjp3tFE 4KWeUZ2HExBv0+SvYJrTxalOiw== X-Google-Smtp-Source: ABdhPJxIxHzXyA9fRBFwfjRKHrDL6Qh62vnmKobqJE/aiLSGG4qGq+lY9nu34E96pmmtwbIxYdX7qg== X-Received: by 2002:a17:90a:c08a:: with SMTP id o10mr28275591pjs.44.1637564005280; Sun, 21 Nov 2021 22:53:25 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:24 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v5 1/7] drm: sun4i: dsi: Drop DRM bind race with bridge attach Date: Mon, 22 Nov 2021 12:22:17 +0530 Message-Id: <20211122065223.88059-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211121_225326_417024_5E2DB180 X-CRM114-Status: GOOD ( 19.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Existing host driver will keep looking for DRM pointer in sun6i_dsi_attach and defers even if the particular DSI device is found for the first time. Meanwhile it triggers the bind callback and gets the DRM pointer and then continues the sun6i_dsi_attach. This makes a deadlock situation if sun6i_dsi_attach is trying to find the bridge. If interface bridge is trying to call host attach, then host sun6i_dsi_attach is trying to find bridge and defers the interface bridge even if it found the bridge as bind callback does not complete at the movement. So, this sun6i_dsi_attach defers interface bridge and triggers the bind callback and tries to attach the bridge with a bridge pointer which is not available at the moment. Eventually these callbacks are triggered recursively, as sun6i_dsi_attach defers interface bridge and bind callback defers sun6i_dsi_attach due to invalid bridge ponter. This patch prevents this situation by probing all DSI devices on the pipeline first and then triggers the bind callback by dropping exing DRM binding logic. Signed-off-by: Jagan Teki --- Changes for v5: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +--------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 527c7b2474da..4bdcce8f1d84 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -967,14 +967,10 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, if (IS_ERR(panel)) return PTR_ERR(panel); - if (!dsi->drm || !dsi->drm->registered) - return -EPROBE_DEFER; dsi->panel = panel; dsi->device = device; - drm_kms_helper_hotplug_event(dsi->drm); - dev_info(host->dev, "Attached device %s\n", device->name); return 0; @@ -988,8 +984,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, dsi->panel = NULL; dsi->device = NULL; - drm_kms_helper_hotplug_event(dsi->drm); - return 0; } @@ -1077,8 +1071,6 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - dsi->drm = drm; - return 0; err_cleanup_connector: @@ -1091,7 +1083,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct device *master, { struct sun6i_dsi *dsi = dev_get_drvdata(dev); - dsi->drm = NULL; + drm_encoder_cleanup(&dsi->encoder); } static const struct component_ops sun6i_dsi_ops = { diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index c863900ae3b4..61e88ea6044d 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -29,7 +29,6 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; - struct drm_device *drm; struct drm_panel *panel; };