Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1945792lqg; Mon, 4 Mar 2024 08:19:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU2c68bBN4sc3I0zqGk6uk7X8JkhcBZNE+WzvWhz6d8CkwfJj0Nfy7SOeSjt3sNMyV4j28VBEOgn6Ot/1oiK5+0+ms55NzwcNEoBZFpLA== X-Google-Smtp-Source: AGHT+IEZT6W+hhmIyqxClO3kyaeSubAM+XjSXIz3/tOxcIT6b0fJMlkExyuQgda/Y8yIAwacH9LU X-Received: by 2002:a17:903:246:b0:1db:fa72:25eb with SMTP id j6-20020a170903024600b001dbfa7225ebmr10982018plh.52.1709569159779; Mon, 04 Mar 2024 08:19:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709569159; cv=pass; d=google.com; s=arc-20160816; b=V56fc4Qu16JXYW+Zngqpa4+8zKPamHADyyxNGHeIXuoeD51BdsMNm4ipV7gk86gn1z +l/IC2+aURXLt5WvmooqLTLlPm6fyNdq2yotvWpYV3qYbcFBZ4EcD0OuoOUi7GO7TaMj YAvxervMRFBfzQb7injy321kzs+jOVC3Y1YVmAmpEQNVM2BlBVjVQRbPP6HxSUZWQBvd zmmXI5FVrsZIiqVYnDDcXiBzELTHlVv2uLCkryn7qcgxj++c1tJGpFaa71ZdsVqkun6F EbyYRNEz5GQVz4gls5ThgTHrTqoZTuu48fIYJP7M2zdwLdiMUS3EFLsgigwCsvKP4kRE 26NQ== ARC-Message-Signature: i=2; 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=5o9R0X1NzIFRxEN2M3lWd3jajs/abX3dUuumtfderu8=; fh=oLIj4WHIl+LtvTbKkTyx0mJGYFTg8WQmV7WEvnK4nrU=; b=bGeIpKvNNaD31pGRG3Dt7ejEQMjmVIJB4LGUMTFj26D08DoKCZSlZlciW9FvqA7DRj 92Nkhz3ObuNv0UinsIqYKOWgdAyrgRIU7XrOpZdpn7sxHFsZj8lqHxIjMkfsMkI1W4kG AVdBzeyaWzQlmD0kDgVwbP4DkAluCV9irIIzzHYdtgLmmYz1LeDWUSsMLHIUTneXlNDV SdFKUqrap1lpLEMaMKr0neQEsaVNX17AABBOiqnUtj5Nx1YBR3eRRiCpgohxdyfHQiNV tE0rMs6jkt7iA5tiWPa84Q0bo7iSMRTbNjZs+0zIvcDk1/1kPB7KY2Ut37hmCOf8wKig icgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p7UIhgCe; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-90906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90906-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mf14-20020a170902fc8e00b001dd07e2e777si2856407plb.267.2024.03.04.08.19.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:19:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p7UIhgCe; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-90906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90906-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 86F6D287E5D for ; Mon, 4 Mar 2024 16:08:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 261DA4D595; Mon, 4 Mar 2024 16:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="p7UIhgCe" 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 C7129487BC; Mon, 4 Mar 2024 16:07:34 +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=1709568457; cv=none; b=gmGIn4WVctz8nmDiIJ/mJ+KCvdJPB1cVk7nitki/m8fSrQNQIwS/AQuFfrevNuLg71hu/lwNPhMUwymGeATRQSmvahnS72rOlgN+r85mW2MLeHfbYRgMEuGhVrmd2qO49JQSknwIRvnXZ7PSmSyJjjdN8a8tfyPRTXrCG7mCMMc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709568457; c=relaxed/simple; bh=WF/EEFZrmJjMBQfMivy5LrAaq/VlLYeGCZlYf791WMU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=u48CODQ8E/rhH1LlAwV8K7NKBQzPaM7ItlY93+Wzz40MUFpvitKvd54WmCmpVuQVL2t2yLTY1HTAe1y+Y7oHZwht7lNjYqS8+ffXQ7unzJFwi9Nl2sIEF6ZqXSlu/CV0l8vRxd3bwwPSQ11KhlU9XjWPiLze1AVsr2DuZsc5F7Q= 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=p7UIhgCe; 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 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 424F02dG017300; Mon, 4 Mar 2024 16:07:22 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=5o9R0X1NzIFRxEN2M3lWd3jajs/abX3dUuumtfderu8=; b=p7 UIhgCeN6GIGppHBVOF1EhnPFpsT6ntO6HT7BY2RClap8Ihd1lwRaHGMHJsidY1Me V9XJ3dwN4eYZQgR6prhllr5pxDqgx2159P/tGprlAQYAtrTh/vgQo1/aCAt9LaDN aK1GyUTeyYAqZou08JZSh7Pu9X3H4wB84DEbStXGMNiP/s35Bu+URuZ+He4lst64 kVhFWcSr9i7rRrEKhkF0qZrWDN+pg9gjyCwmACq6eQ0n1iwHLVA3K5U5OHHpQ2SR ZcRkdSYXYaIcN3Sxt3mGLpYBkBwJ5oPMgLXDXRxIiYniOJglN1oAv85lLEkPkQoW FVa07jPzysRTSsZAUlhQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wnarj0wmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Mar 2024 16:07:21 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 424G7LoL011139 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Mar 2024 16:07:21 GMT Received: from [10.110.86.150] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 4 Mar 2024 08:07:17 -0800 Message-ID: <2f88d113-96c5-425f-9efa-34269581da09@quicinc.com> Date: Mon, 4 Mar 2024 08:07:16 -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 v8 01/12] firmware: qcom: add a dedicated TrustZone buffer allocator Content-Language: en-US To: Bartosz Golaszewski , Andy Gross , "Bjorn Andersson" , Konrad Dybcio , Elliot Berman , Krzysztof Kozlowski , Guru Das Srinagesh , Andrew Halaney , "Maximilian Luz" , Alex Elder , "Srini Kandagatla" , Arnd Bergmann CC: , , , , "Bartosz Golaszewski" , Deepti Jaggi References: <20240303150115.133633-1-brgl@bgdev.pl> <20240303150115.133633-2-brgl@bgdev.pl> From: Jeff Johnson In-Reply-To: <20240303150115.133633-2-brgl@bgdev.pl> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: koqonFUvRqPBOXQ99tpszGborhmpsQNL X-Proofpoint-GUID: koqonFUvRqPBOXQ99tpszGborhmpsQNL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-04_12,2024-03-04_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 spamscore=0 impostorscore=0 mlxscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 clxscore=1011 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403040123 On 3/3/2024 7:01 AM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > We have several SCM calls that require passing buffers to the TrustZone > on top of the SMC core which allocates memory for calls that require > more than 4 arguments. > > Currently every user does their own thing which leads to code > duplication. Many users call dma_alloc_coherent() for every call which > is terribly unperformant (speed- and size-wise). > > Provide a set of library functions for creating and managing pools of > memory which is suitable for sharing with the TrustZone, that is: > page-aligned, contiguous and non-cachable as well as provides a way of > mapping of kernel virtual addresses to physical space. > > Make the allocator ready for extending with additional modes of operation > which will allow us to support the SHM bridge safety mechanism once all > users convert. > > Signed-off-by: Bartosz Golaszewski > Reviewed-by: Andrew Halaney > Tested-by: Andrew Halaney # sc8280xp-lenovo-thinkpad-x13s > Tested-by: Deepti Jaggi #sa8775p-ride > Reviewed-by: Elliot Berman > --- > MAINTAINERS | 8 + > drivers/firmware/qcom/Kconfig | 20 ++ > drivers/firmware/qcom/Makefile | 1 + > drivers/firmware/qcom/qcom_tzmem.c | 392 +++++++++++++++++++++++ > drivers/firmware/qcom/qcom_tzmem.h | 13 + > include/linux/firmware/qcom/qcom_tzmem.h | 56 ++++ > 6 files changed, 490 insertions(+) > create mode 100644 drivers/firmware/qcom/qcom_tzmem.c > create mode 100644 drivers/firmware/qcom/qcom_tzmem.h > create mode 100644 include/linux/firmware/qcom/qcom_tzmem.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 1794b8d7c76b..c1138c709365 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -18327,6 +18327,14 @@ L: linux-arm-msm@vger.kernel.org > S: Maintained > F: drivers/firmware/qcom/qcom_qseecom.c > > +QUALCOMM TRUST ZONE MEMORY ALLOCATOR > +M: Bartosz Golaszewski > +L: linux-arm-msm@vger.kernel.org > +S: Maintained > +F: drivers/firmware/qcom/qcom_tzmem.c > +F: drivers/firmware/qcom/qcom_tzmem.h > +F: include/linux/firmware/qcom/qcom_tzmem.h > + > QUALCOMM QSEECOM UEFISECAPP DRIVER > M: Maximilian Luz > L: linux-arm-msm@vger.kernel.org entries should be in alphabetic order so at a minimum QUALCOMM TRUST... should be after QUALCOMM QSEECOM... seems your addition belong just before QUALCOMM TSENS THERMAL DRIVER /jeff