Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1588230pxf; Fri, 19 Mar 2021 10:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz59ThVYz0AjdobWU0uQ2h90o3Z5XzihgiHlwJ8xsEog67Xny8CgySE7YkG+sTZoGBhUSTJ X-Received: by 2002:a17:906:b747:: with SMTP id fx7mr5772640ejb.474.1616174776888; Fri, 19 Mar 2021 10:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616174776; cv=none; d=google.com; s=arc-20160816; b=hgEpKFBkWe+cA3tzOFxbfnNuRq+I3U5Z0nRxNab/0yqC1oLve3ZTkCa8NcWcCeb3xa o5AJ2vA/gC239MePVnnNc0KNokRp5hDuuRYhHNE1LeR5JqgKY47reibGIyduDzzfugDK xcfYgiSXbLMWTzn3gPKzFxbpRZki8zQKb/LmYQOehsKKISv7M/BRDj1bkRX22KlOOhLH dyxrR0xmXneKA0OC8Y392S+qukT2J24di+6AOLr6b5g1OE/Skk+uoGaIR8evcIG6JJQY 2U/SYp0S7pQENXMN8H07/E9wnKZYEJq/g/4gpLkJKqAkQFLpPiz1CRUkCc9Ho8rGQppz TXOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+yAppcMi6ZLbhOHE0DMEql9l8WSBLD/1L9P2TMyJ9tQ=; b=rOmjMvSiTlFIBq27DZQ3vJA/A/+YA1d2XpDUZydY9cfmjJzmMgF+Ga9FSNte7yHTt2 bNwxpkKSAoEv+RGlsFsIZHXc3HY17c01XcL00C7ggpRZhffirLh7jJmdGAWOUc/cpOI8 Pv5EH6n1XRlkirb242OafENxsS9ezwXFWNREi1XS8/m+jcWRZeA9lwgHU++VPBc5MoeZ O9rM00qwLhgg3RKzIUuTHhpLp2IxV3E/863U+kPBntV+jCNkosKWV75f4eHQNcv4u3yP 20fb8iUbCGZ/tN2Dg1Q4Sj8aa2KLNRGFcMdBFV8Wcq0S1UG/1kaTFAs8G5d/C1R6fip6 uVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NtHzP1ri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ho20si4916326ejc.295.2021.03.19.10.25.53; Fri, 19 Mar 2021 10:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NtHzP1ri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230199AbhCSRYx (ORCPT + 99 others); Fri, 19 Mar 2021 13:24:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbhCSRYX (ORCPT ); Fri, 19 Mar 2021 13:24:23 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E22BC06174A; Fri, 19 Mar 2021 10:24:22 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id o10so11157258lfb.9; Fri, 19 Mar 2021 10:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+yAppcMi6ZLbhOHE0DMEql9l8WSBLD/1L9P2TMyJ9tQ=; b=NtHzP1ri6FOTSuPWjICRDYuvzRJueks9YSW7cF5SNGHOt9KJBR2UFOK3Ya+7s3tE8w 5AJkBLl/F40cgJjXjxeQgGJyC65oUivrZbpo4hJaIKXhzcmGWsfGhz3TnjxVorVZR0v6 4UPIdtzfu63b+RC0PjrWnQaW9UOfEGKClaJtNk4z+AUWOYnTebgl2TFJNPUYJJZvob2o AjdlVAboHsWb87vz0PjxFghwiole+vfsQ4Q7yLWlMwKJszbyhV8rPsbbJPe+B5pzKXEf RsfUQKQidnsDoU0487fDLzcqAXcLQjzvdbJwjfnU34aahdXne8lkLyWn3J2nXOwO34fq 8mwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+yAppcMi6ZLbhOHE0DMEql9l8WSBLD/1L9P2TMyJ9tQ=; b=hPhmHo+f0j3r9zdBfYCIoGAIucA5PsJVRBUk3pTnAu7ilDmvCRhUlIMD7OQm+RASyA dmQRUmOTorCWZxh0f/UBBUzksvTo6J4q5jwm9NvVpbQDIoN7N788vv3u0DFXVc4Pte5D FajBs8Wahn93aX1sllTFy4q/y3SSreUYt7J5VHfNyaMJgpxtPcifZlg5spMPwcM4e9gO FL0Oggmi4TEl1wD7GUhElq2KjqyqpvpWj4IWFH8W/vEeQxnuB1jDklBbCrMTjsTS217e fo0vy5TOlgEM4/Jcru0VA2dS8g6ADGyPm76hbpe8PWaVXb8j1vAle54NfasVpqrHFdAy 4QRA== X-Gm-Message-State: AOAM531K0obnUvjA3/Vwx2TYlPUyTpDI+v8/Mte91irJfF9TfcQVdrRS s5Z2x3/teBtX8iCIkeXQjIOXUoatTXoOJ+Px X-Received: by 2002:a19:c3ce:: with SMTP id t197mr1352792lff.351.1616174660716; Fri, 19 Mar 2021 10:24:20 -0700 (PDT) Received: from localhost.localdomain ([2a01:540:2421:e100:198e:5123:d77b:1e2e]) by smtp.gmail.com with ESMTPSA id y17sm693237lfb.132.2021.03.19.10.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 10:24:20 -0700 (PDT) From: nikitos.tr@gmail.com To: agross@kernel.org, bjorn.andersson@linaro.org Cc: robh+dt@kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin Subject: [PATCH 0/2] soc: qcom: Add Qualcomm Memshare QMI service Date: Fri, 19 Mar 2021 22:23:19 +0500 Message-Id: <20210319172321.22248-1-nikitos.tr@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nikita Travkin This series adds memshare QMI service. It receives messages from other subsystems (like modem subsystem) and answers with a message that contains the memory address of the allocated region. This is used on many msm8916 based devices for location service which requests 2 MB region when the modem starts. If the memory isn't provided, GPS doesn't work. Newer platforms may also use it in other subsystems. The driver implements: - legacy alloc/free messages (known to be used by Samsung A2015 devices) - generic alloc/free messages (used on most msm8916 devices) - query_size message (sent by at least one modem firmware for msm8916) Downstream driver [1] seems to use dynamic memory allocation but it uses concept of "Guaranteed Memory" which means that the region is allocated on driver probe and not released even after "free" request. It also seems to support memory allocation "on demand" without prior client description. My driver implements "guaranteed" allocation using reserved-memory regions and does not allow allocation for any request that was not described in the device tree. It also additionally checks that qrtr node that sent the message is correct (to prevent, for example, processing messages sent from userspace). memshare_qmi_msg.c/h files are mostly copied from [1] (query_size was added from later version of the driver) and cleaned up. Those files keep copyright line from the originals. This driver is tested to work on multiple msm8916 devices, including devices that have dts upstream (with an exception of mtp; db410c doesn't use it). [1] https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/drivers/soc/qcom/memshare?h=LA.BR.1.2.9.1-02310-8x16.0 Nikita Travkin (2): dt-bindings: soc: qcom: Add bindings for Qualcomm Memshare service soc: qcom: Add Qualcomm Memshare QMI service .../bindings/soc/qcom/qcom,memshare.yaml | 109 ++++ drivers/soc/qcom/Kconfig | 8 + drivers/soc/qcom/Makefile | 2 + drivers/soc/qcom/memshare.c | 501 ++++++++++++++++++ drivers/soc/qcom/memshare_qmi_msg.c | 370 +++++++++++++ drivers/soc/qcom/memshare_qmi_msg.h | 228 ++++++++ include/dt-bindings/soc/qcom,memshare.h | 10 + 7 files changed, 1228 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,memshare.yaml create mode 100644 drivers/soc/qcom/memshare.c create mode 100644 drivers/soc/qcom/memshare_qmi_msg.c create mode 100644 drivers/soc/qcom/memshare_qmi_msg.h create mode 100644 include/dt-bindings/soc/qcom,memshare.h -- 2.27.0