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: 1801 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9DCE83F365 for ; Fri, 10 Dec 2021 12:17:29 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id s18-20020a63ff52000000b00320f169c0aasf5013992pgk.18 for ; Fri, 10 Dec 2021 03:17:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135048; cv=pass; d=google.com; s=arc-20160816; b=MaXF84hKC81Z1ghBwk+AQb13uS0pPiyA7LHuNlDcStxWuVS7wvRh5TN5l/73tS7ju6 9AcbqaXAE6sLTgSpumO3BSf1wY3fZqIpdMF6DrR1/BKoX5oeQKDnLclmS051Rk97pNbK Wqwo+ZNNshRal10Xnkyz1sJb6UCW5Yc/kRhIdujEQzAcY5i99VksvGq7DaiwT5p59utW O9lAazz7LdM/pwLSEO5cDN3cxk33U+z7SpU8AE3oG3I3MVRBB6WqaiwTHLDzhyN1yeAK X67R8KpTDiCLS/oghvFubv5/J2ZMY6Dw3YDq2M6jQLZ5KcoS6M2Ip8sehULHAPhkufJd akYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=76k1Z8FvIP6MGCn+8Vm1cByRYXzYqKKoFoyExoIMQwE=; b=Lj5rjzk8TJ7ttehi3JLrJ77zHCxN+rclnNVWUIZ1CHIcXR56D/y2g61LyfDENKz/+Q BoumCvlICCiExXmCtPF1t7b+pCsvGhDz6CeDiWgs0dg5oh0EndaZdX1Li6D1UYNU8TU+ d5Pi9u+vZJQvs4MPF3qVzY/Be5gpNW5k0RFGM8bsgGfRXXWVB5RCLzX2WrWnVCDk7mmO qUlPZfy3QbFQgZQM9uT55Xg+blT8viNilhhsyAtJlfBOrjIPY0OA2o/mUoLxD9QNgBKk YKSOY35lwh7sJ4sMzMJFFH3QsIcfVopFiKdJNmevGWP+Rekmbutuy5nmOD9FhWmEK0E5 Kleg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGYyqvxV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=76k1Z8FvIP6MGCn+8Vm1cByRYXzYqKKoFoyExoIMQwE=; b=giU7JbN2FtvxYU7xN8o0O53efXM8m2H2IFtuMM1gHgzPqy6WyAAlBsObQmgn1fOCQC u2MY9048BNjtDja/hMHu981nmJVVCctazAeIp13UH13hebKqT/K3TKDaUhmze/ngoS/T ObZy4KgQdz9r9I76rv/QpTDAHDideWMO8EyE0= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=76k1Z8FvIP6MGCn+8Vm1cByRYXzYqKKoFoyExoIMQwE=; b=rHt1zVMY+Ro6xK2DJ8SsPeNoge+O0Y6+j3+yTzJ3OJ9V+Li8BIT0ut4sWLUZNg3+2K DDqPZpsGJbZJyDRenbmaLq1vGxvolqsBLCorNB6FrE2Z6MiNQ8PI4NixrwJZ4TuGLpHv Bjo1acpuGvIyEzbwSTAAX6kOzQzMbEXUTg9GxY37fvVa+E37zMTLu4mDWArRgdsPar3v i9rO3nIfOKP5kk1Q/MIHy6+tv+wIE5G5jVoalrJNjp+rEguPO0js2xh4QUsPGsx/EuWQ S7PsSaibFBMU1MhxjLUK9MYzm7fYE3vVEQrCJVDvTahgspduq2Y4IW9gN/Gi/aTJCbSp /X8g== X-Gm-Message-State: AOAM531EnQTDUT7f1Dw3zIm2OAsmQeKF8KQyeBwn/Wf5HlMVZ0p16DMi Z+yWFwqJ53pA0mbJscz8dszdPtr3 X-Google-Smtp-Source: ABdhPJxkMx6bw5ffPLJ9rBWLqVfFQrcXtrQn2+Ba9GhMwoQr4HfNX5igV1swl6ylarjr3MPvgGjsuA== X-Received: by 2002:a17:902:ba84:b0:142:5514:8dd7 with SMTP id k4-20020a170902ba8400b0014255148dd7mr75337500pls.87.1639135047999; Fri, 10 Dec 2021 03:17:27 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:da8c:: with SMTP id j12ls4808244plx.4.gmail; Fri, 10 Dec 2021 03:17:27 -0800 (PST) X-Received: by 2002:a17:902:9b95:b0:143:b899:5b12 with SMTP id y21-20020a1709029b9500b00143b8995b12mr73778849plp.13.1639135047260; Fri, 10 Dec 2021 03:17:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135047; cv=none; d=google.com; s=arc-20160816; b=nv6Z/Kkh8bMBXENVkLKsvBIejiwjkfu+YuhspVitcJb0MYN322tDLJ9h3MjHk5mcYg kIClrX9nnnm2n/d+DOUBS0ZZ4/0m8xM5ZuZsgJIE8LNAnfyICVTqZcY/QlNXSuwFX9Ct FtroWFt8WHthRJmHAuM6YEhP9vTbJOLR7oqikVevV6jjVQ599aKb/hl8ufJZpCag7QNs U/KTJKJX95GvW8hGY/6MDt5oifhJp0iHVbEljZUfGopr1VVXxbXCNHNwGkjxImp0nBSK ZxvLtTASXQ2isGzS7jDZbTg7LmriscYct1fjkqIMW1N67UxBAep5jsEyhU4A03urspC4 gnNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Wv27UtE1e1W7hQoof9oQU8Yg5PSkgE+pRTTj9nNNXMw=; b=j7hMrCIF0avZizqAu1+4E9uHy6Eq458jBp1P5ekCwFIgRSoKrEbUp8W6YPYg9ffzhC P6GRC27nxoCMvn44Qz1ZIsvlzPnvzCWDy2z0MNpR0lC30Eku0Mt8fvU2ukeAjGA0XRBN Ggc7fuGl5nvIMze9d9unmPL81jBpF2FaoCRPtwnuqLOp9LqSr6vXZdTceN7ARxyZ+Jb1 /AvMkxAk+ycuX0SnIjc37Si5puWxzDV6LlShnU/zhwr1qkbMFvmRMDFF3tB2kvT9OQ3v gJ1vwJf8V/EDEF9O6T4InSr576WTBy4eo38cPhC/XeCZu/KEUESaiTLk1Yppu4GiwyP+ 9oHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGYyqvxV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id s22sor2079610pfw.72.2021.12.10.03.17.27 for (Google Transport Security); Fri, 10 Dec 2021 03:17:27 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; 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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGYyqvxV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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; };