Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3089108rdh; Mon, 27 Nov 2023 06:21:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHubGQc8xDsuahqtkSuwg1VliLUNCLfsvR4XSKxUTheHzI/pg04o3gkhEkScnFLP1o3Mvb X-Received: by 2002:a05:6808:2384:b0:3aa:1306:96e8 with SMTP id bp4-20020a056808238400b003aa130696e8mr7521604oib.1.1701094863245; Mon, 27 Nov 2023 06:21:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701094863; cv=none; d=google.com; s=arc-20160816; b=ucSoWXRLrSLV6EBBE3hVOxTPyxtgo8rcpMIDObvXdNd3syBO9UR1JWr//8K3SzjcHa yyZOpJ4Q6QiKCa79x+wcGlBVSLpEMlWC740w9+LwNnLg8TCwarMN64kzwXwyKELcbYUf XgHFjFHaBahXR+mnolAjOMaBLGkFVwJ+vSlc5QD44AY3ffugT8EoTqoCNF2Ki0ZbQUuz KrWFcdce0e/okHF4IghcZvDwn++yH84YG0obmgVeQ2jeDVdh+528+fsL0VSOexJK8o24 0xxuaNw5jebde5xPG84PmoKbfDyCyUFM+H2n9LWxpoAKnIfdmNC5kN1ybSLCsKNz41VA PPJA== 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=M4fo0VIV7uqzpyPDAWdX5Jk/6XQkZo9JW17PTbGLI2E=; fh=lirm1ccAeXZZB1cIo+N1DqklpgcFmD/vJ7PCWNIL0HU=; b=ytohrbTIVvoUofvJusSq6Z8/BR8FtG3snkc6qvOmO+WYW1JAb4Ycj8CK3asCNtmFsa Da1XqkW/z9hn217LVz0SogTcJTYZy5XouROs9zrnWwIHz0ktwhNoPao2uNbZsg4vFWWb wfHSKEZvKRZ2SXFYBgxwyvDToTO8DKH4fhzYQXYfcVLsp2n8+fX9EIdSu5FLqAAj/7Db JFkFr62qCI0KOCpDeqAJ1iKlpFJXoqaeEIuCxEicN44jilztI0ikK7wVnIA9CQMVjzmM HmbOrSqEPnO5GSwjUJKGqv8AXhELp7bIpe8jXn7Xd+PXyyeZOtFg2OnxUfpYOoSfwgmo rbIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=plkoYkmB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id fg14-20020a056808640e00b003b834603fb4si4035467oib.313.2023.11.27.06.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:21:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=plkoYkmB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 562A6822012B; Mon, 27 Nov 2023 06:20:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233839AbjK0OTu (ORCPT + 99 others); Mon, 27 Nov 2023 09:19:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233762AbjK0OSv (ORCPT ); Mon, 27 Nov 2023 09:18:51 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1E1C3C22 for ; Mon, 27 Nov 2023 06:16:26 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c5056059e0so55266601fa.3 for ; Mon, 27 Nov 2023 06:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701094585; x=1701699385; 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=M4fo0VIV7uqzpyPDAWdX5Jk/6XQkZo9JW17PTbGLI2E=; b=plkoYkmB9344i0oHWaJmZoffQRgZkzJ1Sx01e8tdZHSdQsj4PBZNoBL2aDS8zugNvt ix++MXL/nETMJMcpJUmIPSMPba0JFms3vZdWV11CPFjo+N/a2WPhox7AKDk323g1SIxM cZWTU+QlGh19thyyx7oHVuztVBPILN10g2kncaUBtk05DcsBmOHYV3YB3XT+0w49LbHx cVQ9aaY4vubs4CnyWKqQxMVF5WqRzgs9pMsYEnck3F+k0pfevQKwr4xT7+GmDgBfHFK8 ymU8r2WHwsQod2Hhxif/nsejwuyURi+DFg8BkAquIi14Gzss/u5WNTuNwipKGTh6U4Ag m5kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701094585; x=1701699385; 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=M4fo0VIV7uqzpyPDAWdX5Jk/6XQkZo9JW17PTbGLI2E=; b=Z4+tiS9O4RZQRNktMS6GA/dM28wYDI4xGU4Ifq/PFQbmO6yMV8flONSPyrCvpHXp4R ckj4GlUfSJ5lpEv8P4O26JDFnsfbQcnxng+j1je9wI1Ejlsuyqv7rLpntRmG54aBTyhY Z4STU24w4tpyR9rOZMldfxM3lhdVkqAC7z4yr0v6PS2w0ZxbS5UTLRc4qagxljjbS7DC KfN4tpP3Fzs3jLOts0O5TsWprxYduO/1lbhvuhxqtXCiVMfHH92HmyTAQln5+zU6w7tD HyAEdy6Rrf12Wt72OpY1L8vp1+5omLX86M6X4wbEPuJenOwYbwX1gqcV9Cdb/V2Gbtkh Xhxg== X-Gm-Message-State: AOJu0Yx3kuATeEi07jnIryT7Z8P9qpJVYZh5NnhpKnh8pSlO55sRExqj hRedbrWXwtIOxIQANeBS0lHHxA== X-Received: by 2002:a2e:a7cd:0:b0:2c9:a09a:dde0 with SMTP id x13-20020a2ea7cd000000b002c9a09adde0mr3080219ljp.28.1701094584920; Mon, 27 Nov 2023 06:16:24 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:bf33:77c7:8131:5e64]) by smtp.gmail.com with ESMTPSA id be7-20020a05600c1e8700b00405442edc69sm14658830wmb.14.2023.11.27.06.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:16:23 -0800 (PST) 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 v6 12/13] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Date: Mon, 27 Nov 2023 15:15:59 +0100 Message-Id: <20231127141600.20929-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231127141600.20929-1-brgl@bgdev.pl> References: <20231127141600.20929-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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:20:50 -0800 (PST) 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 Tested-by: Andrew Halaney # sc8280xp-lenovo-thinkpad-x13s --- 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.40.1