From patchwork Mon May 27 12:55:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13675202 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 4CE90C41513 for ; Mon, 27 May 2024 12:58:29 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PYAFjGKrnCVf6j7TOqnnw2VtUnpm1oXyJ2K47CMxUqA=; b=x5O3fxLx9RzaHl 4kw/ebZRqfhYZs1UrZkutv5zgnpRUVlj80M68ajTEyw4HJB4FOYI9bizjZto0Oq9vzptTKd0v+uMY RTzPON3v8mtaQQEZEMvUXMak6pvyliLPaZeCN6SrHyKcwtXglzPKnTU8/JAgLX9iG5WC3EpLGpIte BOTDL/yvm/w8O8yflIzKU9PPMBgsmG7t+TbcIkNMrBWZHrP6a8YoTu5dB4ajyf6p6WmgmsqOhDNPi TIJaq7dZ754VnEtP+yp6IoUe+jD/+zBnJmH/5ADSuC/lEbqcan//bdDuQW+YWByeGv4sK0M/xaEKY KnNzoBCbiAuW7PIkGD/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBZve-0000000EyR1-14RT; Mon, 27 May 2024 12:58:18 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBZuL-0000000ExfL-3ILt for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 12:56:59 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4211a86f124so1290565e9.0 for ; Mon, 27 May 2024 05:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1716814616; x=1717419416; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PMIsc88QGA/raXBhAJ8HOYxrV9zWs4VQkkcV3jWwTEM=; b=xMvCgdfhBU/4cJe2zVb98vcMJH980IP01fRBsjYKD+V8ZF+gTBCe/mzBCDx7JP93bB kme32JtcAejPZo4dL3W8PDQBRErT5/3K3Np3OY/L1a4rOQaLPBoP5Fr0vzz0WrrVGwig BeAS0fhdQnE+n2Xh/y+l3N1c0f0sX5E/0cESUw+fzrFHus0us0b84uMgM0kIkuLqkAjm MwPy8lvGCp2LnV14KdyT16xOOGRsUmBfcxbAvFlvzn9D1uQUwsV+uz1RM/8ir0xzRMMU 5aaSviz516i4IVgrdgT73IJGxwefS59I47M7eVrxmiYpsEFFENFBZOVi9oBrhSNVahBp Rbjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716814616; x=1717419416; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PMIsc88QGA/raXBhAJ8HOYxrV9zWs4VQkkcV3jWwTEM=; b=AEf5PZPBbGWhSzSLE7Vgi5HAsCaMDhvM41oeMR3tl+KIH6Rt887M1GAMYSbEO/cYw0 56yMbQuSpdZt31VAjUUKjvGiGiMic1mtVuNubwaP0jqcV9wYgemAwchzHk289MiQTvmv YHNrKl4oqM/RoC75YwahMRm5HzJTxiGjvL2KyQjy5aW+vVPMpSY+MtH0cWl9SzUqbJIc u7x76m7hk3Vsfq3grQ9LsuBbvo+KTcdCoO+SU48pb69WqoNaIuhtgaSZoT15XUeQMu6E xSgJPAlwyxQ9/M2B85Im3GaUfTce06DpjwhsL/I6Hb0B1evvM1QGmFzw4k94iDrE6zFr FKCw== X-Forwarded-Encrypted: i=1; AJvYcCXW1VkRfVN9ckFc4UAWmSPdIP6ps7zZcyb307v6CCJ8LPJnSbPL1lBTlh/sMrXMMYHMDjTIYzevoyIKphguF/E0JgR7GRDuzLoQitVx/A+r/QPdh48= X-Gm-Message-State: AOJu0YyGlF1pNvSWKNJYT5pO3KjVfDYwfcQCvHrvQ3iHIVnI5VFTs87m kflerRK46WvC0CrnqsCXpmhNnhZJ6pCMq8pp6eiV2z21BcMxdig1L/bE3AUNVcI= X-Google-Smtp-Source: AGHT+IGHS2hqyOI9qx7SWsYsNRrw1KZtMzYDBIfKzpavK9BFQA+8Qj7BEEyV1gjd7nfY1kxjXzWdhg== X-Received: by 2002:a05:600c:b57:b0:420:11c1:b240 with SMTP id 5b1f17b1804b1-421089fa31dmr75205545e9.24.1716814616420; Mon, 27 May 2024 05:56:56 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:75a:e000:c322:131e:ff9d:ef41]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f64f98sm138753635e9.24.2024.05.27.05.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 05:56:56 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 27 May 2024 14:55:02 +0200 Subject: [PATCH v10 12/15] firmware: qcom: scm: add support for SHM bridge memory carveout MIME-Version: 1.0 Message-Id: <20240527-shm-bridge-v10-12-ce7afaa58d3a@linaro.org> References: <20240527-shm-bridge-v10-0-ce7afaa58d3a@linaro.org> In-Reply-To: <20240527-shm-bridge-v10-0-ce7afaa58d3a@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Marko , Das Srinagesh , Bartosz Golaszewski , Maximilian Luz , Catalin Marinas , Will Deacon , Srini Kandagatla , Arnd Bergmann , Elliot Berman , Alex Elder Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1292; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=ssj56Ix1KLezlyyOGeC/8+DTWmkSbhleOtHWewaii4A=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBmVIMKC/c22Md4Uz3vbA/APLMpim25HRO37hokt wXXRAQw5JWJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZlSDCgAKCRARpy6gFHHX csuCD/4mOsn+XF+f6w+IEn9bDOU8ZPnSFEaKbDF5hsaUpYm9yN7YUE/dnt28Y01dVliV3UNnOj9 njtcycp5gwRuOckGQmQFdlEc64TWGKAhG37NR9n80CSpV/6eSnaMF3oON70hljgYi2YhceQHD6A feDbHTXCwhrtstW5pJCcDEY9Kh2ktEns4IK/tq8mSqTIk5ThKUu7aeWMoWyLOGfsPl6qFlsK6F0 49fwgVA8bQU6GCSe2lBOchXyu9vHKi/iuJEy+BEV5QNiyiQ+/VjuquGwkflJzx6LBrwD+StwHrQ u5tExvLp+TV1SFSsf507iM9xCfspBwA4VPzGkdJCMdhwlIb0aARxhqSdq/4CzIM3q6vUUu1uLul VFmg6bI22cvN/tFaJw+bk+ZjlvbsQy5FWJgZ8vVzxU6P4Ec6vt0c4r/eAKW1q7tKksovmB4zk2T 4Z5ACKAPnTazOfboNG9z35YFR0SWgW06mtzHiJUskBOQzva/dMTgPu3YEyW8a5oRR4O49HKDWp6 KsA//9kmM5/4V5uQKQqxd4/0nURFOtLvZLcLvtafh3VFVN7eD6ZU/Zm0yHlslEzJBMjIjmPigkV 3EFvp71GWEIJH+J7mkOZPcRMQ0Eekqdw5NUguCfJHO3xW8gL7+H4ALxhs5RcOCHC+lg9OXGxqh0 AVp9TLyR5clsUjg== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_055657_949635_E52240AD X-CRM114-Status: GOOD ( 13.48 ) 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 Parse the "memory-region" property and - if present - use it to assign the dedicated reserved memory to the underlying DMA callbacks which will then allocate memory for the SCM calls from it. Signed-off-by: Bartosz Golaszewski Reviewed-by: Elliot Berman --- drivers/firmware/qcom/qcom_scm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 94c34cde8179..c82957727650 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1942,6 +1943,11 @@ static int qcom_scm_probe(struct platform_device *pdev) if (of_property_read_bool(pdev->dev.of_node, "qcom,sdi-enabled")) qcom_scm_disable_sdi(); + ret = of_reserved_mem_device_init(__scm->dev); + if (ret && ret != -ENODEV) + return dev_err_probe(__scm->dev, ret, + "Failed to setup the reserved memory region for TZ mem\n"); + ret = qcom_tzmem_enable(__scm->dev); if (ret) return dev_err_probe(__scm->dev, ret,