Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1974158rdb; Mon, 9 Oct 2023 08:36:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkQ/xiB/7/ozRPiXbpyRlARZBH7av5zlfh2V3YylG457Qrq/BnlfLrxL40Wa1CnpPeF2ot X-Received: by 2002:a17:90b:4b92:b0:26d:61:3aad with SMTP id lr18-20020a17090b4b9200b0026d00613aadmr12537822pjb.4.1696865811997; Mon, 09 Oct 2023 08:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696865811; cv=none; d=google.com; s=arc-20160816; b=KcMh/Ug5lFDGEBKLzpMc1iX4Vw8uKDJl9w+aWvgunEBVSuEGdTVPshsyQ1Y3RFAuQo wfMILtsJj3rJ4H9V0BPjhTtrJThCrqjK764fcR+PyZRCx2PfjnyMs4J7Gi673OwJVBL+ mZU7pkuJryJKXyrHZt0Tg55npm6WsVL02LAtLTatOagYat8OeNyDjp4VEEi/UdZ1FHmc hNkXaneLccnJsMvHUd2ze0C0gF7lDn89JAmRIp4/2CsB+zNBpn/8TLvMTWzpOStILXhK EDddDKyPD9rxaVzUQtWHbUGpcEgtL+pmCiWkXIjGvODTC5jIAyKTtsxGqpeQ5HAODIhe 9VSQ== 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=yU/L4mkVh98Gvp/+ieSh1ph2o5TQmVYw2ScTJAizm9U=; fh=lirm1ccAeXZZB1cIo+N1DqklpgcFmD/vJ7PCWNIL0HU=; b=aS/1APL09UsFTEBjbI0Kl2VDEEXK3XJZcY9QbLTZPM7XnS8y7hxXJmWE+6BZ7I1Ey/ HIGBnOHvEfpywIRpKZoTdp73T/VNaEyRwbzuFly8YfoNrNAB5MBU2LyLRWGq/NrEf6Li eKCz9CjJR2Cg5upV9m0PwMuConJkIP5hKyyYLFnpEInbLHXjlecqZ9Fg699H5HD/up4P GquiM07KueU1Oe6XxpNMRMPTuEDL5grL01v6ibBuoyMz22Nq8rtjRLZO4YR6ubFVp42Q B1cI6+8bhMWJnOeDl65gV8cDdBgs1GmZygJN12RHH/Wdh08xH6xoO2xjUIMQkhTwspTK Z3DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=v0MwPdoz; 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 t14-20020a17090a950e00b0027367e0c931si11846677pjo.129.2023.10.09.08.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:36:51 -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=v0MwPdoz; 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 72F46809564B; Mon, 9 Oct 2023 08:36:36 -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 S1377819AbjJIPgC (ORCPT + 99 others); Mon, 9 Oct 2023 11:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377752AbjJIPfb (ORCPT ); Mon, 9 Oct 2023 11:35:31 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27BB2130 for ; Mon, 9 Oct 2023 08:34:59 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-32167a4adaaso4246558f8f.1 for ; Mon, 09 Oct 2023 08:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1696865697; x=1697470497; 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=yU/L4mkVh98Gvp/+ieSh1ph2o5TQmVYw2ScTJAizm9U=; b=v0MwPdozqQjwqtvXnI0mYWXX3iB8tSjBKftq3ab+Aox3xV+sqOtiP13M57u/WcHJcq KvyAunYrMAahNKCnVKhWTSizUnIiVYoyptIW4jXkp2k6vS5Z+0cJvzUmH+UMQQcPW/89 iLMruMFNsgR2k5/zpenlkPEnAFqZHwaPB0dKb733S1CIKIaOF0KCuvwG6VQlJQTmOG9m 9+DxWVnb5EkKHpn+Xy8WHornMIo8Ra37QDqpVmKpFVxRVDGJI1K+afHq6CUtSDeHmdTB l9XMOwI3P+MegnTqJKsfkqk4/FAUDDt/zZU5VjLWrzgaYvsg7H3HfnYI3nc/5aXg6U/C cLTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696865697; x=1697470497; 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=yU/L4mkVh98Gvp/+ieSh1ph2o5TQmVYw2ScTJAizm9U=; b=DlKsDM382AGgrqNCNuwMntzBCYfPAtsxBe2LSb2OLXfWFykeVijWrtQRGAMocPFKbq UzXEni1WaZptlwZV8k7vt6u323mFMZ99NUx2RTr8wiOn7oqZy7phqNcZWFnB7khjqaSQ y0T7Flmaspjp3Sxwj/LDdyXe2hsNms2Ml77dF2r7rLsC+vA/1O8nOSo+/eD76QDTewuM bMr0SZjTfFnhZbnSqYi8GPx6Y+XT6Amife5zjp2B44lOXvPgAjYyaFcZHvRUSw3hO9cX pHHnx3ZXvN7iAApcGI2mtIfZomx1gGrxHfhcWh2vA/xTFBjvTIQ2JNHxMWQgCf5dIFya 40qg== X-Gm-Message-State: AOJu0YyJY9oQi9YSNKoijFlRH0CS3zuZ/tpGRzHBaAxDpvjPfq0RCGDl Qi3LNLwSDiEUjbUvs3fqBlh5fg== X-Received: by 2002:a5d:54cf:0:b0:31f:ffd1:6cf4 with SMTP id x15-20020a5d54cf000000b0031fffd16cf4mr12817049wrv.12.1696865697570; Mon, 09 Oct 2023 08:34:57 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:f20d:2959:7545:e99f]) by smtp.gmail.com with ESMTPSA id b3-20020adff243000000b0031431fb40fasm10016521wrp.89.2023.10.09.08.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:34:57 -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 v3 14/15] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Date: Mon, 9 Oct 2023 17:34:26 +0200 Message-Id: <20231009153427.20951-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009153427.20951-1-brgl@bgdev.pl> References: <20231009153427.20951-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 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]); Mon, 09 Oct 2023 08:36:36 -0700 (PDT) X-Spam-Level: ** 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. 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. */ mdata_buf = dma_alloc_coherent(__scm->dev, size, &mdata_phys, GFP_KERNEL); -- 2.39.2