From patchwork Sun Mar 3 15:01:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13579828 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 CB162C54E49 for ; Sun, 3 Mar 2024 15:01:59 +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=tbQ6otKY0XsyQeZkvrZaMcLLLYCmvhLb+2kUSDibsmE=; b=OKcTnBD1iZxMZW Ir5j8HjMHjLufriS9UcSs5kiVhRAU7BXVbikXlAnoZh6fmMW4s+RIQJfFPNvvb8T5PjwCp6PLvgqy 5zjuKYngBiOyXv9aQwp6ygQRRfPy2tjGwRoQbrhGnLP/cGfFz29HP4kibHL6WkJJnlYf5LUlWQkJL ts0yWUaOJ4VCEkWUUWtvfm07xsFIxw6gz1R/jjR+J9kBOOXHApSKLoQiGcfGrkUrYvB+CgFnrgALA O5mA9n34wWIbinu+avTXL9nyQpgZzfGfiKrn9QbsjpVrUbYbrzzD38sA57XfkFWq0+kT8PsY0zctJ VF9i3kYr7kU7tgGTdJFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgnLU-000000068On-1GzR; Sun, 03 Mar 2024 15:01:44 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgnLL-000000068IN-3J1S for linux-arm-kernel@lists.infradead.org; Sun, 03 Mar 2024 15:01:37 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a450bedffdfso63009166b.3 for ; Sun, 03 Mar 2024 07:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1709478094; x=1710082894; 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=L12WZQfIjPLa8ST8Z/BOMDM6oqnRCJHCQVsMSwzBc0M=; b=AP2EoPsxIVHo+1Cnto3dHHD4c1IMxUNew3bOujVhqo6l/xbCiIMmjMpm6vS6NcrC5x 2Kb15fW/Fp/xvOMCoj/G9xEaKDfpeSPpuXHAsjZCVZUz79uUGXZM8qKagDu/1eerXhKD j5sPr/0i4NXF3rgdwoRNM/b1GUpkqFD5S7DvbV97mPRie2B2W94Hmn4lZ0qb8RgtQdr7 HqG1FzZx+63Pc+7P7C1XpGdqa2nXAaONekLHjpK0J7UK8B6wddCaq5UGz6K3GChei6gT m2VDpNvK9F7zWuWzWnVvsmZMKrKNnrsP0cLi9Zv/noPBOI/fokM8GHUtPCuQlcto7V7Y 7OvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709478094; x=1710082894; 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=L12WZQfIjPLa8ST8Z/BOMDM6oqnRCJHCQVsMSwzBc0M=; b=PWXj62XzXnV/DKbRPAZ5GmaZ8ZrsRY8bAjFsTYSIUWi7RBKCuHBdpGOMjcnCPLkGxh 981qAtPmC/f+Y0MUmv6plQI7cnBnuFqnnF7ZJih6U1fhThnYypDgOhUxrfpm+ZZ4Tp5Z xp1vAnoxpapQ29Enmc/x2bIECIdId64PppuE7i0z/DiIv7yYOwz7rsquOxh5eY6ZUBiy YXgSxLpQz5r82cZYg7HCBji/ngN85d2zfTkVZLmiN993E9gT8TVBg2man23vB9ybOiz+ gcic2vMymW8pfgOqBdSRziX2gbf4MVGGZhyibzBSWYr+8u79j1Q8U1du5Zk6T+WrmxOq 8mTQ== X-Forwarded-Encrypted: i=1; AJvYcCVqaliONaQSm73cn39nZx5Dt/PoTiOTKADfkkLbcp5011xnIZwT72CC2q4EThvpC5nHMXGN8KX5/kWin5qr61Z8RGvoe2MpkY2GMWadhNDmxQ3EwyQ= X-Gm-Message-State: AOJu0YwfdlxFad9+uKh2kG68NpRUM5EPY2VNj5cXy7k3pgbuq7egt4zE dH/tbeOzHKCIJeeP3rFiI41RytC7zSuwhoLjW8ZkiORcraYkPZIhDsLM7jtactU= X-Google-Smtp-Source: AGHT+IHW70cWGZpmNZWU3rtJ73z8LCBjIZw93+By8b7kiMvBnTYxyj+8PGipVGYRTU0OyQfXajoSsA== X-Received: by 2002:a17:906:4f0a:b0:a45:46f8:a181 with SMTP id t10-20020a1709064f0a00b00a4546f8a181mr125275eju.46.1709478093972; Sun, 03 Mar 2024 07:01:33 -0800 (PST) Received: from brgl-uxlite.. ([77.241.232.10]) by smtp.gmail.com with ESMTPSA id ch14-20020a170906c2ce00b00a42ea946917sm3740293ejb.130.2024.03.03.07.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 07:01:33 -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 , 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: [PATCH v8 11/12] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Date: Sun, 3 Mar 2024 16:01:14 +0100 Message-Id: <20240303150115.133633-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240303150115.133633-1-brgl@bgdev.pl> References: <20240303150115.133633-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240303_070135_893731_997123E1 X-CRM114-Status: GOOD ( 11.16 ) 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 811f93edac7f..fbacc959b6fa 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -566,6 +566,13 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, * 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. + * + * For PIL calls the hypervisor creates SHM Bridges for the blob + * buffers on behalf of Linus so we must not do it ourselves hence + * not using the TZMem allocator here. + * + * 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);