Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp448333rdb; Fri, 5 Jan 2024 16:05:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmc3NYU+z23YTuWV+24an8zMSPMeheQx0AZ9srs48g3elDi3YBaseJqB1HLIq9UXE/PcHW X-Received: by 2002:a17:902:d2cb:b0:1d4:261c:d03e with SMTP id n11-20020a170902d2cb00b001d4261cd03emr241913plc.123.1704499503536; Fri, 05 Jan 2024 16:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704499503; cv=none; d=google.com; s=arc-20160816; b=ZboUjQ6VdhLmIGN3O378kZBWPJ5wn1rI8S4itxeutM+qaxuxIyOKbBrKECQKCXTFyQ Fh/vUb2X0Kec5bei0OG0CmgyLVtC6LFLRAqy2ttMlU0jXmIKUNrM9cpvfUcsPo75WUMg MD+Cf4uPlB1kYTXbQnlXJDQ1dXE+TFYjnlEZLHCY9ZJU4r8kte3YBlbcGcRzxAfctX7y XP29VnIdKNybsJlxAX+Px2LK9O3iQ3Y7rumOf1uxaxyYnmZmKC8dnbC3GiOYJhi+Ew5P BjHO2xiJ03lH3FE/tjMX+TP5T9iawqvnuCE0G5CxzHm94CSPEkqlX0mUeN4b2H69XdUq ftqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=As75EitWRrYPFDkoeJblxIa+0pEysES3yZycpSeCVpk=; fh=WYSPqa9u1AgEJPOjYCNm+mKgMxJsIYybxvM435qAUEM=; b=jbi2bkiho+/qH6eD/5sYArVhrSELgEF+zcfA9iXDSLR7G1kncYRTTAqUP8SvZtoY+4 ZHoPipXTyPD2dlAOWGfCt2VmbKMojwoPTp+x+QsiEaqsBEz4Dy6A8mDlI1nwefEJinNJ OWtZNy2sFgB6QFG8wJSRuJxhVhRSPWnEAsrKALQAVonvG8gE266DSKxYoVsySC8DPPae 3SszFxulR7D0ybm58UQlb3YMhWAFmDXJh3dDiHESBILji4fdOaVtCmB1XVr710pTKMi4 5BVmr5JQ3UOf4Nu4jzBFiFhOvHOFXO/0URos4GXmQ2UwRdGykKWJJbYdIGz8pfRPFzJv +hGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mjf0SGT4; spf=pass (google.com: domain of linux-kernel+bounces-18428-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l10-20020a170903120a00b001d495d6aeeesi2063888plh.336.2024.01.05.16.05.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 16:05:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18428-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mjf0SGT4; spf=pass (google.com: domain of linux-kernel+bounces-18428-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9E10328252F for ; Sat, 6 Jan 2024 00:04:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB2A917CB; Sat, 6 Jan 2024 00:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="mjf0SGT4" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60E7315A8; Sat, 6 Jan 2024 00:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 405LIUMG019395; Sat, 6 Jan 2024 00:04:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=As75EitWRrYPFDkoeJblxIa+0pEysES3yZycpSeCVpk=; b=mj f0SGT4cHNoD0jrutYp547/QvEa3BflHFx4KUVper+V1n5YSOp1CUCFFcQ5ksk2tx WiWaE78ZANsT7Vqisf8vlxhAz68EhVPYI5LrNTFnxaq/szGwzUQXs/+BwoRPTKW/ 1YD/y+Reb3HJ/AlQHyRS2tCD1j8qOtL9ZaLL8oY2zaS+gsekyvOg1qxiyeB/FDkk H7bPvpgbyVBzpHFr8yqpVUhYls2mkrnCHldKPMANw0gEusSkKYYbAf3YJkeRqbIn +bn5ihsHBwtt7NRT/CBJP31UoXvx6f1qP1OMH8DKxUu5gzCBTumZeAnbbl6N9PxI YypWgLuLf6lCudmDKMnA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ve94rak56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 06 Jan 2024 00:04:33 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40604W6C022634 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 6 Jan 2024 00:04:32 GMT Received: from [10.110.102.225] (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 5 Jan 2024 16:04:31 -0800 Message-ID: Date: Fri, 5 Jan 2024 16:04:30 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/4] drm/msm: add a kernel param to select between MDP5 and DPU drivers Content-Language: en-US To: Dmitry Baryshkov , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , "David Airlie" , Daniel Vetter CC: , , , , "Stephen Boyd" References: <20240106-fd-migrate-mdp5-v3-0-3d2750378063@linaro.org> <20240106-fd-migrate-mdp5-v3-3-3d2750378063@linaro.org> From: Carl Vanderlip In-Reply-To: <20240106-fd-migrate-mdp5-v3-3-3d2750378063@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ryZi8V0l36XY5wTVDl89TDtQDTlscZ3q X-Proofpoint-GUID: ryZi8V0l36XY5wTVDl89TDtQDTlscZ3q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 phishscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 adultscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401050183 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/ > +{ > + /* 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. > +#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__ */ >