From nobody Tue Oct 7 16:38:55 2025 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 1887A3C1F; Wed, 9 Jul 2025 05:48:04 +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=1752040086; cv=none; b=FOfv1GUdYH6MPwjOwSGcel/ldoX3ThD/yWVk4Eui+j6V6dinAmaFyyAokJIvSwd88Nyzqy7mxp7+zsiKjUXvG5QDW7uOSIm2VqeL3xm51BdRXSaQ2ciRBLf79tqxIfpA2uz9STYaKQndxSj5xLf+/+R2AfaX7T8bn+0gSR1mQhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752040086; c=relaxed/simple; bh=UspzWQsA+zst4tmKMQOH+x8+aMLlBxZswysXwFejGOI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pOOISzeyjGJIAaP9TdtzFN2C/UEh6UFYejYyrVzeq35LRgH6OUFM7kY3XgyvF+vsb6KN3a5LufQaJWZHLYyG3Ft7NnidBBuqCxgrDmYao3hoHvlu+Wy2msAHc4rCzK0br+lPvwSqs4zIhT0Flgkx0okfGYY/L6tx8XJlWHQ9yDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=JFGLjFae; arc=none smtp.client-ip=205.220.168.131 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="JFGLjFae" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 568Id4r6025450; Wed, 9 Jul 2025 05:47:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= V0hC9PfCmnsN5ZKtZhvGxq28kOT6Ykij//h1Uuh6B+8=; b=JFGLjFaeI9dukIUS +KIO8Q24BCOulkE5vD6huGY3Om0Rtw4U/7bxhpXWNHQ+TL7g2TLf9P5T7uD9Bpdr VMxyJxFqx+RZBLCSWGif89PMYNXgq1pAgHxCIuKjUxQwUZkxtd9Hnl5KeE41Y0wp w7aZJl7llMuNSIsAX7XNhbwusL8vxlS+ZfykvLPvDzgYCK9LNQwY5JzL992efDjL kJELLd4B9EiFKooBb1uFKh/j9+BKtnZXHn7B0xCEqfzYGqjTgT9PRnOGO7PVQgZa GDVxq1hCkTAEoL77D12GjbFLs0ktaefKnNZS51tND5xH48GBBFzF4k9UPEaKf4lq W3IA9w== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47pu0wjmq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Jul 2025 05:47:57 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 5695lvVV023170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 9 Jul 2025 05:47:57 GMT Received: from hu-lxu5-sha.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Tue, 8 Jul 2025 22:47:53 -0700 From: Ling Xu To: , , , , , , , , CC: , , , , , , Ling Xu , Srinivas Kandagatla Subject: [PATCH v6 3/4] misc: fastrpc: Cleanup the domain names Date: Wed, 9 Jul 2025 11:17:27 +0530 Message-ID: <20250709054728.1272480-4-quic_lxu5@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250709054728.1272480-1-quic_lxu5@quicinc.com> References: <20250709054728.1272480-1-quic_lxu5@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: znQ_aqDzkTuAUKb46ikeP_1o0CfH4NVZ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA5MDA0OSBTYWx0ZWRfX0YaMknOU4OYm 08eRX3Z+YpcY19XHaUrfehHwmRlPKdWfiMqs/jpJSF9JPkwAVhqlxFtiLIGUc6Y3F/qaSfyEdFy dl9pPt3e0bdH9WzXW6XJhJMeDPt01AWRmgG7CL8o2uCRDq6LktomMpV7eK5Yhe/OZ98LiZBXwkX bl4DmtV5lkG4IvEek+fKh/rWelt78vgnxrhamoDdLc8k1ZqYgpr39ks0g+ZmrghC/IwS+xT/jrp xIc9z82T7eOVFYxdoBcW3BhXpCtQKVVfy0y3YPjR08HJC/i3yXOxaUS7ILRqKWhMc8WRo/9LvW9 KOTfgLQekMEPz/X5eQbsQte8C8huWwIwSjRB3dHWgwlNB2HNzbop6G9PY7ZuSZRABha2xRISbyw cuFMrum9x5VkICmJIbkBHsZLzgqfbik4G9ol8CKy9AZWLsbk65Y8eDBBFFhZAzH+C/owWtYP X-Authority-Analysis: v=2.4 cv=Rd2QC0tv c=1 sm=1 tr=0 ts=686e028d cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Wb1JkmetP80A:10 a=KKAkSRfTAAAA:8 a=COk6AnOGAAAA:8 a=ql8Nfxkq940Eb9atYOsA:9 a=cvBusfyB2V15izCimMoJ:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: znQ_aqDzkTuAUKb46ikeP_1o0CfH4NVZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-09_01,2025-07-08_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 phishscore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507090049 Content-Type: text/plain; charset="utf-8" Currently the domain ids are added for each instance of domains, this is totally not scalable approach. Clean this mess and create domain ids for only domains not its instances. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Ling Xu --- drivers/misc/fastrpc.c | 50 ++++++++++++++++--------------------- include/uapi/misc/fastrpc.h | 2 +- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 378923594f02..85b6eb16b616 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -27,8 +27,6 @@ #define MDSP_DOMAIN_ID (1) #define SDSP_DOMAIN_ID (2) #define CDSP_DOMAIN_ID (3) -#define CDSP1_DOMAIN_ID (4) -#define FASTRPC_DEV_MAX 5 /* adsp, mdsp, slpi, cdsp, cdsp1 */ #define FASTRPC_MAX_SESSIONS 14 #define FASTRPC_MAX_VMIDS 16 #define FASTRPC_ALIGN 128 @@ -106,8 +104,6 @@ =20 #define miscdev_to_fdevice(d) container_of(d, struct fastrpc_device, miscd= ev) =20 -static const char *domains[FASTRPC_DEV_MAX] =3D { "adsp", "mdsp", - "sdsp", "cdsp", "cdsp1" }; struct fastrpc_phy_page { u64 addr; /* physical address */ u64 size; /* size of contiguous region */ @@ -1723,7 +1719,6 @@ static int fastrpc_get_info_from_kernel(struct fastrp= c_ioctl_capability *cap, uint32_t attribute_id =3D cap->attribute_id; uint32_t *dsp_attributes; unsigned long flags; - uint32_t domain =3D cap->domain; int err; =20 spin_lock_irqsave(&cctx->lock, flags); @@ -1741,7 +1736,7 @@ static int fastrpc_get_info_from_kernel(struct fastrp= c_ioctl_capability *cap, err =3D fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATT= RIBUTES); if (err =3D=3D DSP_UNSUPPORTED_API) { dev_info(&cctx->rpdev->dev, - "Warning: DSP capabilities not supported on domain: %d\n", domain); + "Warning: DSP capabilities not supported\n"); kfree(dsp_attributes); return -EOPNOTSUPP; } else if (err) { @@ -1769,17 +1764,6 @@ static int fastrpc_get_dsp_info(struct fastrpc_user = *fl, char __user *argp) return -EFAULT; =20 cap.capability =3D 0; - if (cap.domain >=3D FASTRPC_DEV_MAX) { - dev_err(&fl->cctx->rpdev->dev, "Error: Invalid domain id:%d, err:%d\n", - cap.domain, err); - return -ECHRNG; - } - - /* Fastrpc Capablities does not support modem domain */ - if (cap.domain =3D=3D MDSP_DOMAIN_ID) { - dev_err(&fl->cctx->rpdev->dev, "Error: modem not supported %d\n", err); - return -ECHRNG; - } =20 if (cap.attribute_id >=3D FASTRPC_MAX_DSP_ATTRIBUTES) { dev_err(&fl->cctx->rpdev->dev, "Error: invalid attribute: %d, err: %d\n", @@ -2255,6 +2239,20 @@ static int fastrpc_device_register(struct device *de= v, struct fastrpc_channel_ct return err; } =20 +static int fastrpc_get_domain_id(const char *domain) +{ + if (!strncmp(domain, "adsp", 4)) + return ADSP_DOMAIN_ID; + else if (!strncmp(domain, "cdsp", 4)) + return CDSP_DOMAIN_ID; + else if (!strncmp(domain, "mdsp", 4)) + return MDSP_DOMAIN_ID; + else if (!strncmp(domain, "sdsp", 4)) + return SDSP_DOMAIN_ID; + + return -EINVAL; +} + static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) { struct device *rdev =3D &rpdev->dev; @@ -2272,15 +2270,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device = *rpdev) return err; } =20 - for (i =3D 0; i < FASTRPC_DEV_MAX; i++) { - if (!strcmp(domains[i], domain)) { - domain_id =3D i; - break; - } - } + domain_id =3D fastrpc_get_domain_id(domain); =20 if (domain_id < 0) { - dev_info(rdev, "FastRPC Invalid Domain ID %d\n", domain_id); + dev_info(rdev, "FastRPC Domain %s not supported\n", domain); return -EINVAL; } =20 @@ -2330,21 +2323,20 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device = *rpdev) case ADSP_DOMAIN_ID: case MDSP_DOMAIN_ID: case SDSP_DOMAIN_ID: - /* Unsigned PD offloading is only supported on CDSP and CDSP1 */ + /* Unsigned PD offloading is only supported on CDSP */ data->unsigned_support =3D false; - err =3D fastrpc_device_register(rdev, data, secure_dsp, domains[domain_i= d]); + err =3D fastrpc_device_register(rdev, data, secure_dsp, domain); if (err) goto err_free_data; break; case CDSP_DOMAIN_ID: - case CDSP1_DOMAIN_ID: data->unsigned_support =3D true; /* Create both device nodes so that we can allow both Signed and Unsigne= d PD */ - err =3D fastrpc_device_register(rdev, data, true, domains[domain_id]); + err =3D fastrpc_device_register(rdev, data, true, domain); if (err) goto err_free_data; =20 - err =3D fastrpc_device_register(rdev, data, false, domains[domain_id]); + err =3D fastrpc_device_register(rdev, data, false, domain); if (err) goto err_deregister_fdev; break; diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h index f33d914d8f46..c6e2925f47e6 100644 --- a/include/uapi/misc/fastrpc.h +++ b/include/uapi/misc/fastrpc.h @@ -134,7 +134,7 @@ struct fastrpc_mem_unmap { }; =20 struct fastrpc_ioctl_capability { - __u32 domain; + __u32 unused; /* deprecated, ignored by the kernel */ __u32 attribute_id; __u32 capability; /* dsp capability */ __u32 reserved[4]; --=20 2.34.1