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: 1781 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 005E03F15A for ; Mon, 22 Nov 2021 07:53:27 +0100 (CET) Received: by mail-pj1-f69.google.com with SMTP id jx2-20020a17090b46c200b001a62e9db321sf8448695pjb.7 for ; Sun, 21 Nov 2021 22:53:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564006; cv=pass; d=google.com; s=arc-20160816; b=hQKfHBJi7I+YouXwzUgAi7d67WsbDODrRNcU+Gjx8q+18ZLtDaXA42RTb6HJe5gRt1 2UmVwTTNCJwFV3CUFnRsSK4YtzIPIuYU5HfLdjxqGNCGW/seJS6N83Ey9yZ9SVuQOs5G BRB+9RB2ncggkhs+qHR4HgH8dwBuZ3vuAARBS6HXZp2m3rI7VilzwytWqU3E2zifWMnO B/1uH/RDuQaHnEjlqIRdO6ir+uFwC3H4oxjuBksR2j6eAIaiHmvd3otHIcDR1yjUsWEx KUSHg8/sS9PnScIZ9mEMmSpdycnMoJ8S3fYDUmsZwJfR7SDd7/xH4vAFzqZr8SK75GQA ILBw== 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=nn6M1lvBbWHUF4krxvKfzjvLP+kNSf+Fd0CfRaJ0hQI=; b=FxkgGBxzCWVpEYJAZ00HK0R+Q6tWUBjdCI3JLFUxXSwAmIHyPq3lB4v9FXdDXz5zc3 0F4DAMl4qkRxvSWGesgoeU3D41jRMA5T6wgkLm0rNCxdTdRGIR6oaJnrcJ9pqwqKQRKd npvDCtdNhBNMcZKWjpUeb8Q5Vx8d33TTiOSOAKevIAcZk40mQrGIKfjpLlWUyNlP/oFs 5avuYl++Bb8DesRzIyBg5KNwPnO2ux/8Nsp1M7hZmWgrJ6KDLjkSKqoCMZkmwb0OFl2+ Wbf6xVKSUoNGjaDFT9eh6/ltXIBtWYuTWaSrGvI7BRBwyj6PWGgdeJvhGE+ZXvgf7sDh /ejA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o6wWL1yj; 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=nn6M1lvBbWHUF4krxvKfzjvLP+kNSf+Fd0CfRaJ0hQI=; b=f6WHvTrwBIaLWgQ2nzr6yTIUcrJjKcQ4Pfh/yhZQrNxrxzEe4SVm0Iipt0axAw/8hE ew1tsOfW/pf4z5n7KUqWJMk3ymL2sSB2r4IJPd5c0uyPKD/ld1m2wVdLT2Ur6dlLE7Ha 0AOhHtYgBqtb/4vlx/Nuya6IWsrmSIDdlXp1I= 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=nn6M1lvBbWHUF4krxvKfzjvLP+kNSf+Fd0CfRaJ0hQI=; b=MkPIL0hQDavz6s9HjAdxK3mJAhQTVWo2xw8+0MdMcB0GCLh0hmtSvoFoAyoVbwDTkh MAm//8syNDLhAdiM0/oszyRdLv/SsS491Gdpvl9Rf2p9OppKvNVYjnZmIOZefZ+B9/Sy PFG30RVCQXtiPyaL0CxcS6xI0aiKtiQgJiYSxxC+cbhtxrf1Inn7mrUrs8ogsYvhHm/h IjcEZUQRLszOdMDAeJZJOPMEmIa7Pxw5EaD0GhEa+PHZwUDGk+flYOGGgPcAoXGOQJS/ fZqfigW1oWpkQrPjscD9Y0CFhhyzAztsCaxSQ6iy6fCs/eTbUoPFEAUQjFmYB0X5zF3P Me/w== X-Gm-Message-State: AOAM5307rTfojWomMOmmnnKsGXMY6zsQ63seYlVX+PT6mpLWW8blHmDw fbZ+AK4qPSqrMtrW4mWa1h9qymqo X-Google-Smtp-Source: ABdhPJxQsGK/fFMi0h/ekyGs/XsuXPitXa1j0N1tRfoJXuO3avGumJN9K16TnFTZ8f7V6sW0BX+bBQ== X-Received: by 2002:a63:c143:: with SMTP id p3mr32149608pgi.366.1637564006309; Sun, 21 Nov 2021 22:53:26 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:194d:: with SMTP id 13ls1407019pgz.5.gmail; Sun, 21 Nov 2021 22:53:25 -0800 (PST) X-Received: by 2002:a63:555a:: with SMTP id f26mr32635118pgm.263.1637564005542; Sun, 21 Nov 2021 22:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564005; cv=none; d=google.com; s=arc-20160816; b=sFLs0I905bwGTypsmax3w9DjS+q+vfEDkDIcFfgU2qvCql5X+vRUCGnFoNHC3wgWM7 vqynhnGj2D2g8s6aM57XDRZl4+gUuyJr2N5Nl4Fk1REhJh9l3g5DqXYrQJ2CqdQnuLWO z+yiYqvtT3BeSsXPjhkaGIdshjs73bUvZ4RXOCDtCULZNoJO79GG2QoctR93OD23lAJp wxTEaXUrD6luVaGo46GytrCvu5h2nlg/6VUpJhoI3QJ634LOl5HE37n6BFEB5ua9g1E/ 7PuNajO79gcFkGWUEVXaRDKWolDeUvYdTkRNKGO3CcwIsBF3gjjtU3fYsxnT1w2ezEWl /5TA== 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=pkAuQsnw7QbljD+R+QwG40X6FsjkHXAAeazRxjeItzs=; b=oUWT2RaF19ON+xrmS0qZbjmlbpuOnIW6F46BX5wvi9rDSWzXFYFEhx1yVVk10dsJY+ GVlPW0irJmNiuYxc45LI7hvn45OKEUcawQLIuNqYn52Mc6tNbiAl3f1uuXiyYvRAPqkq tMpO0k/jxJ+a/Lozab9gybRpO2dKMg16pGyRHYvROqliIHjbVggeeZBtT1xriTIkTaC1 OzwakB1UqETwA2RSrzHEz+79DPaAko4Q34aFJZHpHDb0QW1KSpSCi9cawXzsIKngPYb6 8oI+vfJzD+QYNBvt/xoqbRomM52Rzo5h+b/Bd/FUr33iwGAcKukPhCyc4Qm7RGfpnUC8 Ew9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o6wWL1yj; 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 l10sor3664960pjq.10.2021.11.21.22.53.25 for (Google Transport Security); Sun, 21 Nov 2021 22:53:25 -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: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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o6wWL1yj; 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 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; };