Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp462012rdb; Fri, 5 Jan 2024 16:39:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdohrEsFonbdxnWsF+dY3G08/CbcLO9GVleiHd+brNIxFrtfiHGxTOXKCO9AOfmA/inDL7 X-Received: by 2002:a05:622a:a:b0:429:823f:162d with SMTP id x10-20020a05622a000a00b00429823f162dmr64814qtw.81.1704501560620; Fri, 05 Jan 2024 16:39:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704501560; cv=none; d=google.com; s=arc-20160816; b=HrEDP1W7oooyxXt44PcpuRjU/vAAlAWSQsXYQSzu9QJ9irjnQCMRM1exQOWQUsjYY3 naUrHPtdoFvNcn71o3NhLYTvp3ruxwhoEjZu/+DCyUMnhgd8OM5mcd6fRApKFCqSTwtF p6X74AXGn2wiC+D7MsFHoTYsCNBWEKwZkLrzoM2MHKDC/S3VoZFWTLNYc+oOlnR0agO5 Qne1G4tWwWzVcFrl3sptaQv8DVtFsCBh4FbOAsHJvDCE+LxwaPAmbPQZIbOYJ3795RqL uuUrJpCgVW6q1QBabJQK/gyrclVb5HC9mTnuIj7Y2PHkjZkH7mT62b7S0qOdZvbyHM/+ 24/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=CWItgsviLevELUTQOy8l4EFaye3LXQAVmYfKWfZE4dg=; fh=YnoSld2sFDqNWKInA60nRtLENRrKFQ4CBp1dAizMbuc=; b=HPwSKuCdH+NP2pcMs4Gr6SvecBkGct/MF5fguAN4968SGOW7HAvsjgpFy3QcF7S5vZ 7EeIjGrScdRIUeePxdXAkTZiKHZTqDh5J0dWqrF/NBei1UigzehXCSnXx+V53aeIVyAm S4xootZXRpr83SM63VCzN/Sp5Cr9z4QMIBHvnHYN8JeefycFzbN4o8qfkHUOYlmHxuav LpkAFEUnF3wOSVcGEMHLD+czqrYaeLNNtrf/oJiNTvxL5GYA2pbbEoqdRE9tPOFgnoiS SVSzRoAAVGW2yVP8j9mAev9USOcFlaCbEh2kV/4JFN32i3QGFzcXUmbRcFnJwnlePdXm 9tqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRJXwrrv; spf=pass (google.com: domain of linux-kernel+bounces-18436-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fb8-20020a05622a480800b004237e3ffacfsi2987548qtb.256.2024.01.05.16.39.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 16:39:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18436-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRJXwrrv; spf=pass (google.com: domain of linux-kernel+bounces-18436-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 537271C23654 for ; Sat, 6 Jan 2024 00:39:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46E6F3C16; Sat, 6 Jan 2024 00:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cRJXwrrv" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6AFB33E7 for ; Sat, 6 Jan 2024 00:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dbe344a6cf4so128946276.0 for ; Fri, 05 Jan 2024 16:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704501548; x=1705106348; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CWItgsviLevELUTQOy8l4EFaye3LXQAVmYfKWfZE4dg=; b=cRJXwrrvzfoQSIVoDoO9eaWRXf5v3av1Lonxx9Koywhr65fO9CHKjURRDUyxqOAWk0 F2NeJdeHmMbFblx5f1MK3/rWgojPts/7KwWvtkxg92cly2O+Juf7aVHKVXSjO0y3NltH odTNnt67s6BX5+zikAQ/+KQ9Yg755I1BSQhBMDE/0eYytxWvvWUTrEWa3NVZbreRdAlY 3twhmuYHyjB18LTCkdtrZa69x32oN4UvWYRbR63IuRXPq4X/rIFlzMhHYTrq/p9Y3VaW TLjgASPu2mNSw22QNIa1L48wQfqZt+2h4DD5NA1FcpgrotX4zia5OlkfGOVMaa4ObnRT Q5Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704501548; x=1705106348; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CWItgsviLevELUTQOy8l4EFaye3LXQAVmYfKWfZE4dg=; b=Xiu8ohfdAby+y7nY9ZlIVQ5V4K1+BLg3mjDGRW4nC69AoK3P6bnBZqy2KuUDiMglqJ IyTFFmAZ0TriNBZCWVcILcLc3aV6orxuLjcIgB2nvO8vh10uHWDvuiyw1cBH9nmgE2WU DH6qfCjoDkd5oCkB6eWNFuTqUtWcnm+Z1i0V9SQ50ZEmmATAjh7YmRUYKWaALxL7fEdh I/5gsrfFGSvh36QxewFBFlg83Ay5Za/XwkJTShIEP98CcbCNlBHXMZ3ssKtW4VXiZDMA ZAodhIBaHoLR52M+utoey5ht2PE5YtunN3l9gPRze4GCM+7t7tJq+clmykppOBw5+XR8 1t/A== X-Gm-Message-State: AOJu0Yx2r9uYUtMzYinhc8tO2VDePnlkX+oBPQ26tk2khWlphV+8FR6r OgjmIZRbGU7fOnmfuiEUhQ6EmLoK/31wRdgqIs0VFJniUGUvdQ== X-Received: by 2002:a25:f624:0:b0:dbe:3500:a42b with SMTP id t36-20020a25f624000000b00dbe3500a42bmr135029ybd.42.1704501548600; Fri, 05 Jan 2024 16:39:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240106-fd-migrate-mdp5-v3-0-3d2750378063@linaro.org> <20240106-fd-migrate-mdp5-v3-3-3d2750378063@linaro.org> In-Reply-To: From: Dmitry Baryshkov Date: Sat, 6 Jan 2024 02:38:57 +0200 Message-ID: Subject: Re: [PATCH v3 3/4] drm/msm: add a kernel param to select between MDP5 and DPU drivers To: Carl Vanderlip Cc: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd Content-Type: text/plain; charset="UTF-8" On Sat, 6 Jan 2024 at 02:04, Carl Vanderlip wrote: > > > On 1/5/2024 3:34 PM, Dmitry Baryshkov wrote: > > For some of the platforms (e.g. SDM660, SDM630, MSM8996, etc.) it is > > possible to support this platform via the DPU driver (e.g. to provide > > support for DP, multirect, etc). Add a modparam to be able to switch > > between these two drivers. > > > > All platforms supported by both drivers are by default handled by the > > MDP5 driver. To let them be handled by the DPU driver pass the > > `msm.prefer_mdp5=false` kernel param. > > > > Reviewed-by: Stephen Boyd > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 3 +++ > > drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +++ > > drivers/gpu/drm/msm/msm_drv.c | 31 +++++++++++++++++++++++++++++++ > > drivers/gpu/drm/msm/msm_drv.h | 1 + > > 4 files changed, 38 insertions(+) > > > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > > index aa9e0ad33ebb..8f11a98491a1 100644 > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > > @@ -1276,6 +1276,9 @@ static int dpu_dev_probe(struct platform_device *pdev) > > int irq; > > int ret = 0; > > > > + if (!msm_disp_drv_should_bind(&pdev->dev, true)) > > + return -ENODEV; > > + > > dpu_kms = devm_kzalloc(dev, sizeof(*dpu_kms), GFP_KERNEL); > > if (!dpu_kms) > > return -ENOMEM; > > diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > > index 0827634664ae..43d05851c54d 100644 > > --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > > +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > > @@ -866,6 +866,9 @@ static int mdp5_dev_probe(struct platform_device *pdev) > > > > DBG(""); > > > > + if (!msm_disp_drv_should_bind(&pdev->dev, false)) > > + return -ENODEV; > > + > > mdp5_kms = devm_kzalloc(&pdev->dev, sizeof(*mdp5_kms), GFP_KERNEL); > > if (!mdp5_kms) > > return -ENOMEM; > > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c > > index 50b65ffc24b1..ef57586fbeca 100644 > > --- a/drivers/gpu/drm/msm/msm_drv.c > > +++ b/drivers/gpu/drm/msm/msm_drv.c > > @@ -969,6 +969,37 @@ static int add_components_mdp(struct device *master_dev, > > return 0; > > } > > > > +#if !IS_REACHABLE(CONFIG_DRM_MSM_MDP5) || !IS_REACHABLE(CONFIG_DRM_MSM_DPU) > > +bool msm_disp_drv_should_bind(struct device *dev, bool mdp5_driver) > > s/mdp5_driver/dpu_driver/ Well, ignored_driver, but your suggestion is better. > > > +{ > > + /* If just a single driver is enabled, use it no matter what */ > > + return true; > > +} > > This will cause both MDP/DPU probes to return -ENODEV, rather than > select the enabled one. No. The code (e.g. for DPU) is: if (!msm_disp_drv_should_bind(&pdev->dev, true)) return -ENODEV; So the driver returns -ENODEV if msm_disp_drv_should_bind() returns false. Which is logical from the function name point of view. > > > +#else > > + > > +static bool prefer_mdp5 = true; > > +MODULE_PARM_DESC(prefer_mdp5, "Select whether MDP5 or DPU driver should be preferred"); > > +module_param(prefer_mdp5, bool, 0444); > > + > > +/* list all platforms supported by both mdp5 and dpu drivers */ > > +static const char *const msm_mdp5_dpu_migration[] = { > > + NULL, > > +}; > > + > > +bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver) > > +{ > > + /* If it is not an MDP5 device, do not try MDP5 driver */ > > + if (!of_device_is_compatible(dev->of_node, "qcom,mdp5")) > > + return dpu_driver; > > + > > + /* If it is not in the migration list, use MDP5 */ > > + if (!of_device_compatible_match(dev->of_node, msm_mdp5_dpu_migration)) > > + return !dpu_driver; > > + > > + return prefer_mdp5 ? !dpu_driver : dpu_driver; > > +} > > +#endif > > + > > /* > > * We don't know what's the best binding to link the gpu with the drm device. > > * Fow now, we just hunt for all the possible gpus that we support, and add them > > diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h > > index 01e783130054..762e13e2df74 100644 > > --- a/drivers/gpu/drm/msm/msm_drv.h > > +++ b/drivers/gpu/drm/msm/msm_drv.h > > @@ -563,5 +563,6 @@ int msm_drv_probe(struct device *dev, > > struct msm_kms *kms); > > void msm_kms_shutdown(struct platform_device *pdev); > > > > +bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver); > > > > #endif /* __MSM_DRV_H__ */ > > -- With best wishes Dmitry