From patchwork Mon Aug 28 19:24:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13368230 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 23729C71153 for ; Mon, 28 Aug 2023 19:27:40 +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: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:In-Reply-To:References: List-Owner; bh=P4yBMgxT8D8mSywaWEzFhpUoD/A3TGl+Ykqk2jGwY34=; b=XKk5/2ceBSpL6v l14SB9btfkkqGxM89ShvPZtKRVbSJlUMv+rsoLjw/sYq3UE/keuo0IXIoqTzJvNFJLkOfrbXuAKdG t79QZKeIiAAUPZE8diIxUpQogx4GeWC56jtohAz3d3UDfmVewnl4dr9qOTdOcBKCP+wlmIQj7MNRx ISw1B3CCblz9KvFc0IZV5hpMHWoA7wgKe9D2TSyFOBS7vz7hTpQTnA4j0l3noZipvBzLQowF0+SSo x2DhWMi/z6K39y+qbc58csCOFK5A/ZGHP6bUTOKtsDW3VXIl8UmRjq2jkzHFrv4C2GkF2Rj35VuPl JsE7+nCq23wsWO2JJBsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qahtN-00A91Y-09; Mon, 28 Aug 2023 19:27:17 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qahtI-00A8xP-2G for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2023 19:27:14 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-31c6d17aec4so3032649f8f.1 for ; Mon, 28 Aug 2023 12:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250822; x=1693855622; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+I1TnLNwxszbN8M9umRNZG7t7BQhMYgFfgmkLe46H00=; b=zL2r5Fa2OvovZvTJsUmtRlvcM7/4bDbHwz/+SAizjrHGB3/bwjeR2RJvwhXrRdpMxb RoqIv+AwrqiCQ0a7aQ+HPnVTTq5Qqa8zaWkc16WVSH4vELEvlDQUb/FPRQXBOccEcAgB xSDgMDQqG4YF4Bj+o1fsth7TGz8marxRdL1FQaFxCcvfENBHV5DeLdEDKG+lEcSNUXnO oT7RIOYq6Z/rRrOINKZUD3uEI7LQ+UyaLZ3nHlYALsxIUeUOgXvUHnYOpx7h1J9phke5 ByaenlZwxJa0vsq6DZnNhB9Ecind5uYaCRv2r6K88FeuG7Q3wphNehOj5IqZhWcxEB/v Dtaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250822; x=1693855622; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+I1TnLNwxszbN8M9umRNZG7t7BQhMYgFfgmkLe46H00=; b=O0Ww1oGhwilos4vTlgEVKFmfpbv0PDbbKxx/iB25aM5V+oCWUJftINBc8CBzxW3+zK UA/fsVKBZ7euMYvwqyo17fY306U/iyFC6+PXcbNEYmqYn1oGcISM+gqi0rD9WnQxjbcC RK9ifEQJ7ZdCu74YjZKfU/hauoAvj7/GzyNdtfbsp6j9ibfLM3AZiAT/qhaXgpy/uvjq Yo0j0mTfuMg4766je0GBoog6i9HuilwQKsBWfEK8ctMliZhZV57vuIHBA6qg/bJ12LfL kVfgOP6WnOop1u1puMu58Jl3NCNrzpPwMdo3lQDXhZdcTFMHtwApBhORyJ8cq/PRmnA9 NKMg== X-Gm-Message-State: AOJu0YyIG/LrzBmzFjCRHvdZaiiH+N6tAGlufhV62Qi8sotFvf9OmjL+ fcOGHz4pfvJ86MdRRjudkc4WNw== X-Google-Smtp-Source: AGHT+IFRafmDLjtEsJDP5s4bwx95AqWgutFAhLrZ8P//xmtwHnCubkYIeaz/6yYQH4/b3yQUfIZ6EQ== X-Received: by 2002:adf:f112:0:b0:317:5e91:5588 with SMTP id r18-20020adff112000000b003175e915588mr21843348wro.3.1693250822360; Mon, 28 Aug 2023 12:27:02 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8bd:7f16:d368:115f]) by smtp.gmail.com with ESMTPSA id i20-20020a5d5234000000b003141f96ed36sm11435319wra.0.2023.08.28.12.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:01 -0700 (PDT) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Arnd Bergmann , Alex Elder , Srini Kandagatla Cc: kernel@quicinc.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH 00/11] arm64: qcom: add and enable SHM Bridge support Date: Mon, 28 Aug 2023 21:24:56 +0200 Message-Id: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230828_122712_743808_4E204233 X-CRM114-Status: GOOD ( 12.64 ) 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 SHM Bridge is a mechanism allowing to map limited areas of kernel's virtual memory to physical addresses and share those with the trustzone in order to not expose the entire RAM for SMC calls. This series adds support for Qualcomm SHM Bridge in form of a platform driver and library functions available to users. It enables SHM Bridge support for three platforms and contains a bunch of cleanups for qcom-scm. Bartosz Golaszewski (11): firmware: qcom-scm: drop unneeded 'extern' specifiers firmware: qcom-scm: order includes alphabetically firmware: qcom-scm: atomically assign and read the global __scm pointer firmware: qcom-scm: add support for SHM bridge operations dt-bindings: document the Qualcomm TEE Shared Memory Bridge firmware: qcom-shm-bridge: new driver firmware: qcom-scm: use SHM bridge if available arm64: defconfig: enable Qualcomm SHM bridge module arm64: dts: qcom: sm8450: enable SHM bridge arm64: dts: qcom: sa8775p: enable SHM bridge arm64: dts: qcom: sm8150: enable SHM bridge .../bindings/firmware/qcom,shm-bridge.yaml | 36 ++ arch/arm64/boot/dts/qcom/sa8775p.dtsi | 4 + arch/arm64/boot/dts/qcom/sm8150.dtsi | 4 + arch/arm64/boot/dts/qcom/sm8450.dtsi | 4 + arch/arm64/configs/defconfig | 1 + drivers/firmware/Kconfig | 8 + drivers/firmware/Makefile | 1 + drivers/firmware/qcom-shm-bridge.c | 452 ++++++++++++++++++ drivers/firmware/qcom_scm-smc.c | 20 +- drivers/firmware/qcom_scm.c | 106 +++- drivers/firmware/qcom_scm.h | 3 + include/linux/firmware/qcom/qcom_scm.h | 109 +++-- include/linux/firmware/qcom/shm-bridge.h | 32 ++ 13 files changed, 712 insertions(+), 68 deletions(-) create mode 100644 Documentation/devicetree/bindings/firmware/qcom,shm-bridge.yaml create mode 100644 drivers/firmware/qcom-shm-bridge.c create mode 100644 include/linux/firmware/qcom/shm-bridge.h