Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp486308rdb; Sat, 17 Feb 2024 19:50:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWMVauqW5maTrKY1lxuabKc8XKAd7+HqCTrW+aR3MzZJ6vNV7Gwe4bSElT2iiF/NxhVwLSJ1mOGbY+1+e6/Bt+muQ2hNUVjt180OEXPeQ== X-Google-Smtp-Source: AGHT+IG4eMItBD50njgZYfB9l+wFlenruDKQZNsOxaFJ+LPL2NTv4suJ+WkEBlOM26lYzZkWg3fH X-Received: by 2002:a05:620a:5312:b0:785:9584:a080 with SMTP id oo18-20020a05620a531200b007859584a080mr9090669qkn.58.1708228211641; Sat, 17 Feb 2024 19:50:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708228211; cv=pass; d=google.com; s=arc-20160816; b=eBMlx3aUXixrPN4dpRLAei4D8Dfig1fcyR9F2PbJay8rbB6t95PBLzd6pWyHw7wMGq 0uWeCPUwzDg9etAbrv3jY7pwRaneFceGTO66pxrqcUERdR2ixdZ5NJoLMFmmaCUjS6Hf BbNzIe84wFy2rAxflaA6eNdHmRFSvmDam4CbOvBPr7hnEDIjjN04PSfE+/JwcObYi35Q 69g+8Gyn74VmHnCNs/kL84oosNExX0X/ZJLva18dznS+8hYLmv7Oum3vO0ygTgfFMX/Z Sz+gdjo8F8q42n0O+70PZxaI0AkiRNRddZ0ui3sZHNkyIQSsrgvCxUySax1FWejPj8G3 66jg== 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=67dWJcyL54kcN+Ze7tTUw0tyVsipWby5lWSevGJj+cc=; fh=LNu0c3gNPK1mYjOca90icpQXFsjqhO0esU5jl/im0Do=; b=nxB0MPtEUcASYGCb8B4uTyrMBswL9t3dNro1Cvyq6Zq6l4ccuYZEFG7NfO3PiMxfsR sqmlm3AJA4Hest8Is9lj+XanMVDRMr6SNfK1QKIpSOvtuGaSWifWv+fgNnwp852AY2wx 5RlOKkKjlUpivwA3YhpS9a7mAVdVwHaWbyifVgaQZr67dM67e+uJFvfGE54U7xOBQOj5 vYs1FFEmRH62LiAf8x9tPThPv45k1+lZt6hw4IpwqpE5ROviJfte1Ddcik5Z8sJ0h8M2 LMGaT1UvbcHjnpIcYf/IwrlP+aqjO1CXPPDQane3ZzngJDPLSHEW0XfQv4CVNv9+BbwT 14QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fkLmkQJk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-70182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m10-20020a05620a24ca00b007859f20c29fsi3840852qkn.616.2024.02.17.19.50.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 19:50:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fkLmkQJk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-70182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2A3271C20B28 for ; Sun, 18 Feb 2024 03:50:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C6954A39; Sun, 18 Feb 2024 03:50:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fkLmkQJk" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3366A1847; Sun, 18 Feb 2024 03:50:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708228205; cv=none; b=sZiWGRKW3olbp78qFEbSLbaeJnlRWxOwzDRrqTQg4b2v+7L8sMzsWYug1ud/N1Hm9l6/BfVbcJNkxO/47wneCebjwQwjhzUzx8ULVPUTYGd9hCUvR8Mmyd+RZ5Q2vQy1naIznzWzL1mxiHrD6ZJDfeZ8+prpXhhqwuKKvEHSHcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708228205; c=relaxed/simple; bh=sAZtlOB1+PHDIQry/loBfiOjsBGxCaskSKCvfLtCt5A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pol1vf1JnuPp3786sEfVrT5FAtnzTD5g11LJ+wcHT02Rs/XdjwdLRJpStENo6vouy6njLZHdJyBowsWpt9c4+RSjJ+I/gJ0WodHDs3EY8LzihL/jn7JYRIvfwWDUYoqs2FVRsbrvOseXv21EffKe8v0VspmAjt6xrpYWdszZDqU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fkLmkQJk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76897C433C7; Sun, 18 Feb 2024 03:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708228204; bh=sAZtlOB1+PHDIQry/loBfiOjsBGxCaskSKCvfLtCt5A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fkLmkQJkOStOgUabU3CYZ5eG3SXDjWAV7/EwZHEnsEA+jOD0PaLd4RmN98Qv+dGhG bUskwkWxDO0fZYOX8/tnEPcdN7hY83iSBZLwa4FUVgVc25EFtKNjm+PiJWz2o30BYE SIzXHGzhIPza4rvWtp8bWVLVZ3sHGPIthTIg9C/Mas6s4je1vmqaQinDfJbmArQD/Y T4D9axVs+OQIwcAKuWvz0/zR15PkcbNPK6WVJLtgN2TVgl6PnREZl/EC4BvouoMqkD EOPiAmKOmFWZ6AVyHvy0LYOOUDwQWYEx7Bt6NvtoHlFXXhgBR787hSK/yBcHo/gYhi aHENBUJB+P+og== Date: Sat, 17 Feb 2024 21:50:01 -0600 From: Bjorn Andersson To: Bartosz Golaszewski Cc: Andy Gross , Konrad Dybcio , Elliot Berman , Krzysztof Kozlowski , Guru Das Srinagesh , Andrew Halaney , Maximilian Luz , Alex Elder , Srini Kandagatla , Arnd Bergmann , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Bartosz Golaszewski , Deepti Jaggi Subject: Re: [PATCH v7 11/12] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Message-ID: References: <20240205182810.58382-1-brgl@bgdev.pl> <20240205182810.58382-12-brgl@bgdev.pl> 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: <20240205182810.58382-12-brgl@bgdev.pl> On Mon, Feb 05, 2024 at 07:28:09PM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The "memory protection" mechanism mentioned in the comment is the SHM > Bridge. This is also the reason why we do not convert this call to using > the TZ memory allocator. > No, this mechanism predates shmbridge. > Signed-off-by: Bartosz Golaszewski > Tested-by: Andrew Halaney # sc8280xp-lenovo-thinkpad-x13s > Tested-by: Deepti Jaggi #sa8775p-ride > Reviewed-by: Elliot Berman > --- > drivers/firmware/qcom/qcom_scm.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c > index 839773270a21..7ba5cff6e4e7 100644 > --- a/drivers/firmware/qcom/qcom_scm.c > +++ b/drivers/firmware/qcom/qcom_scm.c > @@ -563,9 +563,13 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, > struct qcom_scm_res res; > > /* > - * During the scm call memory protection will be enabled for the meta > - * data blob, so make sure it's physically contiguous, 4K aligned and > - * non-cachable to avoid XPU violations. What this is saying is that the memory will be made unaccessible to Linux, so it needs to be contiguous and aligned. > + * During the SCM call the hypervisor will make the buffer containing > + * the program data into an SHM Bridge. Are you saying that the hypervisor will convert this memory to a shmbridge, and then pass it to TrustZone? > This is why we exceptionally > + * must not use the TrustZone memory allocator here as - depending on > + * Kconfig - it may already use the SHM Bridge mechanism internally. > + * "it may already"? You describe above that we shouldn't pass shmbridge memory, and the other case never deals with shmbridges. So, I think you can omit this part. > + * If we pass a buffer that is already part of an SHM Bridge to this > + * call, it will fail. Could this be because the consumer of this buffer operates in EL2, and not TZ? Regards, Bjorn > */ > mdata_buf = dma_alloc_coherent(__scm->dev, size, &mdata_phys, > GFP_KERNEL); > -- > 2.40.1 >