From patchwork Mon Aug 28 19:24:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 717774 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0805BC83F1D for ; Mon, 28 Aug 2023 19:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbjH1T16 (ORCPT ); Mon, 28 Aug 2023 15:27:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbjH1T13 (ORCPT ); Mon, 28 Aug 2023 15:27:29 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 308DACF4 for ; Mon, 28 Aug 2023 12:27:05 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-307d20548adso2964871f8f.0 for ; Mon, 28 Aug 2023 12:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250823; x=1693855623; 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=wD/cr04vsZ/9/IOH8u0P4R4N+JejbyXPUXltlkLTn0E=; b=M1YCfAkjhG7d0Ax1dScy8AVLJXABarbwhC5Mlo0zc9Ew3M2VGhafoaNLCteOa/m3yD a51pY+t6Juattc/dWgCcW5nI0pvqguxlPp5FJ5vGaAgvMjH1KJoO9MGqXY1f0LbEVuI7 dJKjPfwyZAUduK1/So0X8teePZ51EJP1GYGb9KQA055/SgoaFN3Z3Q8eDsSODuQVesfi g0wRYh8KooCB5ZAbAUhIOIXfrHkPDuslgoYMfLAr3MefJGv3an8ZasW5fR8A78XVetVA euyZ0Es9Hjfyda8lIn2WMO4xWS1bmAZlTwxN+rxdnLC+ZZe9RX5vQ8mxd9qJ/kOV5sCJ rijw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250823; x=1693855623; 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=wD/cr04vsZ/9/IOH8u0P4R4N+JejbyXPUXltlkLTn0E=; b=YJlLfcYzLR5J4lU9FUyvTKpRFyzgIQWEPJ3/djeCJzfrTkZPxUqbHxeI8xHZ4Dj9O4 QCFyBjau0JpH49kcE2tuiZ6zCoFn7s3GnsV+YR3bZyygV3dpEUScuVc0nrKAbmoWUipw 3TlJoijHeEjVyGkSlPETx+U3xbLP/AOA0rHu3+0X9QTWIDIRYCso3v65YFJJoP0hHN34 ek/sUCRBEXn9K7tGEqdA3wHv5pWs6DVAe6E3ndVtncWy/gQ6/8FdGCsxHSjH+2O6ZUxf m4NJxI0oHfjhFUF6E2ClabFhvcAjte31VRvHwJIh9cng5RSBKKpLRWkd4woIyGWWWsbb m2oA== X-Gm-Message-State: AOJu0YwetLClVo+Dbar4kF8vicKhmQyXknUVq+CaNBdpKIZ1Z/8X+eMt 246RuOcasSzZi5TGnDIlIvkNdw== X-Google-Smtp-Source: AGHT+IG2DjUhqTBQfx117neGDoGHgAk3CElFSNDlYxMkA8BW06/aoRj0xIELzMxoR+5xz/rb1iL0LQ== X-Received: by 2002:adf:e4c9:0:b0:31a:dbd8:95d4 with SMTP id v9-20020adfe4c9000000b0031adbd895d4mr19219586wrm.12.1693250823568; Mon, 28 Aug 2023 12:27:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:03 -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 01/11] firmware: qcom-scm: drop unneeded 'extern' specifiers Date: Mon, 28 Aug 2023 21:24:57 +0200 Message-Id: <20230828192507.117334-2-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The 'extern' specifier in front of a function declaration has no effect. Remove all of them from the qcom-scm header. Signed-off-by: Bartosz Golaszewski Reviewed-by: Krzysztof Kozlowski Reviewed-by: Bjorn Andersson --- include/linux/firmware/qcom/qcom_scm.h | 101 ++++++++++++------------- 1 file changed, 48 insertions(+), 53 deletions(-) diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmware/qcom/qcom_scm.h index 250ea4efb7cb..0187fc54249e 100644 --- a/include/linux/firmware/qcom/qcom_scm.h +++ b/include/linux/firmware/qcom/qcom_scm.h @@ -59,12 +59,12 @@ enum qcom_scm_ice_cipher { #define QCOM_SCM_PERM_RW (QCOM_SCM_PERM_READ | QCOM_SCM_PERM_WRITE) #define QCOM_SCM_PERM_RWX (QCOM_SCM_PERM_RW | QCOM_SCM_PERM_EXEC) -extern bool qcom_scm_is_available(void); +bool qcom_scm_is_available(void); -extern int qcom_scm_set_cold_boot_addr(void *entry); -extern int qcom_scm_set_warm_boot_addr(void *entry); -extern void qcom_scm_cpu_power_down(u32 flags); -extern int qcom_scm_set_remote_state(u32 state, u32 id); +int qcom_scm_set_cold_boot_addr(void *entry); +int qcom_scm_set_warm_boot_addr(void *entry); +void qcom_scm_cpu_power_down(u32 flags); +int qcom_scm_set_remote_state(u32 state, u32 id); struct qcom_scm_pas_metadata { void *ptr; @@ -72,54 +72,49 @@ struct qcom_scm_pas_metadata { ssize_t size; }; -extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, - size_t size, - struct qcom_scm_pas_metadata *ctx); +int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, + struct qcom_scm_pas_metadata *ctx); void qcom_scm_pas_metadata_release(struct qcom_scm_pas_metadata *ctx); -extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, - phys_addr_t size); -extern int qcom_scm_pas_auth_and_reset(u32 peripheral); -extern int qcom_scm_pas_shutdown(u32 peripheral); -extern bool qcom_scm_pas_supported(u32 peripheral); - -extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); -extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); - -extern bool qcom_scm_restore_sec_cfg_available(void); -extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); -extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size); -extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare); -extern int qcom_scm_iommu_set_cp_pool_size(u32 spare, u32 size); -extern int qcom_scm_mem_protect_video_var(u32 cp_start, u32 cp_size, - u32 cp_nonpixel_start, - u32 cp_nonpixel_size); -extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, - u64 *src, - const struct qcom_scm_vmperm *newvm, - unsigned int dest_cnt); - -extern bool qcom_scm_ocmem_lock_available(void); -extern int qcom_scm_ocmem_lock(enum qcom_scm_ocmem_client id, u32 offset, - u32 size, u32 mode); -extern int qcom_scm_ocmem_unlock(enum qcom_scm_ocmem_client id, u32 offset, - u32 size); - -extern bool qcom_scm_ice_available(void); -extern int qcom_scm_ice_invalidate_key(u32 index); -extern int qcom_scm_ice_set_key(u32 index, const u8 *key, u32 key_size, - enum qcom_scm_ice_cipher cipher, - u32 data_unit_size); - -extern bool qcom_scm_hdcp_available(void); -extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, - u32 *resp); - -extern int qcom_scm_iommu_set_pt_format(u32 sec_id, u32 ctx_num, u32 pt_fmt); -extern int qcom_scm_qsmmu500_wait_safe_toggle(bool en); - -extern int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, - u64 limit_node, u32 node_id, u64 version); -extern int qcom_scm_lmh_profile_change(u32 profile_id); -extern bool qcom_scm_lmh_dcvsh_available(void); +int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size); +int qcom_scm_pas_auth_and_reset(u32 peripheral); +int qcom_scm_pas_shutdown(u32 peripheral); +bool qcom_scm_pas_supported(u32 peripheral); + +int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); +int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); + +bool qcom_scm_restore_sec_cfg_available(void); +int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); +int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size); +int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare); +int qcom_scm_iommu_set_cp_pool_size(u32 spare, u32 size); +int qcom_scm_mem_protect_video_var(u32 cp_start, u32 cp_size, + u32 cp_nonpixel_start, + u32 cp_nonpixel_size); +int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, u64 *src, + const struct qcom_scm_vmperm *newvm, + unsigned int dest_cnt); + +bool qcom_scm_ocmem_lock_available(void); +int qcom_scm_ocmem_lock(enum qcom_scm_ocmem_client id, u32 offset, + u32 size, u32 mode); +int qcom_scm_ocmem_unlock(enum qcom_scm_ocmem_client id, u32 offset, u32 size); + +bool qcom_scm_ice_available(void); +int qcom_scm_ice_invalidate_key(u32 index); +int qcom_scm_ice_set_key(u32 index, const u8 *key, u32 key_size, + enum qcom_scm_ice_cipher cipher, + u32 data_unit_size); + +bool qcom_scm_hdcp_available(void); +int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp); + +int qcom_scm_iommu_set_pt_format(u32 sec_id, u32 ctx_num, u32 pt_fmt); +int qcom_scm_qsmmu500_wait_safe_toggle(bool en); + +int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, + u64 limit_node, u32 node_id, u64 version); +int qcom_scm_lmh_profile_change(u32 profile_id); +bool qcom_scm_lmh_dcvsh_available(void); #endif From patchwork Mon Aug 28 19:24:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 719161 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F499C83F1F for ; Mon, 28 Aug 2023 19:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233254AbjH1T2A (ORCPT ); Mon, 28 Aug 2023 15:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233217AbjH1T13 (ORCPT ); Mon, 28 Aug 2023 15:27:29 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25098CCC for ; Mon, 28 Aug 2023 12:27:06 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31dd10c2b8bso476148f8f.3 for ; Mon, 28 Aug 2023 12:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250824; x=1693855624; 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=ZNNFEJol507fnnll/GiCNMd/EJ+bjC8uSrL8Nl+Ny9g=; b=j7RA/+VrPOlZBQ5ZrjTCRD88rvjaQzRCprr3Fjo2CBkgJh8MqVG4MImUUWi2SxaHxj vKqPWnPvy1l29LUin6CtTOosVFYO1ChAQcdMnhJMFlUU9sIjzsy6KGcuxrnkMkQGrENq aBsoy+/EDStX/CnqvBQ+lZyrkExXfg46rvK1y8eqeXbs1v2c1bHeaJKgG1tgirOJeAdc aynPcSXjqdoi1+x+/Ir489fr5QoC5W776XPcdBTDMlRxrPZG2HbvtzD5D9Pl+g1LrOz7 1NyD0axOq9zYjRBiPjgAuMAsv2JtfqVxZ5xCRzGAryJj7qlAxIVARgyPCmrgWdvUVoAP U76w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250824; x=1693855624; 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=ZNNFEJol507fnnll/GiCNMd/EJ+bjC8uSrL8Nl+Ny9g=; b=iwQlwJx9TNgSIsbtL0H88lpmCX1NfmHfWSd57geLsJJkEQAPGP9SXqzPsHzu3HqK+C mrBmHof2aJ6rBlo+ORL9MT7rr5uTcLdsagUQcpW263riNuB2/v1P4JQwubeh50MqI9ha qL1h7DwyB5UwQnWEbMXuEvqFgklfuvnSQ82bqEV5hXuET1tHelfBXFJD8DqBmb49dkIO IS8MlNNx4crLs5VmRcsy2JE0wB2yYOLDRqtr32MZk3PPFSH/vbCYrrwloDf7UIb/re1i oVzpDAAZkDJi487OhWRfBpHmu7iYaFsh++3/owOiYxl/FSUo7/RYR5VtSOtMtnWt/6ne JHqQ== X-Gm-Message-State: AOJu0YyxRo0LsXP2KmHRNkrTNQ8ZCR837sKmps1ltt38288HfU/rCwL3 DZoyAWzrjcKwBcFmeBRTii7pOQ== X-Google-Smtp-Source: AGHT+IFuspge895OlO/pS7GkSpr8Z2Vw74TPV8e/HYmtxE5aA4G5rRHHYITyGt3xIizf7aHsvM3LoQ== X-Received: by 2002:adf:f011:0:b0:317:6965:ef4d with SMTP id j17-20020adff011000000b003176965ef4dmr20205597wro.56.1693250824733; Mon, 28 Aug 2023 12:27:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:04 -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 02/11] firmware: qcom-scm: order includes alphabetically Date: Mon, 28 Aug 2023 21:24:58 +0200 Message-Id: <20230828192507.117334-3-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For easier maintenance order the included headers in qcom_scm.c alphabetically. Signed-off-by: Bartosz Golaszewski --- drivers/firmware/qcom_scm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index fde33acd46b7..980fcfa20b9f 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -2,24 +2,25 @@ /* Copyright (c) 2010,2015,2019 The Linux Foundation. All rights reserved. * Copyright (C) 2015 Linaro Ltd. */ -#include -#include -#include + +#include +#include #include #include -#include #include +#include +#include +#include #include +#include #include -#include -#include #include #include #include #include -#include +#include #include -#include +#include #include "qcom_scm.h" From patchwork Mon Aug 28 19:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 719159 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B545FC83F12 for ; Mon, 28 Aug 2023 19:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233371AbjH1T2D (ORCPT ); Mon, 28 Aug 2023 15:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233249AbjH1T1a (ORCPT ); Mon, 28 Aug 2023 15:27:30 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58D25CCE for ; Mon, 28 Aug 2023 12:27:07 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-313e742a787so2241179f8f.1 for ; Mon, 28 Aug 2023 12:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250826; x=1693855626; 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=713tM2MtTN06BKtmpTKPtHYKAypTeU06f4AnOlNhYD4=; b=CSqa+pEoDUW2H0ZlraiWwUc3xrWOrJ1YaHmkjhFa1p/azSB734HWr7cU7e+myIPnxY qDsDy9RJtc6PWOZi806K/E6XsRbqhVy78B/oFwKTyW+g05lo+dhP4G62hGqrlQ641ZRU P8VP6sbAPFh7XXebDCKtOJ70udNb6SwiNfDapAw4WM4QHiBs1L6MYTO4T/+WXxLsQzk0 zIDoQGuZovksV9kVbawJ4xMgU2RlWI4uFaqB0yceUpKqZgcbSbYm5R1v8e88gGNG0KjH a5g9KaWoA3XNQ1D9zdItbOL4waj9PwpuPKgLNZQMhF8maGHr7j0ai4dCzdIUHby5GJf2 Rccg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250826; x=1693855626; 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=713tM2MtTN06BKtmpTKPtHYKAypTeU06f4AnOlNhYD4=; b=kDPkXjogBlO2KMTSlbTNYHHPZCVS0DhrOAq7hzo4jkzu0tOBKqh/t1J4rsaqS3KzMo cRcLMMa7EQo9oXUR6TCjTD+WqXWyMT1tSUyA1wNPmNlY0V/qQWZ2BZLW3RG3OE9cOSy4 r8fdYZtSuZ9lIYmne3h0PmgWpuzVghzFBkvTbum5q8MWdKt+y0tdwj1tmKjFcnZ62mOE /mvB029z21FxXRMWI8yf4FU2i0Niv+HLkIVcvkDYJsDl8h37fOT8RklBMg/jYhdg+3Q6 uUE7W4vZzLJd7Ps/IC/j1vfojwuyVBifgXYLe4dXNxy08rXN4+ttiqpBRI0lHyfylIVm WRrA== X-Gm-Message-State: AOJu0YxAytnikzkqzslWcu4Y+K4DPoCeU4B85UcR9/i35AvLF0dHSCRf QeJPVGSEJaDk8R1kwpwQ9uWPsg== X-Google-Smtp-Source: AGHT+IFP03AKHAfr/hAQD0gGF3wtYUFTciEZ8PKvTMJRFIBUMmxXBs7iwRUVJNseZQVqoKpOwBLzaw== X-Received: by 2002:adf:e682:0:b0:319:8c99:989a with SMTP id r2-20020adfe682000000b003198c99989amr369735wrm.8.1693250825898; Mon, 28 Aug 2023 12:27:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:05 -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 03/11] firmware: qcom-scm: atomically assign and read the global __scm pointer Date: Mon, 28 Aug 2023 21:24:59 +0200 Message-Id: <20230828192507.117334-4-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Checking for the availability of SCM bridge can happen from any context. It's only by chance that we haven't run into concurrency issues but with the upcoming SHM Bridge driver that will be initiated at the same initcall level, we need to assure the assignment and readback of the __scm pointer is atomic. Signed-off-by: Bartosz Golaszewski --- drivers/firmware/qcom_scm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 980fcfa20b9f..422de70faff8 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -1331,7 +1331,7 @@ static int qcom_scm_find_dload_address(struct device *dev, u64 *addr) */ bool qcom_scm_is_available(void) { - return !!__scm; + return !!READ_ONCE(__scm); } EXPORT_SYMBOL(qcom_scm_is_available); @@ -1477,8 +1477,8 @@ static int qcom_scm_probe(struct platform_device *pdev) if (ret) return ret; - __scm = scm; - __scm->dev = &pdev->dev; + scm->dev = &pdev->dev; + WRITE_ONCE(__scm, scm); init_completion(&__scm->waitq_comp); From patchwork Mon Aug 28 19:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 719158 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66C62C83F2A for ; Mon, 28 Aug 2023 19:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbjH1T2B (ORCPT ); Mon, 28 Aug 2023 15:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233302AbjH1T1b (ORCPT ); Mon, 28 Aug 2023 15:27:31 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA334CC9 for ; Mon, 28 Aug 2023 12:27:08 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-31adc5c899fso3201555f8f.2 for ; Mon, 28 Aug 2023 12:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250827; x=1693855627; 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=q9IIbmqeXUEZrQQd9nJYDsQR20cl+CEuhTdfBNfLqNk=; b=U2c+D7W/DluCXF1TF7FZqcriMIZUK3c7RhavvfomxvpcFpDf8yDsO+W/TNBct8qfUV gAJqZGyE7rdbDYxbl+y3xmAYAP1l257zDnWa04rZZMlTwQzTGJeeHwfTeAXpSFVA+AoO +7vOphBP2vq2jqyVzTaaKWpF7XaUvqQ1RG5GY3jK5npXW2NnI31oKQ6YbZoo2gpbUgE0 d+GkWEDpPGi15djFRVH1GJCygrAE9ylq89zKIvKuq3sEDbMUIHE7SvcIS94/xP15JIzb PTB1TS6WF8wDllBXS0UfrL0VF7d1YHoMz6RGHU+H7XThrSmFLeITvkAen7ZEQ2ERJtFI YmNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250827; x=1693855627; 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=q9IIbmqeXUEZrQQd9nJYDsQR20cl+CEuhTdfBNfLqNk=; b=idOk8bbALz9eH89fLZQ1sXtLvurayQgWWCFsYm5+zNl+5X0s7Cy0H85rz7eBlVPhZK KNpCYUlML2NAz7C7B1uO0jFOpaDyr+4VusqwAMcvr94LglztDIi4HbFKP1CTFXY7sPZ/ qhZX6j1Kl808xv7BAa6fM1/LXtrJ70z+/0T/TzSHZDog37b59gpp+m/JwG94Fcw09acu BgSQ+3RyMdeKx1M8Lv/DVVPxhWgE9dJgs5FRhi88oJNIEhZSrcEsuexSId6z/xsYCXTM CzWwi3BCZQ9gKe3BaL6SG3OtV07dCnPdaNdCosI3EFOF0DkITxtYMAWXlbn7J2fk9KrN iCGw== X-Gm-Message-State: AOJu0Yxkzho3OM00QJRsLBl2CMqUKLNBFZKN5ILSXS0hccVyFbElMMK7 MBvZeoOA/Ev6apNSl55muCQcRA== X-Google-Smtp-Source: AGHT+IGELnRw3OVm+F5lO+SlIxnQc7iifWQmxaW6b93Q/z2oVixC1dvmEOehQrkSCMkjDmlRE7oFiA== X-Received: by 2002:adf:ea10:0:b0:31a:ed75:75e9 with SMTP id q16-20020adfea10000000b0031aed7575e9mr20375035wrm.13.1693250827195; Mon, 28 Aug 2023 12:27:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:06 -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 04/11] firmware: qcom-scm: add support for SHM bridge operations Date: Mon, 28 Aug 2023 21:25:00 +0200 Message-Id: <20230828192507.117334-5-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add low-level primitives for enabling SHM bridge support, creating SHM bridge pools and testing the availability of SHM bridges to qcom-scm. We don't yet provide a way to destroy the bridges as the first user will not require it. Signed-off-by: Bartosz Golaszewski --- drivers/firmware/qcom_scm.c | 83 ++++++++++++++++++++++++++ drivers/firmware/qcom_scm.h | 3 + include/linux/firmware/qcom/qcom_scm.h | 8 +++ 3 files changed, 94 insertions(+) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 422de70faff8..f45d5a424424 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -31,6 +31,8 @@ module_param(download_mode, bool, 0); #define SCM_HAS_IFACE_CLK BIT(1) #define SCM_HAS_BUS_CLK BIT(2) +#define SCM_SHM_BRIDGE_NOTSUPP 4 + struct qcom_scm { struct device *dev; struct clk *core_clk; @@ -45,6 +47,8 @@ struct qcom_scm { int scm_vote_count; u64 dload_mode_addr; + + bool shm_bridge_enabled; }; struct qcom_scm_current_perm_info { @@ -1248,6 +1252,85 @@ bool qcom_scm_lmh_dcvsh_available(void) } EXPORT_SYMBOL(qcom_scm_lmh_dcvsh_available); +bool qcom_scm_shm_bridge_available(void) +{ + if (!qcom_scm_is_available()) + return false; + + return READ_ONCE(__scm->shm_bridge_enabled); +} +EXPORT_SYMBOL_GPL(qcom_scm_shm_bridge_available); + +/* + * Must not be called unless qcom_scm_shm_bridge_available() returned true + * first. + */ +int qcom_scm_enable_shm_bridge(void) +{ + struct qcom_scm_desc desc = { + .svc = QCOM_SCM_SVC_MP, + .cmd = QCOM_SCM_MP_SHM_BRIDGE_ENABLE, + .owner = ARM_SMCCC_OWNER_SIP + }; + + struct qcom_scm_res res; + int ret; + + ret = qcom_scm_call(__scm->dev, &desc, &res); + if (!ret && !res.result[0]) + WRITE_ONCE(__scm->shm_bridge_enabled, true); + + if (res.result[0] == SCM_SHM_BRIDGE_NOTSUPP) + ret = -EOPNOTSUPP; + + return ret ?: res.result[0]; +} +EXPORT_SYMBOL_GPL(qcom_scm_enable_shm_bridge); + +int qcom_scm_create_shm_bridge(struct device *dev, u64 pfn_and_ns_perm_flags, + u64 ipfn_and_s_perm_flags, u64 size_and_flags, + u64 ns_vmids, u64 *handle) +{ + struct qcom_scm_desc desc = { + .svc = QCOM_SCM_SVC_MP, + .cmd = QCOM_SCM_MP_SHM_BRDIGE_CREATE, + .owner = ARM_SMCCC_OWNER_SIP + }; + + struct qcom_scm_res res; + int ret; + + desc.args[0] = pfn_and_ns_perm_flags; + desc.args[1] = ipfn_and_s_perm_flags; + desc.args[2] = size_and_flags; + desc.args[3] = ns_vmids; + + desc.arginfo = QCOM_SCM_ARGS(4, QCOM_SCM_VAL, QCOM_SCM_VAL, + QCOM_SCM_VAL, QCOM_SCM_VAL); + + ret = qcom_scm_call(dev ?: __scm->dev, &desc, &res); + + if (handle && !ret) + *handle = res.result[1]; + + return ret ?: res.result[0]; +} +EXPORT_SYMBOL_GPL(qcom_scm_create_shm_bridge); + +int qcom_scm_delete_shm_bridge(struct device *dev, u64 handle) +{ + struct qcom_scm_desc desc = { + .svc = QCOM_SCM_SVC_MP, + .cmd = QCOM_SCM_MP_SHM_BRIDGE_DELETE, + .owner = ARM_SMCCC_OWNER_SIP, + .args[0] = handle, + .arginfo = QCOM_SCM_ARGS(1, QCOM_SCM_VAL), + }; + + return qcom_scm_call(dev ?: __scm->dev, &desc, NULL); +} +EXPORT_SYMBOL_GPL(qcom_scm_delete_shm_bridge); + int qcom_scm_lmh_profile_change(u32 profile_id) { struct qcom_scm_desc desc = { diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index e6e512bd57d1..44d60d06344b 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -111,6 +111,9 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc, #define QCOM_SCM_MP_IOMMU_SET_CP_POOL_SIZE 0x05 #define QCOM_SCM_MP_VIDEO_VAR 0x08 #define QCOM_SCM_MP_ASSIGN 0x16 +#define QCOM_SCM_MP_SHM_BRIDGE_ENABLE 0x1c +#define QCOM_SCM_MP_SHM_BRIDGE_DELETE 0x1d +#define QCOM_SCM_MP_SHM_BRDIGE_CREATE 0x1e #define QCOM_SCM_SVC_OCMEM 0x0f #define QCOM_SCM_OCMEM_LOCK_CMD 0x01 diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmware/qcom/qcom_scm.h index 0187fc54249e..100770380d97 100644 --- a/include/linux/firmware/qcom/qcom_scm.h +++ b/include/linux/firmware/qcom/qcom_scm.h @@ -5,6 +5,7 @@ #ifndef __QCOM_SCM_H #define __QCOM_SCM_H +#include #include #include #include @@ -117,4 +118,11 @@ int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, int qcom_scm_lmh_profile_change(u32 profile_id); bool qcom_scm_lmh_dcvsh_available(void); +bool qcom_scm_shm_bridge_available(void); +int qcom_scm_enable_shm_bridge(void); +int qcom_scm_create_shm_bridge(struct device *dev, u64 pfn_and_ns_perm_flags, + u64 ipfn_and_s_perm_flags, u64 size_and_flags, + u64 ns_vmids, u64 *handle); +int qcom_scm_delete_shm_bridge(struct device *dev, u64 handle); + #endif From patchwork Mon Aug 28 19:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 717776 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1683C83F12 for ; Mon, 28 Aug 2023 19:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231587AbjH1T15 (ORCPT ); Mon, 28 Aug 2023 15:27:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233331AbjH1T1b (ORCPT ); Mon, 28 Aug 2023 15:27:31 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB6C1CDB for ; Mon, 28 Aug 2023 12:27:09 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31dcf18f9e2so758274f8f.0 for ; Mon, 28 Aug 2023 12:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250828; x=1693855628; 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=3ZrHrixjJTfHp+8KzhmU3pank8Phapb7i2mtd1W6FyY=; b=puIo2IYmdzRkxcG9l3U/HA/Sg/bMR7ddZh06USIZ8WWAxcqxmQ3oXvKlCP1rIvo/1f EJ+FfF2G9TuE01YI3u4K0goBfEGO4WTdfb+2f21LZakHyuWjX/6VqShPJ8dv5TbKaW6h +eon8GiAyTPeBWj61BPnSyg3okN1d+yOceB2dcNbiTDfwyzU5svZPhMqP2g6DGMkykhY Dr8qevmDAmw7xuM3bXc0Rrg40p7Kk8oU8BmjAaapE/Qe3HvwBgAlz7bLVEzNK7KzpQyF q3220k3N5ul3HDieX1NCJ2xahnND6ArBMyPGv7F1w0OcHiBRbW9EuewTofxa4kgryipL tztw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250828; x=1693855628; 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=3ZrHrixjJTfHp+8KzhmU3pank8Phapb7i2mtd1W6FyY=; b=EYfKbjCgK/42P5d37JA+Zkq1PSWJX55V09PLhZ8W73L21uA0kqsbAPnwjPYEiKgjHt Rd/8BdFIwWrA4mig7FxbLTyDzNRil3lMs0xTaJArbbO2EFrT3rkzHc5kfxRgRMNgNG4D jgCLul5MXdVX2YLurttm6hR/tozuDvSAaVskjwSUwdTLDprAdnvwojbY877aMxVt2rD4 2+LoMD5GnSJK5KkU0M2GzA9xwyr5Eww3HKALXkdbnxozLfmaLs5WIKM7AFjZRklMcXZF AeulLbxkAckxIHhjKChR+LUoyRwhzPDq4lof3h1edOeow+owcz1+Gn7/KYqVIlT4Rhlz fP2Q== X-Gm-Message-State: AOJu0YweK/ZGeXFlPH3ciMz0DSln8c00OVhFKoG1cwoscwjXdxQr76jt HuJZkYZMsORHZumpTmQF+sdAHA== X-Google-Smtp-Source: AGHT+IEEGru84SUHFfCkbyGAXl1BVPJ1qKlE94RFGVLiLHe9WynVK7WBIN5FA+kPUAZAITnY+rRsNQ== X-Received: by 2002:adf:ec11:0:b0:313:f4e2:901d with SMTP id x17-20020adfec11000000b00313f4e2901dmr20276102wrn.22.1693250828356; Mon, 28 Aug 2023 12:27:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:07 -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 05/11] dt-bindings: document the Qualcomm TEE Shared Memory Bridge Date: Mon, 28 Aug 2023 21:25:01 +0200 Message-Id: <20230828192507.117334-6-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add Device Tree bindings for Qualcomm TEE Shared Memory Brige - a mechanism that allows sharing memory buffers between trustzone and the kernel. Signed-off-by: Bartosz Golaszewski --- .../bindings/firmware/qcom,shm-bridge.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/firmware/qcom,shm-bridge.yaml diff --git a/Documentation/devicetree/bindings/firmware/qcom,shm-bridge.yaml b/Documentation/devicetree/bindings/firmware/qcom,shm-bridge.yaml new file mode 100644 index 000000000000..f660962b7b86 --- /dev/null +++ b/Documentation/devicetree/bindings/firmware/qcom,shm-bridge.yaml @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/firmware/qcom,shm-bridge.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: QCOM Shared Memory Bridge + +description: | + Qualcomm TEE Shared Memory Bridge allows sharing limited areas of kernel's + virtual memory with the trustzone in order to avoid mapping the entire RAM. + +maintainers: + - Bjorn Andersson + - Konrad Dybcio + - Bartosz Golaszewski + +properties: + compatible: + items: + - enum: + - qcom,shm-bridge-sa8775p + - qcom,shm-bridge-sm8150 + - qcom,shm-bridge-sm8450 + - const: qcom,shm-bridge + +required: + - compatible + +additionalProperties: false + +examples: + - | + firmware { + compatible = "qcom,shm-bridge-sa8775p", "qcom,shm-bridge"; + }; From patchwork Mon Aug 28 19:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 717771 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E698FC83F22 for ; Mon, 28 Aug 2023 19:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233217AbjH1T2A (ORCPT ); Mon, 28 Aug 2023 15:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233379AbjH1T1d (ORCPT ); Mon, 28 Aug 2023 15:27:33 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E8112E for ; Mon, 28 Aug 2023 12:27:11 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fee87dd251so33584405e9.2 for ; Mon, 28 Aug 2023 12:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250829; x=1693855629; 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=K1CxvFy6DjQ2QqPARFppzzJEHGmRIN9sA1kFw52YtqA=; b=dSl0E+ca6ei+p+BhvXukag03UwmW73FD3fXR3l4q6mrKsLoSjQr/AjmGqhJwOOrnwz 6DneWKK5bwzG7lNo/lmmsPSph84oRJbOPCDWwNaQUKeBgeedw7CedxQwNxOaCB9Saoiq rSlCo0LMzDY/dOTbGmZrZo5tQjWO2dPKBg3GrQfJpibul1NqLTVHrzjz+opNfYpODqHf cpaDtSkACON9MIFiWANyztDVK/Ztz30A5EP0R2s+Q1I6FVq0XLhMjF/8du7AbxBHVKJh OyR5tLgwGWpBO8lqhMAqZPcPP+B9Ix+67Sm51SjGTMVb9HfXWHyz7BSDK3vg8YhgQ+fQ A0Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250829; x=1693855629; 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=K1CxvFy6DjQ2QqPARFppzzJEHGmRIN9sA1kFw52YtqA=; b=AMl/7W+B3t2H2a3UyVMYfkdB/5Id4EGfW/lRI8jc4T5FsXfolZtbVw2uxOitTJz0pc 5Ox93EF/KyVO/jmc7HcZ8FWjRuVDR1Qhw8ftmnBAeAIfqD1+fvuqqOa2yg8pyMB+Lhnh arbjBVNGZ0D7UtNMtqHhuQv5RvXfg1aG71RKZES43WFnTQ2EujlHhBSsydl/EJ5lZ099 C312dcMn2St0G7oQy4+Hw9TZFzAerGD5GsTyKOanOsgFf0hhA+o487d50vu6Uy1VdxoG ZL/6EAU/RM9TBTYc4IeNYmDxLJKv7tLg2Do3muOmmtAXVbANTkVgSWbjUMtExCXr+zZ6 VY/g== X-Gm-Message-State: AOJu0YwkZETFye/UFImSDBGxjhrtnN9iLp5B3THrbJknwyROhGqugRd8 XGCXNnlb13IwNiK4AyKjKspdeQ== X-Google-Smtp-Source: AGHT+IG16plrLwVWNVWNBmzzaYPUetvSFyD0SYBWHQ0Uei/kQgG98t5cUvWtgeVCvbBRPGeUe+jycw== X-Received: by 2002:a5d:62cd:0:b0:319:785a:fce0 with SMTP id o13-20020a5d62cd000000b00319785afce0mr20142048wrv.26.1693250829565; Mon, 28 Aug 2023 12:27:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:09 -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 06/11] firmware: qcom-shm-bridge: new driver Date: Mon, 28 Aug 2023 21:25:02 +0200 Message-Id: <20230828192507.117334-7-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This module is a platform driver that also exposes an interface for kernel users to allocate blocks of memory shared with the trustzone. Signed-off-by: Bartosz Golaszewski --- drivers/firmware/Kconfig | 8 + drivers/firmware/Makefile | 1 + drivers/firmware/qcom-shm-bridge.c | 452 +++++++++++++++++++++++ include/linux/firmware/qcom/shm-bridge.h | 32 ++ 4 files changed, 493 insertions(+) create mode 100644 drivers/firmware/qcom-shm-bridge.c create mode 100644 include/linux/firmware/qcom/shm-bridge.h diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index b59e3041fd62..39f35ba18779 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -226,6 +226,14 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT Say Y here to enable "download mode" by default. +config QCOM_SHM_BRIDGE + bool "Qualcomm SHM bridge driver" + depends on QCOM_SCM + help + Say yes here to enable support for Qualcomm TEE Shared Memory Bridge. + This module exposes interfaces that allow kernel users to allocate + blocks of memory shared with the trustzone. + config SYSFB bool select BOOT_VESA_SUPPORT diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 28fcddcd688f..ba1590cf959c 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o obj-$(CONFIG_QCOM_SCM) += qcom-scm.o qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o +obj-$(CONFIG_QCOM_SHM_BRIDGE) += qcom-shm-bridge.o obj-$(CONFIG_SYSFB) += sysfb.o obj-$(CONFIG_SYSFB_SIMPLEFB) += sysfb_simplefb.o obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o diff --git a/drivers/firmware/qcom-shm-bridge.c b/drivers/firmware/qcom-shm-bridge.c new file mode 100644 index 000000000000..db76c5c5061d --- /dev/null +++ b/drivers/firmware/qcom-shm-bridge.c @@ -0,0 +1,452 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2023 Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define QCOM_SHM_BRIDGE_NUM_VM_SHIFT 9 + +DEFINE_FREE(qcom_shm_bridge_pool, struct qcom_shm_bridge_pool *, + if (_T) qcom_shm_bridge_pool_unref(_T)) + +/* + * Size of the global fall-back pool can be adjusted using this param. Use 4M + * as a sane default. + */ +static unsigned int qcom_shm_bridge_default_pool_size = SZ_4M; +module_param_named(default_pool_size, qcom_shm_bridge_default_pool_size, + uint, 0644); + +struct qcom_shm_bridge_pool { + struct device *dev; + void *vaddr; + phys_addr_t paddr; + size_t size; + uint64_t handle; + struct gen_pool *genpool; + struct list_head chunks; + spinlock_t lock; + struct kref refcount; +}; + +struct qcom_shm_bridge_chunk { + void *vaddr; + size_t size; + struct qcom_shm_bridge_pool *parent; + struct list_head siblings; +}; + +/* This is the global fall-back pool, used if user doesn't supply their own. */ +static struct qcom_shm_bridge_pool *qcom_shm_bridge_default_pool; + +static RADIX_TREE(qcom_shm_bridge_chunks, GFP_ATOMIC); +static DEFINE_SPINLOCK(qcom_shm_bridge_chunks_lock); + +static void qcom_shm_bridge_pool_release(struct kref *kref) +{ + struct qcom_shm_bridge_pool *pool = + container_of(kref, struct qcom_shm_bridge_pool, refcount); + + if (pool->handle) + qcom_scm_delete_shm_bridge(pool->dev, pool->handle); + + if (pool->genpool) + gen_pool_destroy(pool->genpool); + + if (pool->paddr) + dma_unmap_single(pool->dev, pool->paddr, pool->size, + DMA_TO_DEVICE); + + if (pool->vaddr) + free_pages((unsigned long)pool->vaddr, get_order(pool->size)); + + put_device(pool->dev); + kfree(pool); +} + +static int qcom_shm_bridge_create(struct qcom_shm_bridge_pool *pool) +{ + uint64_t pfn_and_ns_perm, ipfn_and_s_perm, size_and_flags, ns_vmids, + ns_perms, handle; + int ret; + + ns_perms = (QCOM_SCM_PERM_WRITE | QCOM_SCM_PERM_READ); + ns_vmids = QCOM_SCM_VMID_HLOS; + pfn_and_ns_perm = (u64)pool->paddr | ns_perms; + ipfn_and_s_perm = (u64)pool->paddr | ns_perms; + size_and_flags = pool->size | (1 << QCOM_SHM_BRIDGE_NUM_VM_SHIFT); + + ret = qcom_scm_create_shm_bridge(pool->dev, pfn_and_ns_perm, + ipfn_and_s_perm, size_and_flags, + ns_vmids, &handle); + if (!ret) + pool->handle = handle; + + return ret; +} + +static struct qcom_shm_bridge_pool * +qcom_shm_bridge_pool_new_for_dev(struct device *dev, size_t size) +{ + struct qcom_shm_bridge_pool *pool __free(qcom_shm_bridge_pool) = NULL; + int ret; + + if (!qcom_scm_shm_bridge_available()) + return ERR_PTR(-ENODEV); + + if (!size) + return ERR_PTR(-EINVAL); + + pool = kzalloc(sizeof(*pool), GFP_KERNEL); + if (!pool) + return ERR_PTR(-ENOMEM); + + pool->dev = get_device(dev); + pool->size = size; + INIT_LIST_HEAD(&pool->chunks); + spin_lock_init(&pool->lock); + kref_init(&pool->refcount); + + pool->vaddr = (void *)__get_free_pages(GFP_KERNEL | GFP_DMA, + get_order(pool->size)); + if (!pool->vaddr) + return ERR_PTR(-ENOMEM); + + pool->paddr = dma_map_single(pool->dev, pool->vaddr, pool->size, + DMA_TO_DEVICE); + if (dma_mapping_error(dev, pool->paddr)) + return ERR_PTR(-ENOMEM); + + pool->genpool = gen_pool_create(PAGE_SHIFT, -1); + if (!pool->genpool) + return ERR_PTR(-ENOMEM); + + gen_pool_set_algo(pool->genpool, gen_pool_best_fit, NULL); + + ret = gen_pool_add_virt(pool->genpool, (unsigned long)pool->vaddr, + pool->paddr, pool->size, -1); + if (ret) + return ERR_PTR(ret); + + ret = qcom_shm_bridge_create(pool); + if (ret) + return ERR_PTR(ret); + + return no_free_ptr(pool); +} + +/** + * qcom_shm_bridge_pool_new - Create a new SHM Bridge memory pool. + * + * @size: Size of the pool. + * + * Creates a new Shared Memory Bridge pool from which users can allocate memory + * chunks. Must be called from process context. + * + * Return: + * Pointer to the newly created SHM Bridge pool with reference count set to 1 + * or ERR_PTR(). + */ +struct qcom_shm_bridge_pool *qcom_shm_bridge_pool_new(size_t size) +{ + struct device *dev; + + dev = bus_find_device_by_name(&platform_bus_type, NULL, + "qcom-shm-bridge"); + if (!dev) + return ERR_PTR(-ENODEV); + + return qcom_shm_bridge_pool_new_for_dev(dev, size); +} +EXPORT_SYMBOL_GPL(qcom_shm_bridge_pool_new); + +/** + * qcom_shm_bridge_pool_ref - Increate the refcount of an SHM Bridge pool. + * + * @pool: SHM Bridge pool of which the reference count to increase. + * + * Return: + * Pointer to the same pool object. + */ +struct qcom_shm_bridge_pool * +qcom_shm_bridge_pool_ref(struct qcom_shm_bridge_pool *pool) +{ + kref_get(&pool->refcount); + + return pool; +} +EXPORT_SYMBOL_GPL(qcom_shm_bridge_pool_ref); + +/** + * qcom_shm_bridge_pool_unref - Decrease the refcount of an SHM Bridge pool. + * + * @pool: SHM Bridge pool of which the reference count to decrease. + * + * Once the reference count reaches 0, the pool is released. + */ +void qcom_shm_bridge_pool_unref(struct qcom_shm_bridge_pool *pool) +{ + kref_put(&pool->refcount, qcom_shm_bridge_pool_release); +} +EXPORT_SYMBOL_GPL(qcom_shm_bridge_pool_unref); + +static void devm_qcom_shm_bridge_pool_unref(void *data) +{ + struct qcom_shm_bridge_pool *pool = data; + + qcom_shm_bridge_pool_unref(pool); +} + +/** + * devm_qcom_shm_bridge_pool_new - Managed variant of qcom_shm_bridge_pool_new. + * + * @dev: Device for which to map memory and which will manage this pool. + * @size: Size of the pool. + * + * Return: + * Pointer to the newly created SHM Bridge pool with reference count set to 1 + * or ERR_PTR(). + */ +struct qcom_shm_bridge_pool * +devm_qcom_shm_bridge_pool_new(struct device *dev, size_t size) +{ + struct qcom_shm_bridge_pool *pool; + int ret; + + pool = qcom_shm_bridge_pool_new(size); + if (IS_ERR(pool)) + return pool; + + ret = devm_add_action_or_reset(dev, devm_qcom_shm_bridge_pool_unref, + pool); + if (ret) + return ERR_PTR(ret); + + return pool; +} +EXPORT_SYMBOL_GPL(devm_qcom_shm_bridge_pool_new); + +/** + * qcom_shm_bridge_alloc - Allocate a chunk of memory from an SHM Bridge pool. + * + * @pool: Pool to allocate memory from. May be NULL. + * @size: Number of bytes to allocate. + * @gfp: Allocation flags. + * + * If pool is NULL then the global fall-back pool is used. + * + * Return: + * Virtual address of the allocated memory or ERR_PTR(). Must be freed using + * qcom_shm_bridge_free(). + */ +void *qcom_shm_bridge_alloc(struct qcom_shm_bridge_pool *pool, + size_t size, gfp_t gfp) +{ + struct qcom_shm_bridge_chunk *chunk __free(kfree) = NULL; + unsigned long vaddr; + int ret; + + if (!pool) { + pool = READ_ONCE(qcom_shm_bridge_default_pool); + if (!pool) + return ERR_PTR(-ENODEV); + } + + if (!size || size > pool->size) + return ERR_PTR(-EINVAL); + + size = roundup(size, 1 << PAGE_SHIFT); + + chunk = kzalloc(sizeof(*chunk), gfp); + if (!chunk) + return ERR_PTR(-ENOMEM); + + guard(spinlock_irqsave)(&pool->lock); + + vaddr = gen_pool_alloc(pool->genpool, size); + if (!vaddr) + return ERR_PTR(-ENOMEM); + + chunk->vaddr = (void *)vaddr; + chunk->size = size; + chunk->parent = pool; + list_add_tail(&chunk->siblings, &pool->chunks); + qcom_shm_bridge_pool_ref(pool); + + guard(spinlock_irqsave)(&qcom_shm_bridge_chunks_lock); + + ret = radix_tree_insert(&qcom_shm_bridge_chunks, vaddr, chunk); + if (ret) { + gen_pool_free(pool->genpool, vaddr, chunk->size); + return ERR_PTR(ret); + } + + return no_free_ptr(chunk)->vaddr; +} +EXPORT_SYMBOL_GPL(qcom_shm_bridge_alloc); + +/** + * qcom_shm_bridge_free - Free SHM Bridge memory allocated from the pool. + * + * @vaddr: Virtual address of the allocated memory to free. + */ +void qcom_shm_bridge_free(void *vaddr) +{ + struct qcom_shm_bridge_chunk *chunk; + struct qcom_shm_bridge_pool *pool; + + scoped_guard(spinlock_irqsave, &qcom_shm_bridge_chunks_lock) + chunk = radix_tree_delete_item(&qcom_shm_bridge_chunks, + (unsigned long)vaddr, NULL); + if (!chunk) + goto out_warn; + + pool = chunk->parent; + + guard(spinlock_irqsave)(&pool->lock); + + list_for_each_entry(chunk, &pool->chunks, siblings) { + if (vaddr != chunk->vaddr) + continue; + + gen_pool_free(pool->genpool, (unsigned long)chunk->vaddr, + chunk->size); + list_del(&chunk->siblings); + qcom_shm_bridge_pool_unref(pool); + kfree(chunk); + return; + } + +out_warn: + WARN(1, "Virtual address %p not allocated for SHM bridge", vaddr); +} +EXPORT_SYMBOL_GPL(qcom_shm_bridge_free); + +/** + * devm_qcom_shm_bridge_alloc - Managed variant of qcom_shm_bridge_alloc. + * + * @dev: Managing device. + * @pool: Pool to allocate memory from. + * @size: Number of bytes to allocate. + * @gfp: Allocation flags. + * + * Return: + * Virtual address of the allocated memory or ERR_PTR(). + */ +void *devm_qcom_shm_bridge_alloc(struct device *dev, + struct qcom_shm_bridge_pool *pool, + size_t size, gfp_t gfp) +{ + void *vaddr; + int ret; + + vaddr = qcom_shm_bridge_alloc(pool, size, gfp); + if (IS_ERR(vaddr)) + return vaddr; + + ret = devm_add_action_or_reset(dev, qcom_shm_bridge_free, vaddr); + if (ret) + return ERR_PTR(ret); + + return vaddr; +} +EXPORT_SYMBOL_GPL(devm_qcom_shm_bridge_alloc); + +/** + * qcom_shm_bridge_to_phys_addr - Translate address from virtual to physical. + * + * @vaddr: Virtual address to translate. + * + * Return: + * Physical address corresponding to 'vaddr'. + */ +phys_addr_t qcom_shm_bridge_to_phys_addr(void *vaddr) +{ + struct qcom_shm_bridge_chunk *chunk; + struct qcom_shm_bridge_pool *pool; + + guard(spinlock_irqsave)(&qcom_shm_bridge_chunks_lock); + + chunk = radix_tree_lookup(&qcom_shm_bridge_chunks, + (unsigned long)vaddr); + if (!chunk) + return 0; + + pool = chunk->parent; + + guard(spinlock_irqsave)(&pool->lock); + + return gen_pool_virt_to_phys(pool->genpool, (unsigned long)vaddr); +} +EXPORT_SYMBOL_GPL(qcom_shm_bridge_to_phys_addr); + +static int qcom_shm_bridge_probe(struct platform_device *pdev) +{ + struct qcom_shm_bridge_pool *default_pool; + struct device *dev = &pdev->dev; + int ret; + + /* + * We need to wait for the SCM device to be created and bound to the + * SCM driver. + */ + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + + ret = qcom_scm_enable_shm_bridge(); + if (ret) + return dev_err_probe(dev, ret, + "Failed to enable the SHM bridge\n"); + + default_pool = qcom_shm_bridge_pool_new_for_dev( + dev, qcom_shm_bridge_default_pool_size); + if (IS_ERR(default_pool)) + return dev_err_probe(dev, PTR_ERR(default_pool), + "Failed to create the default SHM Bridge pool\n"); + + WRITE_ONCE(qcom_shm_bridge_default_pool, default_pool); + + return 0; +} + +static const struct of_device_id qcom_shm_bridge_of_match[] = { + { .compatible = "qcom,shm-bridge", }, + { } +}; + +static struct platform_driver qcom_shm_bridge_driver = { + .driver = { + .name = "qcom-shm-bridge", + .of_match_table = qcom_shm_bridge_of_match, + /* + * Once enabled, the SHM Bridge feature cannot be disabled so + * there's no reason to ever unbind the driver. + */ + .suppress_bind_attrs = true, + }, + .probe = qcom_shm_bridge_probe, +}; + +static int __init qcom_shm_bridge_init(void) +{ + return platform_driver_register(&qcom_shm_bridge_driver); +} +subsys_initcall(qcom_shm_bridge_init); diff --git a/include/linux/firmware/qcom/shm-bridge.h b/include/linux/firmware/qcom/shm-bridge.h new file mode 100644 index 000000000000..df066a2f6d91 --- /dev/null +++ b/include/linux/firmware/qcom/shm-bridge.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2023 Linaro Limited + */ + +#ifndef _LINUX_QCOM_SHM_BRIDGE +#define _LINUX_QCOM_SHM_BRIDGE + +#include +#include +#include +#include + +struct qcom_shm_bridge_pool; + +struct qcom_shm_bridge_pool *qcom_shm_bridge_pool_new(size_t size); +struct qcom_shm_bridge_pool * +qcom_shm_bridge_pool_ref(struct qcom_shm_bridge_pool *pool); +void qcom_shm_bridge_pool_unref(struct qcom_shm_bridge_pool *pool); +struct qcom_shm_bridge_pool * +devm_qcom_shm_bridge_pool_new(struct device *dev, size_t size); + +void *qcom_shm_bridge_alloc(struct qcom_shm_bridge_pool *pool, + size_t size, gfp_t gfp); +void qcom_shm_bridge_free(void *vaddr); +void *devm_qcom_shm_bridge_alloc(struct device *dev, + struct qcom_shm_bridge_pool *pool, + size_t size, gfp_t gfp); + +phys_addr_t qcom_shm_bridge_to_phys_addr(void *vaddr); + +#endif /* _LINUX_QCOM_SHM_BRIDGE */ From patchwork Mon Aug 28 19:25:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 719163 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EDD9C83F15 for ; Mon, 28 Aug 2023 19:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233096AbjH1T15 (ORCPT ); Mon, 28 Aug 2023 15:27:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233367AbjH1T1c (ORCPT ); Mon, 28 Aug 2023 15:27:32 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37469120 for ; Mon, 28 Aug 2023 12:27:12 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-31adc5c899fso3201614f8f.2 for ; Mon, 28 Aug 2023 12:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250831; x=1693855631; 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=5cFxADGOERyNFN7lTVtP33aE4fUtIdh4yla5Ms0ctiE=; b=EoXzrnanHjxRlCVdFNR3jEL/xRmfXMhI4RzAOrNmLf3G2biAWlM7vvmO7zLkPHT4iK 5Le0KJNfMSWSAwMlhFthLroTME9MfrlZuNQF5utevteIrmy0/Av5ZCo33of6uVD6MzZw A1KumZvLrH7LkMecujD0FPIYUstS5WpuDS37Ojb2nzciYE9Xh5rv0wqiVRJgNyR/eYOw epjjDQD+dBqlNcb4kQb7Sa60JXJvr7soJSrAuFyOkgWHC0Dit3u6CO0PaVO6+PsJ0nTy zKUet+A0wII8xV9lzUXPhMgXlFMm113iHCOpFEQhZhKXxSt/ZxNZqwZ+GN5YszttspJ7 Ks9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250831; x=1693855631; 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=5cFxADGOERyNFN7lTVtP33aE4fUtIdh4yla5Ms0ctiE=; b=f/VsPp/kESDm8NKNWYq1fU3GZaBAKlnHkocEzu+r+vkhENq9+z8ODABOtAZxsZVWWl UvrgNOOHr3QHnubHk+YL69g1s3aPKxxE2iUQdJFJC1J39pe+sA65/a38/JJPwyqzDvDI n5ro6PLQoCCBtJ4LGqm3iCiJdwDOyYW1m4+3hTgzw1UNDuwHltKpU/AsxFuKcHeZ65kH 9VxO5A1o/lmduNN+9/u7Gq+WMbgdAgg0/zAprg+FLzZ1L9UrHZVgiSA9Ep5KSsxg2jSY 9q1CBa5foWi90FfNbWHwzceM3Yk7/RmIdf+8h/RJXor8Ylcw1UoFFQIWUHCj0IIrJTvb xu6Q== X-Gm-Message-State: AOJu0YxwB4ySw1JOJqP6SJwBLi8qyPbESCwHDRN3Ljss7p7lVYgkPaKI PypYUxBlTj5k/7FEOylh+/vzbg== X-Google-Smtp-Source: AGHT+IFTdl/tQdMkT1arHw9DxZMr0l64zUqWz+qHpOkaOVV+i2xMx+CKkBv3fHfRzh8d+Cw4kcZ+EQ== X-Received: by 2002:a5d:4d02:0:b0:317:5a9b:fcec with SMTP id z2-20020a5d4d02000000b003175a9bfcecmr19670541wrt.14.1693250830785; Mon, 28 Aug 2023 12:27:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:10 -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 07/11] firmware: qcom-scm: use SHM bridge if available Date: Mon, 28 Aug 2023 21:25:03 +0200 Message-Id: <20230828192507.117334-8-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Allocate the memory for SCM call arguments from the Shared Memory Bridge if it's available. Signed-off-by: Bartosz Golaszewski --- drivers/firmware/qcom_scm-smc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/qcom_scm-smc.c b/drivers/firmware/qcom_scm-smc.c index 16cf88acfa8e..6045be600c2a 100644 --- a/drivers/firmware/qcom_scm-smc.c +++ b/drivers/firmware/qcom_scm-smc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "qcom_scm.h" @@ -161,6 +162,7 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, ARM_SMCCC_SMC_32 : ARM_SMCCC_SMC_64; struct arm_smccc_res smc_res; struct arm_smccc_args smc = {0}; + bool using_shm_bridge = qcom_scm_shm_bridge_available(); smc.args[0] = ARM_SMCCC_CALL_VAL( smccc_call_type, @@ -173,8 +175,12 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, if (unlikely(arglen > SCM_SMC_N_REG_ARGS)) { alloc_len = SCM_SMC_N_EXT_ARGS * sizeof(u64); - args_virt = kzalloc(PAGE_ALIGN(alloc_len), flag); - + if (using_shm_bridge) + args_virt = qcom_shm_bridge_alloc(NULL, + PAGE_ALIGN(alloc_len), + flag); + else + args_virt = kzalloc(PAGE_ALIGN(alloc_len), flag); if (!args_virt) return -ENOMEM; @@ -196,7 +202,10 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, DMA_TO_DEVICE); if (dma_mapping_error(dev, args_phys)) { - kfree(args_virt); + if (using_shm_bridge) + qcom_shm_bridge_free(args_virt); + else + kfree(args_virt); return -ENOMEM; } @@ -208,7 +217,10 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, if (args_virt) { dma_unmap_single(dev, args_phys, alloc_len, DMA_TO_DEVICE); - kfree(args_virt); + if (using_shm_bridge) + qcom_shm_bridge_free(args_virt); + else + kfree(args_virt); } if (ret) From patchwork Mon Aug 28 19:25:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 719160 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 298A9C83F27 for ; Mon, 28 Aug 2023 19:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233423AbjH1T2C (ORCPT ); Mon, 28 Aug 2023 15:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233371AbjH1T1d (ORCPT ); Mon, 28 Aug 2023 15:27:33 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525B51A5 for ; Mon, 28 Aug 2023 12:27:13 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fea0640d7aso34115115e9.0 for ; Mon, 28 Aug 2023 12:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250832; x=1693855632; 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=G5UUEotKM3KPlt75iPa8nyLWoLcrw4bhDYA2GP/3CkM=; b=Lp3+/vZEdk1adx7vtq1BnepUYuSHIxLzsE7TOETlCJv+KHKzzWc/PEKZK3dimcfIsN bN7K01zSTB+hfS2i3EsL9JQsvaIpTI1e8v3N5W26Y+FtkAoTUSG/xxLNB/pSzmmZp0oH xc8EZK9Pijy4WDWTNPvoqY7pPJhXZZ3PH/Q3RZn/YCVrLwEd1HX8x6POdo0Ibs5ZhFJH XxBawl9w5Ha2by7sr+qGcoDYI+rUFRdixvecdQ2+XPlM7V9GWEnJgIOcY6kkqsvEUkml Xgbz4lnheXMjGyxSS+M5BHDwcRRC3r/RZkZHESd6/3EACCw2B2K4jE1HCU/5G+jvyiNp 87SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250832; x=1693855632; 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=G5UUEotKM3KPlt75iPa8nyLWoLcrw4bhDYA2GP/3CkM=; b=I7daFCKTlSmeKli/M7qwrZcHDgxEJEICtwzvQ1PeO70EZWdrFdSBoOleUWhtjWI3Mu JAidpzSj46YE8WbL5QiN1yI964eGUTGYWg1ED9QUb4xkxEPDtaXZnigkUGyJpYR1x/9K YiyVLcumiR9C8dghS6lujbJCf/cCX9rMkzMKMCjAlGIypXaDKO2bY1RBO7UmnNcOEs6p oahrh/AV3kTlC6Jt1+gdsqXVbM9TmDSeK7a1oMZsVP2AaICxxeWQ8Q05E/pzM5VL8OAJ iMinPV+xmyqwIGXTpk1+U+MrVZrJX6VHXJsTORHdexhPhg/SCjj6/3PdUqNKtlm5yCKj dr/A== X-Gm-Message-State: AOJu0YxYES/VMrktpNHrhGjkjXIRNVbg6pvOMl/9XJCO1cS4NZ5D6p1E OrAroqpzYZJtlW6E4pTAdRmiTw== X-Google-Smtp-Source: AGHT+IGjgJy2rlEGsYdV6I6xyuANjKsdskic1BzqqdpwjuKQOjfX2n/VBEmdO4XGEgxS+FxXRwG0pA== X-Received: by 2002:adf:ce82:0:b0:317:43de:4c0a with SMTP id r2-20020adfce82000000b0031743de4c0amr18604895wrn.20.1693250831938; Mon, 28 Aug 2023 12:27:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:11 -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 08/11] arm64: defconfig: enable Qualcomm SHM bridge module Date: Mon, 28 Aug 2023 21:25:04 +0200 Message-Id: <20230828192507.117334-9-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Most Qualcomm architectures support SHM bridge. Enable it as a built-in module in arm64 defconfig. Signed-off-by: Bartosz Golaszewski --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index a25d783dfb95..7f982d9966e3 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -248,6 +248,7 @@ CONFIG_ARM_SCPI_PROTOCOL=y CONFIG_RASPBERRYPI_FIRMWARE=y CONFIG_INTEL_STRATIX10_SERVICE=y CONFIG_INTEL_STRATIX10_RSU=m +CONFIG_QCOM_SHM_BRIDGE=y CONFIG_EFI_CAPSULE_LOADER=y CONFIG_IMX_SCU=y CONFIG_IMX_SCU_PD=y From patchwork Mon Aug 28 19:25:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 719162 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F49DC83F17 for ; Mon, 28 Aug 2023 19:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233186AbjH1T15 (ORCPT ); Mon, 28 Aug 2023 15:27:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233419AbjH1T1e (ORCPT ); Mon, 28 Aug 2023 15:27:34 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB761A2 for ; Mon, 28 Aug 2023 12:27:14 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe4cdb72b9so35202915e9.0 for ; Mon, 28 Aug 2023 12:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250833; x=1693855633; 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=BAFaAAYoXtYBwsZEB5803CfYwT2H5kOVyLG4imLw9Ng=; b=sbvAYBnYvMtQ5zHvNb+ucyUQxsfswVBcZM/ar2F0dRfS4ewDAUJjw03AVtS1PWnf/G cqu+nYSS1d4AXk2m0hv8+daSi8iZwzboeUAqMjANlPobyJ4Ql3UmF0YL32U3XIiFpyA8 1DIW9fQFJ5Ip/1DW8HInCGLwdtV4tkc7IRqHHz6jtRn3J21+kMY4qQm/ggf61IbB6uPl oVX11YhXXQLkqHs7C5sR4eZEYLCZMXwEv/mW4idSCkyic1oUUc/H8kIO/YY4dw+mKkah Cs9YlbV6RRiwIYMsXxTH5lNlOFWngcE9JgNT68DaeWEY1CNd2XFQW+FNQxmWbmelwyTK E/IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250833; x=1693855633; 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=BAFaAAYoXtYBwsZEB5803CfYwT2H5kOVyLG4imLw9Ng=; b=fndoItmC05CSK0oay+K5M8Yb7MUbswurjpnSaTRjlUXq2zHoMuYwzrnUva4q/NDYx8 V4QA6+Q7acez0ZtjrRzaviVJ6r2RonFO+X4JqrhnCEnKGLoPKR4RZPBo7VYyDvHkUcSk 8h7o4UNuyH5kHagDVD2G5oKKQ2IekicIZ8rPxg/B5NtsiJeN8V6T3Fm/aYedjUBBU0zY 8eJPeWMiL9k5GtRm8kTdjaOH1lh94qEkmDSppMC3ffFyArzcqqeUpi2MF6dNLSHnJrgR wf3N3EdEnjBOLUTpHKQetJBB9i1LtS5ybK8vly79NoPi4gpwErKaLAHIsi1fpahkfRf3 d+lQ== X-Gm-Message-State: AOJu0YyZVxjcH44pm02qShGAT8Zck6yP2sHtB+aLeWj1Tac/OVn7VKbG ncdwvGgh4rJEkL/XzRA901Kv/Q== X-Google-Smtp-Source: AGHT+IERZ8Tk7ITAPI5IRbPu9geaRPRqJ6/1sXAiQvTPNpFfS2XTgFIfNp/PGkXNe/7dmFA1ZZGAcg== X-Received: by 2002:a1c:7908:0:b0:3fe:22a9:907 with SMTP id l8-20020a1c7908000000b003fe22a90907mr19589642wme.20.1693250833266; Mon, 28 Aug 2023 12:27:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:12 -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 09/11] arm64: dts: qcom: sm8450: enable SHM bridge Date: Mon, 28 Aug 2023 21:25:05 +0200 Message-Id: <20230828192507.117334-10-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Enable SHM bridge on sm8450 platforms. Signed-off-by: Bartosz Golaszewski --- arch/arm64/boot/dts/qcom/sm8450.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi index 5cd7296c7660..eacb2658e3ec 100644 --- a/arch/arm64/boot/dts/qcom/sm8450.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi @@ -289,6 +289,10 @@ scm: scm { interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>; #reset-cells = <1>; }; + + shm-bridge { + compatible = "qcom,shm-bridge-sm8450", "qcom,shm-bridge"; + }; }; clk_virt: interconnect-0 { From patchwork Mon Aug 28 19:25:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 717775 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0722C83F19 for ; Mon, 28 Aug 2023 19:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbjH1T17 (ORCPT ); Mon, 28 Aug 2023 15:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233426AbjH1T1e (ORCPT ); Mon, 28 Aug 2023 15:27:34 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B1E1AB for ; Mon, 28 Aug 2023 12:27:16 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-401ceda85cdso7510165e9.1 for ; Mon, 28 Aug 2023 12:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250834; x=1693855634; 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=LCx6rX9XwkuTbZO5oGRhSEBk5e7OaZJRubi6F2ucuO0=; b=kbalgKaBhIdUuKiRYkEoB9PjGYYgWzArZwbNwkwnDpDl2p8QWr0ZHt7WAyE7J9OEVS qOKK+GJCEwqq7V8OTL4qtinpwf74jAJjquHEn6PNN4/WJQxRpQDVmu+fRkkZG9JqCpkZ whLI1B+OhxOabfnsiYrTZPyZaVOdcl2qknkH0MfRSHE7+KHqdC8U9WmWLdNm7HDU02Ov 0bvmWDhy9DMP6lq7X2xzwiPm4Vr9MBkhtIsj3Uu2Qb4ko8nk3PTXPSW/falJDJRPq/Cl 3ud4CiLp3RUSsy9QVbIkVoFL5gMf6QdBrna+VPjN+RpVQnivOz/0mAw4PnlbRy04IAVV 5YmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250834; x=1693855634; 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=LCx6rX9XwkuTbZO5oGRhSEBk5e7OaZJRubi6F2ucuO0=; b=V3WSTD5ThezQoHK9lL7CFyUe8GcGY5XldrQnertUNUtrqPJrqhr87rLjYwMFgWCwh2 wHkgfpaUEE1vmPGlCqozAAUFTPxdyOTwc/pDHD1kXgyGJYT0xmtZFJX4+ggphGMaLT1s PtBI5EWtnKGlE2hYHeppmLA3UO/DIIIvs3Slt8fjXSuzR6LhWrbv6ONyTEXE0aKmlNJO FdOk4hfJD4MHIYG3BSmOb5GDWGbcF//hpsQcVL+Y48a6mXGckAcbwwzrpiz1ZwLsJIF/ C2M7Tn3CkjxAONHynKRH+ucOsrPiI2rk05QEdjSdPj5Z08Agzgt4qAEYW+zQGtX/ofnj 3M0w== X-Gm-Message-State: AOJu0YxsgbiEHZozqY54e3VjDk0sfWdLxl0MeoQhV3dHV96D9GvMb83p f4IEmMrE/poqyKLT3IgU7G6Slg== X-Google-Smtp-Source: AGHT+IGonPCG2HR4mwHMevXIU/ybI7JuPnQYVr3ZJNLHR2Fi7PQuFZCK98LCZMFUwA5tvpeKIA0xJA== X-Received: by 2002:adf:ef91:0:b0:318:f7a:e3c8 with SMTP id d17-20020adfef91000000b003180f7ae3c8mr20535179wro.57.1693250834586; Mon, 28 Aug 2023 12:27:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:14 -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 10/11] arm64: dts: qcom: sa8775p: enable SHM bridge Date: Mon, 28 Aug 2023 21:25:06 +0200 Message-Id: <20230828192507.117334-11-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Enable SHM bridge on sa8775p platforms. Signed-off-by: Bartosz Golaszewski --- arch/arm64/boot/dts/qcom/sa8775p.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sa8775p.dtsi b/arch/arm64/boot/dts/qcom/sa8775p.dtsi index b130136acffe..d8614d15750e 100644 --- a/arch/arm64/boot/dts/qcom/sa8775p.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8775p.dtsi @@ -209,6 +209,10 @@ firmware { scm { compatible = "qcom,scm-sa8775p", "qcom,scm"; }; + + shm-bridge { + compatible = "qcom,shm-bridge-sa8775p", "qcom,shm-bridge"; + }; }; aggre1_noc: interconnect-aggre1-noc { From patchwork Mon Aug 28 19:25:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 717773 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D52F8C83F23 for ; Mon, 28 Aug 2023 19:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233367AbjH1T2B (ORCPT ); Mon, 28 Aug 2023 15:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbjH1T1e (ORCPT ); Mon, 28 Aug 2023 15:27:34 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F7F21B4 for ; Mon, 28 Aug 2023 12:27:17 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-31c615eb6feso2938341f8f.3 for ; Mon, 28 Aug 2023 12:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693250835; x=1693855635; 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=TMIOWWSdqeSoUAfHcjIOH1OC+hMNlEb1paPS+tEaJKg=; b=BCjoeEUS/FckunA7BjsPbj5RT/CgPggSegR9WzbBOoQWtgPXY39sFmaEIE9kfJhJ7j 2zROPjmvS+BGD9EvL5JgTngaatkJ3F77HlSYV6kxCn815OjUP+eP/AO73EyxCRErLTZw G3Mi/2pk0RCWlfDwldSJ/CEtiWSI5MZlNnrrmGibUrL8AyZYetCatMIdEPMu2i9Zpy/H mJ+EPJm4AnLYht0y9tLr/SC1ChgtsaM/N2lu2EoyS9TIZVR60RHwz9eUkjePNntEK65y D6u9+Rt/AbLg15sCE03YMu110ANPN+zdJMBJ8qCvHcKFHWlRZwifdZzCiYtOXka6Dbve BSJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693250835; x=1693855635; 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=TMIOWWSdqeSoUAfHcjIOH1OC+hMNlEb1paPS+tEaJKg=; b=WGxs+VSIBO3x7s46hpV8nKaL31sS78UOWdobmrwEPjX7IfwuHMlCzcCxHanMjJ5BnR se+14c5qeJ18K1BnIYzzTs1kFtZCckC7XWtPlVS6ICxNMtBaWtyMkRLQH+M56CtJ98JL ITG/J/EDsSUkd3PB+ymEdySQbLuSRSHxcf0Hb48oINPfFmzUyZGwJxnbaM50sNAcujWi i4A18FwdHX2avEQ/r1eLmh/OGVS1jBNmOCeI5sv/2P/eFPPUb8O2yq9eG1HDrN4Jc1C/ V5RGNJ44+t3aG4pXcELv63dwBbBNnyRyaOBk3NI/wV+eoiOcb9Z2NlhjHR5Sn2uKSt3D OH4Q== X-Gm-Message-State: AOJu0YxFTaTQNh5B163n7VhthMkkI7L7iydSzu400xIWVtVjT/r4VKba crRpTuFS2jPMm5v+zIWUnohpXA== X-Google-Smtp-Source: AGHT+IGwSg/n9slu02mhVXrK3uD2f2TSMnRa4Rgqq9mKJ/qMfRRSzAIiIAyq0Qe05qJxlrLQgd/K1Q== X-Received: by 2002:a5d:414f:0:b0:314:17cc:31d0 with SMTP id c15-20020a5d414f000000b0031417cc31d0mr20153261wrq.34.1693250835788; Mon, 28 Aug 2023 12:27:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 12:27:15 -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 11/11] arm64: dts: qcom: sm8150: enable SHM bridge Date: Mon, 28 Aug 2023 21:25:07 +0200 Message-Id: <20230828192507.117334-12-bartosz.golaszewski@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> References: <20230828192507.117334-1-bartosz.golaszewski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Enable SHM bridge on sm8150 platforms. Signed-off-by: Bartosz Golaszewski --- arch/arm64/boot/dts/qcom/sm8150.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi index b46e55bb8bde..ffb0b9d82bea 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -607,6 +607,10 @@ scm: scm { compatible = "qcom,scm-sm8150", "qcom,scm"; #reset-cells = <1>; }; + + shm-bridge { + compatible = "qcom,shm-bridge-sm8150", "qcom,shm-bridge"; + }; }; memory@80000000 {