Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp899061rdg; Fri, 13 Oct 2023 04:51:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYyQHOijbyVuYpQUed1odN/G3baPsnTZ/MzDWEu02g1n7JpXNi1OWDAbz4oTcdFcYVPLrq X-Received: by 2002:a05:6a21:778c:b0:173:f49c:ecb4 with SMTP id bd12-20020a056a21778c00b00173f49cecb4mr7076597pzc.53.1697197918062; Fri, 13 Oct 2023 04:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697197918; cv=none; d=google.com; s=arc-20160816; b=DYWQikISHMYJQ143/MPwYwI84A1tgHn+/u7qK14U304hR1ZJez+zV4HizHhRRaZiVr FkmYY846MGcOacqnr+C8m+H+TwhPdQiltHCKE1fuVEj+ezyM6OuoX02zcG56IXZghgTR BpfRsSL0ne5PRimcGGTKJNjn3M8uS1YUo8hpenFpdCdSUUsVMZRjqbsNOuKCvF9p/rTW FG+qo5r8JVu3W88CPqm9c4ArQxHbQ0NsmfW9zitESvxNANfnoFilqdEJEIxhY9JSumAG 3hA1tTPFgcfMt96T8IC2cMVB20Rnn3ms+YnARWuUrJtuma2cMTbbLBkelJidTL7jbQeY r0gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f9Heyw2bPG0qaWUlPboXZ9YrcRBEbXtxsdZV2np9Ptk=; fh=lirm1ccAeXZZB1cIo+N1DqklpgcFmD/vJ7PCWNIL0HU=; b=GGL18hLRAtlJ/MctavPDlPn+S0G+/TjplphUlax2A18PPntOT9lKXLJa7QcMLaum4i dfmsmdyhltLsUcrGPfvSzSY8PfAeUbMzODHen198JBSVRrVI6AuKP4gSxU4BRFQH0W6H RRHMnRoo0SA22EwUsRoXyJ0mx9lquk6zu9ZKoDw+ZzNnQBohRJqIECeFm+HDj30Rr2cI Sd3V6MVDDpghIH5g1QTRYlr1Wkqv57QGuizaK1D3efn/VptrqwqDPOVGqHmd7m0BCy58 fsbSdLuWm81f7HM/ctmFmgbHZddaALZYK+EUCFC2HlCEG/mdRrIY7xx+C+zKVbDfmqq8 hlVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=bkizvJdn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t2-20020a170902e84200b001c61bdd8e89si4514969plg.150.2023.10.13.04.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 04:51:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=bkizvJdn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A0231808D496; Fri, 13 Oct 2023 04:50:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbjJMLtx (ORCPT + 99 others); Fri, 13 Oct 2023 07:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231615AbjJMLtc (ORCPT ); Fri, 13 Oct 2023 07:49:32 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2788611B for ; Fri, 13 Oct 2023 04:49:09 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40572aeb6d0so20608325e9.1 for ; Fri, 13 Oct 2023 04:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1697197747; x=1697802547; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f9Heyw2bPG0qaWUlPboXZ9YrcRBEbXtxsdZV2np9Ptk=; b=bkizvJdn7qJGt0KlLaSfH8Du5EBxmJoXZzEVA8GPG5r82fGRF4Uqe/c/uLsYN9qFoT RuZHbtuD3MhaewRhKwnyYIIyG8KA/NdOfGS3jMmABS547WHcEzzg80IWAsdpcaf7Uh6+ IJwfR8AXbXYHE1BqrWglmF51Tk63drBGQY9orNGe+sxk68z87eYGyNt4FsbylvTCC7NP 2LUVmjqZwPUKmd4EE93Mb47z+2qDfaxQF3n8i3aDJ726UwiQz73RoaDscD+MN7xkQ2QX YAfzwUGHhn6Ibxq9oeFehMxv3X6ZhsiZNYBNaWD46GK/t68XVuvSXDmhmBxztBzzhXqr llXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697197747; x=1697802547; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f9Heyw2bPG0qaWUlPboXZ9YrcRBEbXtxsdZV2np9Ptk=; b=RnP5mV/s8JztcIvkH7AzYvwU1a66IjpAj8rn227QdHQ7cJCrQ9QU6VjHYnOwOcpwM4 CSHZWtA8zhwj3SdYKEpd2tlYa04NhG44x1qPhRQy2O5+CwHundN/EJb7+qBknm1jJkJG pbvz+L9uabeyJ5gSwMw51uEiS/+j0Jb2NZfgzrqGGy4G/rVOCdBeZ/rXkUIcQnLTN0W+ YHenXigc/gCAnwnQwGmBJ5ZAJV+PniJ83oWidGwtrrJ8IXC1eYwKBW66v/OJ2gO8Tr2D CeHuOpSrqDnQqvnYzCSdrlKxROpsHKYOCvZQOFER5gRXZiHwGI7Nc50mbRQhH62qx8xB USUQ== X-Gm-Message-State: AOJu0YyhDow/e+rRvcJyPtFFynOuBUUriOe1MKFtUevXVNKogTBZGIQS Xbe9nzqW2JBsTJxEYAh+7vJ1yg== X-Received: by 2002:a05:600c:3b18:b0:407:536d:47ae with SMTP id m24-20020a05600c3b1800b00407536d47aemr9754099wms.38.1697197747308; Fri, 13 Oct 2023 04:49:07 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:4209:13a:988d:80be]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b00407754b998dsm974509wms.27.2023.10.13.04.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 04:49:06 -0700 (PDT) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Elliot Berman , Krzysztof Kozlowski , Guru Das Srinagesh , Andrew Halaney , Maximilian Luz , Alex Elder , Srini Kandagatla Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Bartosz Golaszewski Subject: [PATCH v4 14/15] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Date: Fri, 13 Oct 2023 13:48:42 +0200 Message-Id: <20231013114843.63205-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231013114843.63205-1-brgl@bgdev.pl> References: <20231013114843.63205-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 04:50:27 -0700 (PDT) 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. 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..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. + * During the SCM call the hypervisor 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. */ mdata_buf = dma_alloc_coherent(__scm->dev, size, &mdata_phys, GFP_KERNEL); -- 2.39.2