Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1091981rdg; Wed, 11 Oct 2023 14:20:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZ8aFrs7m6BNoZWwUJ7XOpOXuXnlUiLH4CAynhswE1RqZ2Dml0Y8qcei5uSA8gBA0OKOwJ X-Received: by 2002:a05:6a20:9152:b0:14c:5fa6:e308 with SMTP id x18-20020a056a20915200b0014c5fa6e308mr20580410pzc.43.1697059254235; Wed, 11 Oct 2023 14:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697059254; cv=none; d=google.com; s=arc-20160816; b=KPZuzaPZJ/iwnt8NQaOWd9Fztt3Bdq3LskYK3pIltPKcHo3WCwLrRl9XeovmvbJOuF rVoY1IRNVN8JwuACvd8Kb60SieDZwTWOxn/9h/uBrG/dl1Tx5BH30jEbiZZDZcre4WCO Jz2IdEhKgfVJUM2nTXy3uELNM7jPNdS6Tae4bqxAe9orbuJ8tCkFnJ/R6jmZTQobnD05 FFmHw9EnWmd4kAui5V/YJWZrnO4y9w+ErPjBFvSo/pyrpQrgeqLo82mizun1RRu7099R 0qo+m74GdlXEMgQSmUhtabVbRecbfPGDuZpER22AI/9KsjfmimXUp9pjXtR6VdEi80Cl p1AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9ARFU5ehJ77LMWQGx5SDRsMXLUYL9Q8sCSHPYnJI9hQ=; fh=4jyF2ZUBQ/SiJHAfGoV+niA288FYUMeb6Ahk+NIw7Pw=; b=bPSGiqCLa50OHzYWBCuhENkivjKWhB6uBIArKlUJt6j2b8XDL0Z482pik6tXGh8qKe 6F7zTz9aPc6tYOxQkr9gZA9OzTs7NNBrMe2b2hxBnM8H1tRD5UhANK31mch6vN4jsb0B hsPH4XY52oSU3JiWeeozzNUVaD5dhPSNtaVB6ckmjm8CApgQsJ18BHcDM14CSaaaFEyv iIi4fQi+xRkoxVnfNJryR2RKt0Cm8hxyd04TGIpksK5pYG3etQIHwpYr3EqVF70y6Tj5 a/GyahfGSpuEhmImEM3fyeH4akUOHnEgOjV+Hwrraq0MxFhBUt56AdcDD0XXj4ldpx9m ovLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eGWT7cA1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p5-20020a17090ab90500b00278f6a8027csi626632pjr.154.2023.10.11.14.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 14:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eGWT7cA1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2973280EE854; Wed, 11 Oct 2023 14:20:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233451AbjJKVUO (ORCPT + 99 others); Wed, 11 Oct 2023 17:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbjJKVUN (ORCPT ); Wed, 11 Oct 2023 17:20:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A0FBA9 for ; Wed, 11 Oct 2023 14:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697059163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9ARFU5ehJ77LMWQGx5SDRsMXLUYL9Q8sCSHPYnJI9hQ=; b=eGWT7cA1oX41XyND6xTX+DnGSccEauXa8j+lgxIMhGSR0fm9MDQqc10O/CBYJS+rk3ykUF jmZuIgvsjT/rhEYUuIhC9QtTn13eRZ/AIQVklgvHILnbFkwHdi1sr6E04vRzXmhQIPKIVl d22RKwOfT20YaPY7J+KGUbwm9SecIYM= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-NxDZTYGPMReF_eU-2-VvxQ-1; Wed, 11 Oct 2023 17:19:11 -0400 X-MC-Unique: NxDZTYGPMReF_eU-2-VvxQ-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-774105e8c7fso33936085a.0 for ; Wed, 11 Oct 2023 14:19:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697059151; x=1697663951; 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=9ARFU5ehJ77LMWQGx5SDRsMXLUYL9Q8sCSHPYnJI9hQ=; b=pJtnsHwhiL1D0IG6TLgFRfgkKKUopu8SOnTKJnE/CCzruxuiwOmOdwOrQSks2naFBZ XI/63GEasfvoseTNsAaxspDQFs1opbz4EpPAfaa71R7S/RFC261E/YYkV+gYXBZDK1Vf tJLpjiJiyYibrTcN3rznxPIR8MWJUvEBaRbHf8YzD3YffqgYgJqu0S8q8JUFNUrj6/Rp Re1F83SQn/W2YViWyZtkTjzWHdWQJbupXiicO5BtbV3rXZEcHlHnUCw+Sal/PZyK1e2M taDBIh+oMwctz00BWf7AA5utMvokWiMUPcckumIv9N1i4rSt28WgPN7vhL3eoxvwLN6f gcJg== X-Gm-Message-State: AOJu0YzPuYCVLhVPBBuc7NoJ6AfUV9i+DLC8YuDhiKCV7l6sRhhcvgoF WizuoXooMunv5SKD9MzAJ/rYdsn1RCSXtyGqTEcd1NEpTQobGvRmhc88yfwNHp+rADPFLdMlGLI hg+hgG2213x1a48NvMX2rjRZm X-Received: by 2002:a05:620a:24c8:b0:775:9025:c18a with SMTP id m8-20020a05620a24c800b007759025c18amr25845154qkn.35.1697059151238; Wed, 11 Oct 2023 14:19:11 -0700 (PDT) X-Received: by 2002:a05:620a:24c8:b0:775:9025:c18a with SMTP id m8-20020a05620a24c800b007759025c18amr25845136qkn.35.1697059150956; Wed, 11 Oct 2023 14:19:10 -0700 (PDT) Received: from fedora ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id y23-20020a37e317000000b00767da9b6ae9sm5493487qki.11.2023.10.11.14.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 14:19:10 -0700 (PDT) Date: Wed, 11 Oct 2023 16:19:08 -0500 From: Andrew Halaney To: Bartosz Golaszewski Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Elliot Berman , Krzysztof Kozlowski , Guru Das Srinagesh , Maximilian Luz , Alex Elder , Srini Kandagatla , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Bartosz Golaszewski Subject: Re: [PATCH v3 14/15] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Message-ID: References: <20231009153427.20951-1-brgl@bgdev.pl> <20231009153427.20951-15-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009153427.20951-15-brgl@bgdev.pl> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 11 Oct 2023 14:20:33 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 05:34:26PM +0200, 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 TM mem allocator. s/TM/TZ/ ? > > Signed-off-by: Bartosz Golaszewski > --- > 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..8a2475ced10a 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. > + * During the SCM call the TrustZone will make the buffer containing > + * the program data into an SHM Bridge. 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. > + * > + * If we pass a buffer that is already part of an SHM Bridge to this > + * call, it will fail. I can at least confirm this matches my testing results in v2, fwiw. I guess you could use the Kconfig and conditionally use the TZ mem allocator if !SHMBridge, but I don't know if its worth the if statements or not. Bummer, I can't think of a beautiful way to unify this outside of a dedicated non SHM bridge pool for this... > */ > mdata_buf = dma_alloc_coherent(__scm->dev, size, &mdata_phys, > GFP_KERNEL); > -- > 2.39.2 >