From patchwork Fri Dec 10 11:17:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12695587 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 36861C433EF for ; Fri, 10 Dec 2021 11:19:32 +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=n4sfRVW2nlC7prQZpa0pvY1yDPeVL1F3FokFZ34qpL4=; b=kOyd4SceUjLO01 6I+1F3vr4upuKTeA6CPhh4UTFCiykrCTgiln/dRqXzn0kr2QjUgcY4ihRS4muLMCJxV6Ch+8KeeH6 kXEF77/5jIPuXtnzwmuZqk5rkur28SbVVZt2f9Nuvekl+M2mlFv+RRzgx7iZg0WV8T9fMpwCFBtQE aw6r94tws0ElC3UVxHJKHdXkWdMSH1YfR4YLlpZdpXLkJq52b45wz8gYUM0h33DgEK43AY2zwIepS XPmZRHSXzDbS5IgOyJke5WvexLWVloTLprD2RHiln92VO++hEC57um20B87qmPWA3YfklLpAHufo1 6tUI4b/o9LFyA3Wfv/uA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvduJ-001c7E-0j; Fri, 10 Dec 2021 11:17:43 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvdu6-001c44-JH for linux-arm-kernel@lists.infradead.org; Fri, 10 Dec 2021 11:17:32 +0000 Received: by mail-pg1-x532.google.com with SMTP id l18so3089769pgj.9 for ; Fri, 10 Dec 2021 03:17:27 -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=Wv27UtE1e1W7hQoof9oQU8Yg5PSkgE+pRTTj9nNNXMw=; b=DGYyqvxViMyJ57F2MEaNKWduCTDgDcQ24jeBymdCWZj8fC6PBTKs1qk5xRQYi/+PQ9 TjwNF/szUkRREvTA0JjR3xUQklpCmzXeCEnxQhYd+icg2XukZMblNvf/DhvS1UbbQ38V nyMxkPra2jVgC1vVDOhMp63ST1WIYYt8ohwIY= 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=Wv27UtE1e1W7hQoof9oQU8Yg5PSkgE+pRTTj9nNNXMw=; b=k7p0BSSzrn+51nf0V5BtLrji5alY5IU6snZOfD2ExecTbF2fqV0hUlJwKh5t2g31sB l5AVWvvvk0uYTs8K+anXwD89YRCfllbmkHsriTpnfUfuKsBWMfqPzq971rJo0G2F/oWV 6dFCsMmoVzp7PXT/2Ba57+2sUgLOoYdQqhnRLEPNmErMYwoJRU+7vbDTAV34QCKtqIrz GED3S3R0xLWA6S7sLoFq71owUOxZrm9IizNMDQ4v9sEpYm2YJd1wQX1NHrYuOqjOwbJl 1rQLOK5LM6KP2XXjcRSBnft92k4qiChYCRRLLshySniUU8RhUw4LqyV42h1+kXAXMWgW cpug== X-Gm-Message-State: AOAM530+Q0vlO/r/QC7Fq8et/V8fI8pZTFk/KIVSWEB0l0cbh/Q4qpr9 vw/3ylQ1nKbf2TYU4cvBVh+d8Q== X-Google-Smtp-Source: ABdhPJyYb/+GuVLQfRhxx8RPWx20aoxhK99fRYN3KRqEq3MOSkKa1sF0FOttaXa+kAYHk+y2n4HNjw== X-Received: by 2002:a63:1413:: with SMTP id u19mr39058934pgl.109.1639135047001; Fri, 10 Dec 2021 03:17:27 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:26 -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 v6 1/6] drm: sun4i: dsi: Drop DRM bind race with bridge attach Date: Fri, 10 Dec 2021 16:47:06 +0530 Message-Id: <20211210111711.2072660-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211210_031730_648319_844CFF3C X-CRM114-Status: GOOD ( 19.20 ) 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 v6: - none 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; };