From patchwork Mon Mar 25 10:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13601745 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 048B8C54E58 for ; Mon, 25 Mar 2024 10:06:01 +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=mZxhTwDdXXQanPrzEzgfCMBb22Md5xOkHrrg5ojn6oI=; b=BxOTmbZugcRVZH HIFzmopYBTYvCwp4xd2l59b4HREPgXb8/rygt36RO9tG1yNKsZMVr0L9SgW4EuiJ0sUv04tn5mbtc a8FQrN6QRj7FiUmocGpyXGvhCKsb7NHszVjDE8gYLQXgtXrU6zg0cNPwI4vaQIbYI1tj3DDF0ny7o v/kiapnQ+adhHNmrcM9WG1YXd7gGQ+bvO6bqHtxU/bZqbFgpnf3FMR/b+BupPipL3IDCkoKojpJOG XrySbxVw2+G5YyMjzp65Ni1lRVas7whz6Xk0karkeZldJY0ASpfSqTsYZTOsyQyo+mSTilypCAdw1 48flqXD7bkXBL01D3Xmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rohD7-0000000GdNZ-1k1k; Mon, 25 Mar 2024 10:05:45 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rohBo-0000000GcWP-2amC for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2024 10:04:28 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-341cf77b86dso448854f8f.2 for ; Mon, 25 Mar 2024 03:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1711361060; x=1711965860; 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=vea42ognBMGcSaAHWG2mdmwkMm3Lc8ado5KZvfpR8+M=; b=VXjgB7PY8JFrqUOJT3m95iPXX2w4Mkut1SeU2NpAW3bq7ccVZY4wXwdiVj/ed66mQd c1SmAeP0e0DVHP5c8T0OC29/EOzfcOBnzfpYOgocB6TzifF7CUveS5KloIU0+Ns8u2Vh IrK31f3VSXUxqOIq+waSMIEu4R3F096po5O5onn4szPTinHU2gwa/ySrGmOc2rrak58n C3j7PsNIqufqthmlqst3TZcbTcKLcjBc6FtpX4/56A5oxW+ruCAggP5rlUi4QspJke0h /aURMcUjL3L9A94T4BrPYm6jO+tX38LT9JBsMX9U2RCxFy2bMrUq+i/kyLyRbM60yWgp lHhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711361060; x=1711965860; 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=vea42ognBMGcSaAHWG2mdmwkMm3Lc8ado5KZvfpR8+M=; b=QMF4lzqAJ3tQ5GQdLKXIB8+H155GJHKKiCaRiCE4Di4cNbTFPYjW5e3bngtZGMW9+J W89qpepBIYuaaZUYdelDRKnAYN34QvrZ7zIdyqTBpOMOE21wKKsKhqBvX9nLDMOusbDK w/G9OLtxr6/PZuaBozoMyiuF8JMRFyRj1dSe75MPgM50MawrMCH4cuhqYzNXNBcyjrte 7ZcwI8HHQFeaXgDx9MVesb8LiYqPsgJNa+9JYQq6STCHAAiXtmkVelceXO6d2MTSCPjP lXjDm/AqnqhMDrVbhpuf1inhJKWfUtx6QqS2abUF0/XyAS3QIxWjdWdFlv8/fOG7HRYm NXlA== X-Forwarded-Encrypted: i=1; AJvYcCUcAohwKw8M3kYGGPVp3YHC6NEhr6PRyLFuBWVB2Iazcn+HJlLho+ECzmmrLoAq0bbTi+aTG+DvsbAaLA180tHdqBhi76T3Jq6xA0oRtQtAeSO2W7I= X-Gm-Message-State: AOJu0Yyv5+DmTMYFDMn4POhT3JSStxzfUGhmQGtRBFfWNp6eV640DVi4 GsQZKz/YxZCEmY7t/eB7DZSR7FW37YMQ6C83suk/UW3UfFVJmLx86d+QaotfXjg= X-Google-Smtp-Source: AGHT+IHkCZySHrP6x9NbzchPEUB1+eY0Z3c8mhgqYy6D1q3Q3MuEQvHmA/zyMe9GnYYIHuG6ThLpMQ== X-Received: by 2002:adf:f483:0:b0:33d:c2cb:c18d with SMTP id l3-20020adff483000000b0033dc2cbc18dmr5631688wro.32.1711361059941; Mon, 25 Mar 2024 03:04:19 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:75a:e000:861d:8b72:a859:4ce9]) by smtp.gmail.com with ESMTPSA id dv13-20020a0560000d8d00b0033e25c39ac3sm9086874wrb.80.2024.03.25.03.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:04:19 -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 , 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 v9 12/13] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Date: Mon, 25 Mar 2024 11:03:58 +0100 Message-Id: <20240325100359.17001-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240325100359.17001-1-brgl@bgdev.pl> References: <20240325100359.17001-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_030425_153986_98D34CE7 X-CRM114-Status: GOOD ( 11.52 ) 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 7a8d67c7b71c..1972757f8931 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -563,6 +563,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);