From patchwork Mon Jan 22 10:21:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13525120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C23AC4725D for ; Mon, 22 Jan 2024 10:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1cLLXAcvcFwiPjO/W0jhKaUo7slEnLmo9X4LPaf40G4=; b=gVD7bQVRFnpUHu JC1KE5/PgTZ/CDgNHNDUfiBBtbr1iSVA7+ovAgriROHxghhVz3N6wxchro0ihorEclp6NJLxymozt SzT2CtBibCrYd/mpRTP6QI2lK9TKn0OFrRliHIPaa7tFirGiUEn0zdDObQEV3UKU4DW6lDkGrZARZ Grirlksg6BnxK7BFdmIdqgiGjP1iFF8mURVzCskbAMGF4WwjyOLh6DXwEH5uRUopW9E+h4IP//f1x ruXCKMfBDwZYxfDwHaPGKcadyG4VWlAsNG8Rp0Y5Rv0KPJXNDD+rWdnFgo2evocD9mrj5ad5JfgT3 /7hPrJn3csutoG4Gnmig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRrRi-00BUfG-2j; Mon, 22 Jan 2024 10:22:26 +0000 Received: from mail-wr1-f45.google.com ([209.85.221.45]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRrRb-00BUYT-1m for linux-arm-kernel@lists.infradead.org; Mon, 22 Jan 2024 10:22:22 +0000 Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3392b045e0aso1433305f8f.2 for ; Mon, 22 Jan 2024 02:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1705918937; x=1706523737; darn=lists.infradead.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=I7SHOJjWn4ajTNVMkc896KlcCL3KSTkPo3OUGdVQzNA=; b=J1NP+sEWbGLDF25bfjlM0V6l1werJ8mP+a39ZbzBV5VBSooJ1t7Qdv8gtQWyxfN3Bh s1Cpvqnic6mQ0da5c2g4dAAKJYPTlzmrV7Dc+dE2KAzwks/79BlzkzprLR/oyg+xxPL+ Pf3edxA3vsEkYIMx07dJF7Qfu805qYk5ka6DgLGmjPm1tJZ5D6jfKCFnO/2iw7ULjPN+ W2qzy2a1q3XcAnWGkIMrqv4KuNySBhmQ47RuPERAReaxcQ4BiRanTZnt7WNQAWhQZJJK iUUfpQ0dbRz75Rloa5dl1hPurqbgR2qqwkuqnALBLJAUAVhZd4Az56xGlTxAZqNAFMCe hlsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705918937; x=1706523737; 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=I7SHOJjWn4ajTNVMkc896KlcCL3KSTkPo3OUGdVQzNA=; b=GOATLKzoIE/usfrbjsW3HHC4YAlKbT3AsSoyl+7VbVFQTEh35GCciP2iLraNelYkvh mXPGUlzAYYkwuBzHrVHgPAtZxL1/WJyQUH6ePk0czrDjMtq03daQkbj9h+n4Su+kKYH6 nsSL/dVbZrt2BLTG4FQIeEALE27Z867nRIOQx5iXNYh7Y7t1pSeLv/7bHAzCPJDQu53D EtTIaTGSKBmt0PVdO/XgHCpJrRweWs+F+XIkxTWPwR+eDO6ACzdZUJuzcCbmIgC8r8J2 u7B/CFQiqtCEsbRKKUu1LhuJBVMokiJVTgGAyOlLhtEKdG9gPa9UHrx8TNgJhTbhRRCx z4+g== X-Gm-Message-State: AOJu0YxkYe58FBcuAziznY1hX9xJ+0dcZRsaRPqZFpuAZ6zxCT/Vz2Sz iAsKS8OUUYdtT+boK185ieLCEg8r7h76JwwQYlJJtpRc/eetwt5nLxL2j1YnFXY= X-Google-Smtp-Source: AGHT+IHVbNlOQgFdYPbkVMPjMwRGFVl4LkZjPMLDkULh+1emzr1igA8P8yD98ilTgwcQiDyDvQcP/g== X-Received: by 2002:adf:eb0d:0:b0:339:3edd:1427 with SMTP id s13-20020adfeb0d000000b003393edd1427mr211328wrn.73.1705918936970; Mon, 22 Jan 2024 02:22:16 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:92a0:6172:d229:1898]) by smtp.gmail.com with ESMTPSA id q7-20020adffec7000000b0033926505eafsm6377904wrs.32.2024.01.22.02.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 02:22:16 -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 , Catalin Marinas , Will Deacon , Arnd Bergmann Cc: 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: [RESEND PATCH v6 11/12] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Date: Mon, 22 Jan 2024 11:21:56 +0100 Message-Id: <20240122102157.22761-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240122102157.22761-1-brgl@bgdev.pl> References: <20240122102157.22761-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_022219_596755_8B6C0BBC X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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. + * 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);