From mboxrd@z Thu Jan 1 00:00:00 1970 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 39733355F3A for ; Wed, 22 Apr 2026 07:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776841290; cv=none; b=kdIH/i4iSpHG+mYXVEjn/JKkiNpNMrtlsWSlvYdIi/WwViKdqftmp+n/OIQga+vjG5GEwO7DPdys8xEHoC2AcIXNEmMo4VjIiBlarua2TgA3GNaHInhDJAb29MLeinwjjCqVLKYJwnYiaher2+ECtcvmE7DfKeLt1YJUO9DgBUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776841290; c=relaxed/simple; bh=7Lk34Za95t+kyvgquAgJFZtmtRJLxGQm+zE5m9tIOeE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mz5weyQlAX67sKcPHlv4tqcmolPW684XsLDGV1T404nFXkPzkM/GB+X9hRjQFM0uLw6kNs49SEh+NpiNRbV+PXDcYYn46PNIuSb+uufus3jVMt+iYh4SR1SXu+WWCfeYMwn5zGoIVWWCLeu9rd7Bb8uV0IQGRnTsBQCk6Cm+Sm8= 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=J/AEkkMu; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kVtSx8f9; arc=none smtp.client-ip=205.220.168.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="J/AEkkMu"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kVtSx8f9" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63M5NO793083216 for ; Wed, 22 Apr 2026 07:01:28 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= eBGSKr8Uva+BtfeptfpzAP+Zxx4G12UZSHcTVG1Bx4Q=; b=J/AEkkMuXJ4aKR0j Q0xfteGZyYNm6QcnqJv2Fyk97Wgj5mZPewxb/aFhHsGhLq6l47ynlhFs21fkqq5D 5Z7aTz2VsSu3Fu8CuTDMI0BIelyo1kLA8epiLnxRybG80m/AnW/Eh/0xXfKIIIWk x/rhjoUt9lsQ1thunmJzMgFfN5OyTKDhBRdhkTBrqeGrK0B1roDrE1f7sZ48CTbV 7SagRQwG3suU1UaoOOEQI0yZTKEQ1VC1aTcGoS+Dpc5gAJu7sHCd7u3sV77mLtNV YoLsMHzYU7uWQ1RmA7Pj4gnz8UDoeeFqqO0h0YTI6O38AZWjH+FPWGutQl5SIEPG I7jucA== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dpenmj5ae-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 07:01:28 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-82cf8dcd079so3365219b3a.1 for ; Wed, 22 Apr 2026 00:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776841288; x=1777446088; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=eBGSKr8Uva+BtfeptfpzAP+Zxx4G12UZSHcTVG1Bx4Q=; b=kVtSx8f9yDRXEMuch6bbW0gKlVBJtVHx6OO8U2d8ixyq1s5/Y4xIskMuCUy3d/Drkv DQqfOpBxLYDc2kQ+3D5b0Y3hOeZbT6rPSDi0p/a6bl8gf9M+xl77E1euPlv0tzbsGVlo 5ll3JbpfpE33WQpgh//yxVEx6b8bjlB/ZNB7C20zKky1+L1ZvJqbWkGJYZSEr1bQ+Cx/ lRxxrWxv8Ytg5PgxGrZiUtvBuY1scxhZdPp0UqxoT751/tvRN9zXr6wZUk2sH5Ueykdn eMp/7QCS7/nMoH+1nPUJyjSF9tPvR+yxmO4tcS0+LXQ0oGZs+aiRaQc9PY+aY2022mJX OtGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776841288; x=1777446088; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language: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=eBGSKr8Uva+BtfeptfpzAP+Zxx4G12UZSHcTVG1Bx4Q=; b=kfhquPJ2mc5PWyYZ762bPZZKRGApL0weTKK596UDoQggtmL3QAfxim6BGRCkvx90R7 hhjv/2egv2jc62cyHPpH8wFtJwTOy8DxMk7dyZe/9E7826vx5V9a4RYV7eo6k5VWb0s+ ujfq1p+HnTWtsCTZF6HcywiJgsV/iFeP6Nku6jl5kK2lgSeLaI6dkgJdfuBYRkGFp2Jz 6lom7gwXEI5rUQ/7AWYVdO2+GuUqbPDckCvCNFd6nNiFEDjhb2qWIFBqIa5heQw6wsUO 8RlQtNcuiLz+W9dgY2ZhaIll2HHPx6U/SNg0YYyX0h5hrVho6fcH3SCcxxG1SSkBPAQQ YzVA== X-Forwarded-Encrypted: i=1; AFNElJ+rIjn4TFEpZYelFkbhXpOhZUfPLKLNEZncN81bMl75mu67XQy6G1tnwFfrT1mhWRBVZ6Ik3qraLbaCHjc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9AhLRExt7yS8G9sLTtnxg2+OpRa9sSeb3OIbp5/b3L5jVmUoN FfYUxEZGzPuBs2uJOq5iajUFZC1HMvfB7HBiOvDRX0IUn0O5EUlP1pmLTHvCAa3L47z6duLEhH6 ONgPmTMiPapW5xRMHMavXKmfy0yu5+DpciobfkKatCkYU+CEmy3IkxVVfbQCv2YXSi+o= X-Gm-Gg: AeBDiesAzRvwTckufv831tUQNya4xn2JIiir3xmCYHsmY20K6icZrwY771egcheQFxa xZTAC/Iz9V7HN8iPWdOul5Bl7CQ++DiVytj32/ZdcOyUcH+AOqs/NwvwtUohv8YNcKSBt4CvEBd EHrJCtuxzPLOT5eaFtJmSk0eRAWzyo3f2gLJPiKTfD0C84M24UthYlC4JN8LLga0zjsN6pidLgw KsYlzHzu2k8P5n2HVNvRp+FZEC2IbXF5H15+Stbrma/AMc7T+wEMHdwFIxkELHh6OKri86eFrr5 iJgshvs+LworrVnvd2YcQ0ljC7oLmP+zqjKrE5NqG/iih18FSkmEfVkcEb/KYMmVtRWJRxHnowZ ZeZ6ksa8/4ts5HrP+9ldFf+ukvghkylJElyp6gIBQDKiGGkGAC1Mupvio2Pxcz2RS X-Received: by 2002:a05:6a00:22c5:b0:82c:e670:7691 with SMTP id d2e1a72fcca58-82f8c9300ebmr22580049b3a.48.1776841287494; Wed, 22 Apr 2026 00:01:27 -0700 (PDT) X-Received: by 2002:a05:6a00:22c5:b0:82c:e670:7691 with SMTP id d2e1a72fcca58-82f8c9300ebmr22580003b3a.48.1776841286814; Wed, 22 Apr 2026 00:01:26 -0700 (PDT) Received: from [10.206.105.200] ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8e981d00sm15665619b3a.5.2026.04.22.00.01.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Apr 2026 00:01:26 -0700 (PDT) Message-ID: <077a99c2-c954-c5e6-3699-cd0360e8b9f6@oss.qualcomm.com> Date: Wed, 22 Apr 2026 12:31:18 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 3/3] misc: fastrpc: Use context device bus for compute banks Content-Language: en-US To: Dmitry Baryshkov Cc: Ekansh Gupta , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Thierry Reding , Mikko Perttunen , David Airlie , Simona Vetter , Joerg Roedel , Will Deacon , Robin Murphy , Arnd Bergmann , Srinivas Kandagatla , Bharath Kumar , Chenna Kesava Raju , Vikash Garodia , linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org References: <20260414-computebus-v1-0-4d904d40926a@oss.qualcomm.com> <20260414-computebus-v1-3-4d904d40926a@oss.qualcomm.com> From: Vishnu Reddy In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: OcoXrwyO6HCShDSW1auT5ADUoNDWRhMf X-Proofpoint-ORIG-GUID: OcoXrwyO6HCShDSW1auT5ADUoNDWRhMf X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDA2NSBTYWx0ZWRfX72ZyA44bJFB4 wdp7byD1x+TnkqiyFJCqcg7QZgMtXk7WCiA2IPhPkPUh1isPBr49JsGQHvw+gGFmLlL8/v4da/l /VRtnFuplNLBBEYnDbRldbwE3J2tlRAmFIDxFJknZimVe+BkKUTR/90djVE59Fw781WQ66L4ov0 e4zlBcBx27S27AYPGy+8TW7wbIp6GpexgmCON/L3BQAZWwoFewUVoxIf1y9zgP5akIVoQB0PEOF c6p6mwxL/+2C+Ck9bpl3HxGk8yS/qKxl6SUSWLnruXpDjMDKYz4G6+U0PuB1SZ6ycyzkdKYsYUj n+QhEg0mSh8BzpK2cqzQYH5XKqxviAFH1aqXsgdvwCsFg/kLIZ3IEykIOWZ8Px5esAkK7Bp+ZDI CtL5NCYRlY+O1r51szjwzpkfSSIB+D9jjJKT2El0sTv4Mg/C+DIyQHlU/ZjMwBiyY8s51Y6HmQW DtKofyHtJyF+IHASUag== X-Authority-Analysis: v=2.4 cv=Xd65Co55 c=1 sm=1 tr=0 ts=69e87248 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=N8QG227OEIr4kTigVUgA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 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-04-21_03,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 priorityscore=1501 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220065 On 4/19/2026 5:46 AM, Dmitry Baryshkov wrote: > On Wed, Apr 15, 2026 at 09:35:47PM +0530, Vishnu Reddy wrote: >> >> On 4/14/2026 10:01 PM, Ekansh Gupta wrote: >>> Replace the platform driver approach for compute bank (CB) devices >>> with the generic context_device_bus_type. Compute bank devices are >>> synthetic IOMMU context banks, not real platform devices, so using >>> the context device bus provides a more accurate representation in >>> the device model. >>> >>> Currently, fastrpc used of_platform_populate() to create platform >>> devices for each "qcom,fastrpc-compute-cb" DT node, with a platform >>> driver (fastrpc_cb_driver) to handle probe/remove. This approach >>> had a race condition: device nodes were created before channel >>> resources (like spin_lock) were initialized, and probe was async, >>> so applications could open the device before sessions were available. >>> >>> This patch addresses the race by manually creating and configuring >>> CB devices synchronously during fastrpc_rpmsg_probe(), after all >>> channel resources are initialized. The approach follows the pattern >>> used in host1x_memory_context_list_init(). >>> >>> Signed-off-by: Ekansh Gupta >>> --- >>> drivers/misc/Kconfig | 1 + >>> drivers/misc/fastrpc.c | 180 ++++++++++++++++++++++++++++++++++--------------- >>> 2 files changed, 125 insertions(+), 56 deletions(-) >>> >>> } >>> dma_bits = cctx->soc_data->dma_addr_bits_default; >>> + if (cctx->domain_id == CDSP_DOMAIN_ID) >>> + dma_bits = cctx->soc_data->dma_addr_bits_cdsp; >>> + >>> sess = &cctx->session[cctx->sesscount++]; >>> sess->used = false; >>> sess->valid = true; >>> - sess->dev = dev; >>> - dev_set_drvdata(dev, sess); >>> + sess->sid = sid; >>> + spin_unlock_irqrestore(&cctx->lock, flags); >>> - if (cctx->domain_id == CDSP_DOMAIN_ID) >>> - dma_bits = cctx->soc_data->dma_addr_bits_cdsp; >>> + cb_dev = kzalloc_obj(*cb_dev); >>> + if (!cb_dev) >>> + return -ENOMEM; >>> - if (of_property_read_u32(dev->of_node, "reg", &sess->sid)) >>> - dev_info(dev, "FastRPC Session ID not specified in DT\n"); >>> + cb_dev->sess = sess; >>> - if (sessions > 0) { >>> - struct fastrpc_session_ctx *dup_sess; >>> + device_initialize(&cb_dev->dev); >>> + cb_dev->dev.parent = parent; >>> + cb_dev->dev.bus = &context_device_bus_type; >>> + cb_dev->dev.release = fastrpc_cb_dev_release; >>> + cb_dev->dev.of_node = of_node_get(cb_node); >>> + cb_dev->dev.dma_mask = &cb_dev->dev.coherent_dma_mask; >>> + cb_dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); >>> + dev_set_name(&cb_dev->dev, "%s:compute-cb@%u", dev_name(parent), sid); >>> + rc = device_add(&cb_dev->dev); >> device_initialize() and device_add() can be replaced with single >> device_register() call. You can refer the below patch, > Keep in mind that for several arches device_initialize() sets the > coherent_dma_mask. So one should set coherent_dma_mask (as it's done > here) after calling device_initialize(). I can see that device_initialize() sets dma_coherent flag for several arches, not the coherent_dma_mask. The final dma_coherent flag value is updated later in of_dma_configure_id() based on the dt dma-coherent property. Setting the coherent_dma_mask here and calling device_register() which will call the device_initialize() won't change the coherent_dma_mask value. Please correct me if I'm wrong? >> https://lore.kernel.org/all/20260313-kaanapali-iris-v3-4-9c0d1a67af4b@oss.qualcomm.com/ >>