Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2641547lqb; Tue, 28 May 2024 06:25:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKR64qdrf0f661m2QxuGjp11NmTr13FVSn30oiQHQswUNjuzTAE+N95wPLXdKyKgFzND8OhCmZSb+d1p5CkYGW38rAGpw3b+0qGIqfCw== X-Google-Smtp-Source: AGHT+IHFzQ4Tq3inQnn+SutTJOfza1R6QYtop4XPVIxtOZmHDjeyetXyPU+a0ykELtZ6dSbjhGiV X-Received: by 2002:a17:90b:46d3:b0:2ae:7f27:82cd with SMTP id 98e67ed59e1d1-2bf5e171f8amr10174622a91.7.1716902701653; Tue, 28 May 2024 06:25:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716902701; cv=pass; d=google.com; s=arc-20160816; b=p5D8UR/uDpqBKYRnXcoDxzyr1HdamLB8a1AxnUd64KJpbMY4+RjhXqKzd8Z5+5IIaY O86jHaLNqDFMU3OppT65UwHO22GkBRfMMTfkROkrwJgBcyzJslXA6EyKcD2fX8i3iuRg l3Bi28PcGIZ1bSqGEkxhfkh58s/kjPmlRJ91TyAm5GFpQR/6Lc472fka+MUJ1IcrQGC9 CohWifNVebo3zGSfgtTfBX60XQottittYxCZg1ZOCQ1TiHA02qeKrrT89Xc7X020+jGL BO7jXheAeIkXsmZd1W3mj6vgeDgaQJAbz12Jp9bz1TKOS+4fU9jRYKhYfEoaWIV8D3Rw 1qQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VeSY2ceVXmdz5zqyxr0C6Kr9UZqmvZCx0+drlbb4RkY=; fh=MnUUbQW0bFMTKH9qnojXhw5kwt22hDajYGae1NDCF6s=; b=RLuvFrRna8kDpPWCfoJ4vB2aIz7rkzAigvMtag39cvrdGlCm7mSGyi+BR3KSOHr0HU Eut0YCQFgYm7DMfrhpLeUpLCTiFIRga0khErnyTBbvqBHugKKQV5kU9yMKjoylCi8Esr 3MuP8Fg8Idz5T4pbj9O9jTK7lbNwHCzPTzUCpixFuGoAPTALWk768Hy7Mgqs2rqoUro3 ZV/57KnFvIdlzpOMgnBK6ZZeEtrYLUVJX5ppaJWNZtHnUFYHFJfoyi84SGsATSpurpjH pQpd09vazpBVkt2haobxNFxIAkIQPYN9IPq6pLE4VgyXAr7EWg88nWx1nSPYnpBIDeE/ OyyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rl5kBtq1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-192371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5a306563si8064256a91.127.2024.05.28.06.25.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 06:25:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rl5kBtq1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-192371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192371-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5432BB21949 for ; Tue, 28 May 2024 13:12:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E82D516DED8; Tue, 28 May 2024 13:12:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Rl5kBtq1" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 D2DBD17E8F0 for ; Tue, 28 May 2024 13:12:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716901945; cv=none; b=lF3cLApjyKKYGM4SVZDMFRjFGgLp5xUvF57R7L2ykVys4fUvHQQAHj6KG2kJ6kfgW7iGatm81lmLUtIFNR8iwDdvKNyEHky1CIbZBIu6KDQ2GhwYuVC/oF/Fo2jatXv/Oddk4cjP49qo7Qpv7R//RyKLgUt9kaPc72roDBgS7jI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716901945; c=relaxed/simple; bh=iaHSfVk3cYotj/lpjrNnV72ctCzwvrJC062eqOjiZ64=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RMqnyBMDpTyaB/4jLs72wlyOwBXrNnzrRGTzsU8uwX7avmXecdiJXU4tHq9ZrJ0FafgVhEal7AWJF7GvGAyhIiTw8kJVnihb7/QIckOGQeSQAaEYi9Z+FTSbQGmCJseTJeHYgex+KDMzKiSVrGVtldAWVVdexnI0DH/3IWMgKcE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Rl5kBtq1; arc=none smtp.client-ip=209.85.167.46 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-lf1-f46.google.com with SMTP id 2adb3069b0e04-52388d9ca98so1379302e87.0 for ; Tue, 28 May 2024 06:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716901940; x=1717506740; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=VeSY2ceVXmdz5zqyxr0C6Kr9UZqmvZCx0+drlbb4RkY=; b=Rl5kBtq1cbzmSgYiWxECD6OpsjiHBs93onbqxBIa04gETjs4w4a5Mg1SmH1uZL8532 i3Lpi3GB9Td+Z8m7HIhKbHoBXAyOFKWzc3KweEFwK5xZhn/vaokGUIyBZtWQ8q3gg4Ak QO7fZ5LrwALvOMMuMArbu0KaDPTC06rbvlncJHb+gzqKKa2KHAp8i3FVIoR5GTVe30ia 5wg60Zv64OCkTzKppQas+/TkVYT70cN3yFqK+/zQ4updmPPICUttnwwMRE2uRD81qiDy PbNuwkXrL8XJ+/fLivuFqcDZFHgyaF7PAIk/3dMgw+CzJ2UB2Zw4vF1JehRSHvZ4t3Vf KRLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716901940; x=1717506740; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VeSY2ceVXmdz5zqyxr0C6Kr9UZqmvZCx0+drlbb4RkY=; b=ZXWPqAmDnzbs1j09S9/QELuTM3GX0XJGxUYPkAOcq0hGAIVKlO3eE7J/yOYTJjLNoQ 4h0TB1/fpPCXdt3DDYazdW0niZ3yDOxdu1b+N3U/eED2p/62mDezO41swyptpf55tRXd lZtmBI0xZngY0/r4MOM3lqUmJ7582MdMztPeWtP7IgSKYyKwyG7/toUV3ZSTxvBaG7vt J2WWVt018J3H/EJ/SoGq6b/jaGacwvWYoSRVm2npVNzvZ71FKsxsmf/RQSt6FrasaqEa wCoeFtk35bsoUvLzEVgPl9+B+eWqlnAIQrSNLlaOXSQ8TQ5w2F2JuPr+r19zmsNx8hin Gg+g== X-Forwarded-Encrypted: i=1; AJvYcCVvtpoDdPWnQp7tVz0WJI4Wgzp/unS1QlOkAEnQnJLDfGY20CSSgUoiJ9qnhCDBplT0CNaS60vuAxPN/8ZImEqM/8Gwud9NyjmORTrz X-Gm-Message-State: AOJu0YyvfoAuTFFQ3HCPBLd7KK1tULzrO4X0wOoDM96tC++MsiwidVm/ TRs3wj7wnTqJFkGlj++u8YDvM5rQL6T4QzDjUSrFCfHyGJ5jVNQI7UoEGEMlaAk= X-Received: by 2002:a05:6512:3ba6:b0:523:78de:11a3 with SMTP id 2adb3069b0e04-52965290530mr14260463e87.2.1716901939904; Tue, 28 May 2024 06:12:19 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyyykxt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::227]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5296f410fc1sm939673e87.117.2024.05.28.06.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 06:12:19 -0700 (PDT) Date: Tue, 28 May 2024 16:12:17 +0300 From: Dmitry Baryshkov To: Ekansh Gupta Cc: srinivas.kandagatla@linaro.org, linux-arm-msm@vger.kernel.org, gregkh@linuxfoundation.org, quic_bkumar@quicinc.com, linux-kernel@vger.kernel.org, quic_chennak@quicinc.com Subject: Re: [PATCH v2 8/8] misc: fastrpc: Add system unsigned PD support Message-ID: References: <20240528112956.5979-1-quic_ekangupt@quicinc.com> <20240528112956.5979-9-quic_ekangupt@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240528112956.5979-9-quic_ekangupt@quicinc.com> On Tue, May 28, 2024 at 04:59:54PM +0530, Ekansh Gupta wrote: > Trusted CPU applications currently offload to signed PDs on CDSP to > gain some additional services provided by root PD. Unsigned PDs have > access to limited root PD services that may not be sufficient for > all use-cases. Signed PDs have a higher dynamic loading latency > which impacts the performance of applications. Limited root PD > services could be opened up for unsigned PDs but that should be > restricted for untrusted processes. For this requirement, System > unsigned PD is introduced which will be same as Unsigned PD for > most part but will have access to more root PD services. Add > changes to offload trusted applications to System unsigned PD > when unsigned offload is requested. > > Signed-off-by: Ekansh Gupta > --- > drivers/misc/fastrpc.c | 9 +++++++++ > include/uapi/misc/fastrpc.h | 2 ++ > 2 files changed, 11 insertions(+) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 7f81a18b8aea..ebe20915392f 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -122,6 +122,7 @@ > enum fastrpc_userpd_type { > SIGNED_PD = 1, > UNSIGNED_PD = 2, > + SYSTEM_UNSIGNED_PD = 3, Any reason why this is not indented properly? Maybe you have non-standard tab width? Also the usage of non-bool type makes sense here, not in the 'unisgned PD' patch. Please use bool beforehand and switch to an enum here. > }; > > static const char *domains[FASTRPC_DEV_MAX] = { "adsp", "mdsp", > @@ -1552,12 +1553,20 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, > if (init.attrs & FASTRPC_MODE_UNSIGNED_MODULE) > fl->userpd_type = UNSIGNED_PD; > > + /* Disregard any system unsigned PD attribute from userspace */ > + init.attrs &= (~FASTRPC_MODE_SYSTEM_UNSIGNED_PD); > > if (is_session_rejected(fl, !(fl->userpd_type == SIGNED_PD))) { > err = -EACCES; > goto err; > } > > + /* Trusted apps will be launched as system unsigned PDs */ > + if (!fl->untrusted_process && (fl->userpd_type != SIGNED_PD)) { > + fl->userpd_type = SYSTEM_UNSIGNED_PD; > + init.attrs |= FASTRPC_MODE_SYSTEM_UNSIGNED_PD; > + } > + > if (init.filelen > INIT_FILELEN_MAX) { > err = -EINVAL; > goto err; > diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h > index f33d914d8f46..3b3279bb2cf9 100644 > --- a/include/uapi/misc/fastrpc.h > +++ b/include/uapi/misc/fastrpc.h > @@ -62,6 +62,8 @@ enum fastrpc_proc_attr { > FASTRPC_MODE_SYSTEM_PROCESS = (1 << 5), > /* Macro for Prvileged Process */ > FASTRPC_MODE_PRIVILEGED = (1 << 6), > + /* Macro for system unsigned PD */ > + FASTRPC_MODE_SYSTEM_UNSIGNED_PD = (1 << 17), > }; > > /* Fastrpc attribute for memory protection of buffers */ > -- > 2.43.0 > -- With best wishes Dmitry