From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 985B51E8332 for ; Wed, 13 May 2026 21:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778706585; cv=none; b=ILENIWSfWdroQMQoj1Dx2ExrZGMSzLG7qqWsBIRLpH0zZYcs/UX5oyWroBTMGB+fDt1oz2hcSD2/2i/h+3UO2omqeixZjQ5mtytsbTD81j8S5+6L2jjrWCYqzPQxL8GftcN53efrTrdCi3pP6K85QHtOM+ZwsPhhc/wfLJ27dMc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778706585; c=relaxed/simple; bh=oGGQcoevba4bC/U1LFeILquNG1skms0DgQ1S/v7YPh8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gcGbNFTj5G8XkJPnaWNHFz5kS7txXaLSlMAdaICX9yinRRqFm3c3Ti9aJ++ZqQEMO9OAcjIe8rjMWZqUwxluDjS1eHN+Pgy9Usw1xhFuGe7SrPgUo2+YrEsQ9LhXlhxB8aRALdcw3e5Y3lSmNBe2ua0taiVBJgvgjMEkd4VKipQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=B9sJPLiO; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=h+2QfDE1; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="B9sJPLiO"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="h+2QfDE1" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64DEd5lW3474786 for ; Wed, 13 May 2026 21:09:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= jkhJMB3p3x9g/m7z4wc6rLzCh+cUSNcjou/V/e/uRck=; b=B9sJPLiOytiZis+i OD6Ce6a43XJnEe+NBuX6cguSEihH9ZeJNQ7Wd6kQwSIkbpAnC8FkJSqp7Qxuwr0A BY74u6GiTGdx2wJJ2Uestj+AIaF8uv0yTVWNmxbDs8V9kcZXR0Oc8Aj12bxndB8N aACvfqhYwkxxUap/+OnPoo3VxsSofvwQocrkmKnVHqwIw5gtBtudt3b2HZjG1NU7 yjZxHIzJ2ci/wTYhJSOwdr5caWDefzjQn5VYjGxZao+68XGM7G49KZ11/qoiU676 cBrlVFRagE+DHblBk3uY3fdVPdd1avgB1m/qyA23VFm1uFxDcsebZo0I1IYNSGds hUplFg== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e4p41awa0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 13 May 2026 21:09:41 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-3663cbff31cso12875101a91.2 for ; Wed, 13 May 2026 14:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778706580; x=1779311380; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jkhJMB3p3x9g/m7z4wc6rLzCh+cUSNcjou/V/e/uRck=; b=h+2QfDE1hy94tiUcafgrBLqsxOmRDc4HWM8CELzECRbD9qYLdqnenT0QGObVaFAdVk qjX380Br7mGoRLZgjIH92GOpEKnk9WxL/886oFWHulT6duewqKhLJXvn28VpRxmVvEMm BiJO/GxoC7PlsYbB2EWLg1iqMjLsf/ftPtpvJtxBRxDYvw01E+sgUCQRoSIyuNfxuuTw i9kiTIx7iMrW/q587BtqdGJ2Xeikq5gc8V2q+qirmQr53LGo2FAD+L9vYrcBT4/BaFsp RgCfsjcihCpPAQxHw3lrCTNt0KEFDmGcDjrAdW5Y4KJQ4txeLPsuQe80tFOzT9tHvgl/ pmrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778706580; x=1779311380; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jkhJMB3p3x9g/m7z4wc6rLzCh+cUSNcjou/V/e/uRck=; b=LP9iKYz7nZR7L9eQxnx6C15hOthntF8iNR01QjuGGVsCqFLQ3zOTPQgM6aLRu+pdmN eiNChUiiBmtppgsSS7t0llFr0or8SR8x90po4DG+gairgIoWCAPnnDRIdl1dcMQYbyRr 1RtVN4td4BJdNUwzK+s3eNs8DCBkWn2jWznKVYR0LyupkIvmoragkv5vW/8t1+UgDd6L tDlXRi080AxZ83N4hTdM38V1BPOMnk5fCLrPnbibrgUrHApEH5y5F+TUmoEIfhWUZqzq GWN3jKJ2IPwG8tJkkQK80igslvwnRUrCS6I/SOXwR6zZYuVKLIm6yeWmVHb/JUJmb6nx 8i5g== X-Forwarded-Encrypted: i=1; AFNElJ96nPOuIsrnGnR/wLnhMarAR9ZXwMjNJkf353dBPdl1ns8ZSBUk/8/yMUK4jF+jLQD0HvL00gtdE1/mkgw=@vger.kernel.org X-Gm-Message-State: AOJu0YxlxefjxMqaip5oSzJoRlpoY07TrSSZeKmGkyPzpAGFw6li+C0C 3WfburvLfycYJthMyJXvH9m38D2djkCtSDplc/gUmlIpaj0ibiRJtMvfZcK7lxpEutD0l8HZS2B fJOVOXxpC0eEODI9KV5G1l3jKntnMKVoQJo3XP383cRPWaXQWQHWX0Gxs4tqDmXqTjVs= X-Gm-Gg: Acq92OGxvDar52rH2Vs/RfNU4rPE9uI91VzRkC9GmiTRkWv4jy2TpsuQS/lt9hZHnVf FGKqbQBDNd60+nnklcdsD9pod5Jtw0oRS1M2h2ChPt3bAEWODbsKZb2VnvO0T336UrgV4p6IpG2 ckBgumpSYWDkZpEz6bLb8roVJ64jNQq4bnan18+oqzSz7m3DLzlMHHPC1Os7S7cQ8JHQad8+m2a TydO3BhRMEwMzrRjKDEXwJDj3MRWVTddxrwuj5WI60Rq0qYPG88YYX3x6n3S2kXeHZdW2bSHZ44 ZwRHx/gFhWBqvrKEvDdPEqAkGIUAiOPrXTJRdTAjuDheWgeNy9k5lJny2l1Jh30U7Z0JEn31NX1 UNrlnIYnwvqAOqTy372eQyTBFKpDY8OxZi7qS5fFFVywe/WT/s0uIFSw= X-Received: by 2002:a17:90b:3f83:b0:35b:9b77:d7c with SMTP id 98e67ed59e1d1-368f7993ccbmr4800516a91.14.1778706580515; Wed, 13 May 2026 14:09:40 -0700 (PDT) X-Received: by 2002:a17:90b:3f83:b0:35b:9b77:d7c with SMTP id 98e67ed59e1d1-368f7993ccbmr4800494a91.14.1778706580063; Wed, 13 May 2026 14:09:40 -0700 (PDT) Received: from [192.168.1.6] ([106.222.229.33]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-368edf6738bsm4863172a91.8.2026.05.13.14.09.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 May 2026 14:09:39 -0700 (PDT) Message-ID: Date: Thu, 14 May 2026 02:39:33 +0530 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 RFT 4/5] drm/msm: Always use component model for standalone GPU To: Dmitry Baryshkov Cc: Rob Clark , Sean Paul , Konrad Dybcio , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Marijn Suijten , David Airlie , Simona Vetter , Neil Armstrong , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20260513-gmu-sync-state-fix-v1-0-6e33e6aa9b4f@oss.qualcomm.com> <20260513-gmu-sync-state-fix-v1-4-6e33e6aa9b4f@oss.qualcomm.com> From: Akhil P Oommen Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=df+wG3Xe c=1 sm=1 tr=0 ts=6a04e895 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=nm1BsBjGsf7C+PoY3QnOXg==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=QCrFGBqe7VSYUZ7klbgA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTEzMDIwOSBTYWx0ZWRfXxa0w0iPXvRpM d/pzeRkp58Kz5Qrs20mBeOl5/wFBD+M+1UVbuuWTmNXUHyk1IUBqHUlRCsnlOZimczQJpwpIwfA sHUC4g9Ky8iTw+E2mA7mo8mPf2HOvr0flVw9FleoBnURyX/f3Y4fQYjER4pIYtUuXOeQfn5CaVS gIu+Hg7659Xmp6f3fCaEu9sBKAcUnmfTPu6Hsd3M6CmgapP2Imt6/eFhx2jmHw5nb26MrIlCAqK q9j1yX5wnXffkVVjnX+v5rrRsyr5k/SjkycOI9jiWt0yEY5NGBaTbJxJtb637cKqER2vIEe5pQf UarBHCSRc3jhMYdpi78vBbW3XYGYveWY5FDUQ7QKXmLdbHgmwzVqSbAufWMOt4B+c1al0uhiFOA LRR5bBKbzoV9G59vRjpK0J2nvf+0L7+TAGtXex1B50zwZcpQ1rv6+JBL/mfO3xGkwz4ldpQQETB cUDChvKmyz4iTXreUfg== X-Proofpoint-GUID: PMEI0Yg2STxxN_cKN3rv_hk0qfJUp_5I X-Proofpoint-ORIG-GUID: PMEI0Yg2STxxN_cKN3rv_hk0qfJUp_5I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-13_02,2026-05-13_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 clxscore=1015 impostorscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605130209 On 5/13/2026 5:13 PM, Dmitry Baryshkov wrote: > On Wed, May 13, 2026 at 02:22:59AM +0530, Akhil P Oommen wrote: >> When separate_gpu_kms=1 (or the device is compatible with "amd,imageon"), >> msm_gpu_no_components() evaluates true and adreno_probe() bypasses the >> component framework by calling msm_gpu_probe() directly. In this case, >> we skip creating components and directly bind the GPU. >> >> That shortcut makes it impossible to add a second sibling on the GPU >> master without introducing ad-hoc plumbing. To prepare for adding the >> GMU as a peer component on this master, turn the GPU pdev into both a >> component master and the sole component of itself in this path. A follow >> up patch will introduce GMU as a component device. >> >> Signed-off-by: Akhil P Oommen >> --- >> drivers/gpu/drm/msm/adreno/adreno_device.c | 20 ++++++++++++----- >> drivers/gpu/drm/msm/msm_drv.c | 35 +++++++++++++++++++++++++----- >> drivers/gpu/drm/msm/msm_drv.h | 6 ++--- >> 3 files changed, 45 insertions(+), 16 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c >> index 66953e551d86..67686424f3a1 100644 >> --- a/drivers/gpu/drm/msm/adreno/adreno_device.c >> +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c >> @@ -271,18 +271,26 @@ static const struct component_ops a3xx_ops = { >> >> static int adreno_probe(struct platform_device *pdev) >> { >> - if (msm_gpu_use_separate_drm_dev(pdev)) >> - return msm_gpu_probe(pdev, &a3xx_ops); >> + int ret; >> >> - return component_add(&pdev->dev, &a3xx_ops); >> + if (msm_gpu_use_separate_drm_dev(pdev)) { >> + ret = msm_gpu_probe(pdev); >> + if (ret) >> + return ret; >> + } >> + >> + ret = component_add(&pdev->dev, &a3xx_ops); >> + if (ret && msm_gpu_use_separate_drm_dev(pdev)) >> + msm_gpu_remove(pdev); > > What about making it more clear: > > if (!msm_gpu_use_separate_drm_dev(pdev)) > return component_add(&pdev->dev, &a3xx_ops); > > ret = msm_gpu_probe(pdev); > if (ret) > return ret; > > ret = component_add(&pdev->dev, &a3xx_ops); > > if (ret) > msm_gpu_remove(pdev); > > return ret; Ack. this is more readable. > > However with this patch in place, maybe it's easier to use the main > msm_drv_probe()? It would need some fixes to handle !kms case as the > GPU-only, but it looks very similar to your new functions. > Agree. Will do this in a separate patch in the next rev. > >> + >> + return ret; >> } >> >> static void adreno_remove(struct platform_device *pdev) >> { >> + component_del(&pdev->dev, &a3xx_ops); >> if (msm_gpu_use_separate_drm_dev(pdev)) >> - msm_gpu_remove(pdev, &a3xx_ops); >> - else >> - component_del(&pdev->dev, &a3xx_ops); >> + msm_gpu_remove(pdev); >> } >> >> static void adreno_shutdown(struct platform_device *pdev) >> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c >> index b61deafd02c3..af5aa7ff6179 100644 >> --- a/drivers/gpu/drm/msm/msm_drv.c >> +++ b/drivers/gpu/drm/msm/msm_drv.c >> @@ -1097,10 +1097,25 @@ int msm_drv_probe(struct device *master_dev, >> return 0; >> } >> >> -int msm_gpu_probe(struct platform_device *pdev, >> - const struct component_ops *ops) >> +static int msm_gpu_drm_bind(struct device *dev) >> +{ >> + return msm_drm_init(dev, &msm_gpu_driver, NULL); > > With this patch in place, we can remove the ops argument from > msm_drm_init() and msm_drm_uninit(). I didn't notice this. Will drop the unused arg. Thanks. -Akhil. > >> +} >> + >> +static void msm_gpu_drm_unbind(struct device *dev) >> +{ >> + msm_drm_uninit(dev, NULL); >> +} >> + >> +static const struct component_master_ops msm_gpu_drm_ops = { >> + .bind = msm_gpu_drm_bind, >> + .unbind = msm_gpu_drm_unbind, >> +}; >> + >> +int msm_gpu_probe(struct platform_device *pdev) >> { >> struct msm_drm_private *priv; >> + struct component_match *match = NULL; >> int ret; >> >> priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); >> @@ -1116,13 +1131,21 @@ int msm_gpu_probe(struct platform_device *pdev, >> if (ret) >> return ret; >> >> - return msm_drm_init(&pdev->dev, &msm_gpu_driver, ops); >> + /* >> + * The GPU pdev acts as both the component master and the sole >> + * component (added by adreno_probe()). Future patches add the >> + * GMU node as a second component on this same master. >> + */ >> + drm_of_component_match_add(&pdev->dev, &match, >> + component_compare_of, pdev->dev.of_node); >> + >> + return component_master_add_with_match(&pdev->dev, &msm_gpu_drm_ops, >> + match); >> } >> >> -void msm_gpu_remove(struct platform_device *pdev, >> - const struct component_ops *ops) >> +void msm_gpu_remove(struct platform_device *pdev) >> { >> - msm_drm_uninit(&pdev->dev, ops); >> + component_master_del(&pdev->dev, &msm_gpu_drm_ops); >> } >> >> static int __init msm_drm_register(void) >> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h >> index 6fcb696ceb7c..6264ff27496f 100644 >> --- a/drivers/gpu/drm/msm/msm_drv.h >> +++ b/drivers/gpu/drm/msm/msm_drv.h >> @@ -544,10 +544,8 @@ extern const struct component_master_ops msm_drm_ops; >> int msm_kms_pm_prepare(struct device *dev); >> void msm_kms_pm_complete(struct device *dev); >> >> -int msm_gpu_probe(struct platform_device *pdev, >> - const struct component_ops *ops); >> -void msm_gpu_remove(struct platform_device *pdev, >> - const struct component_ops *ops); >> +int msm_gpu_probe(struct platform_device *pdev); >> +void msm_gpu_remove(struct platform_device *pdev); >> int msm_drv_probe(struct device *dev, >> int (*kms_init)(struct drm_device *dev), >> struct msm_kms *kms); >> >> -- >> 2.51.0 >> >