From patchwork Tue Jun 27 17:49:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 106460 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp47519qge; Tue, 27 Jun 2017 10:49:14 -0700 (PDT) X-Received: by 10.99.121.204 with SMTP id u195mr6593843pgc.16.1498585754703; Tue, 27 Jun 2017 10:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498585754; cv=none; d=google.com; s=arc-20160816; b=pgwXs13zN3HcOT7dT1kCQLNIqybXbfN0ow+ajPSF0j06WKXvyg79YqEXz/OM7dtxKw 1Y0py2PqE8aZD2ICBMs9UKwcwLs0H/xAn8TVTJdktfpU0JFP6r5HGY3WGesRF1YLzkaS ajXwvC+qxEy8g/JCgjQFDXhKdN54n8INKYtZwscXzRz2mgo2TEHN2D+n02sD7x9WxTkD snd4JMDsJqIY23IUntHTxdnKjpuURH44zRVDh+wsTRUbSjCqLtZ8gua+cLPszAR3KOKj 2035az46CtbG/WIGae2yPbmHyC1oQ6lgsl0iN7a4iZRGDRk2yajqYb2+KJ3zb7wyRkVm 8i1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=qp/ABM+pQIZUqjHl/BI0NNF3AaRKBKYbVxyEFEG4cjU=; b=FoxasZlKe/9YlpevpULbLoHiq4pXOOMTJ17AHg8TxL0geg5YLcWv6ZKHCPtcJaLXbv FwyXNEp0LXrTxcFFx3vGVJT1WsfPB1clXvA8KasbILyd0szmwxKKfpR9UGJYubfVR1ba 1Ge5iV8BiAn7td0at6Z6i70oxf7RimtlbJd2UTkR4tBLlt4WG1WebB3WQ7V91UbPB8IK ETxK49KjwiJ5ZmEyzKluKEAcf0nrIkrf4t/BWMD5jlJpluuQViKpB30VSAKuv0f1jhPn DNWnMXekV08MlJ5rR/mySoOgjAThrQuhr4V3ViTMyIy1LezeA+JhQ8uTBD1wqbZMe6mf FExg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=FxpdyOlR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e67si2274395pfb.227.2017.06.27.10.49.14; Tue, 27 Jun 2017 10:49:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=FxpdyOlR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753251AbdF0RtM (ORCPT + 25 others); Tue, 27 Jun 2017 13:49:12 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34331 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752924AbdF0RtH (ORCPT ); Tue, 27 Jun 2017 13:49:07 -0400 Received: by mail-wr0-f176.google.com with SMTP id 77so163044140wrb.1 for ; Tue, 27 Jun 2017 10:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=qp/ABM+pQIZUqjHl/BI0NNF3AaRKBKYbVxyEFEG4cjU=; b=FxpdyOlReHidXAsI9Hq7wSPZB7EAdAvRvzKn3Y5eYBlKRIVvjQRNGLNBK8tobDNceo x5tqciRhJFU38w2jU7XuJILQWXwlJ+STWszQAFPCb63kDdNuJZA0558QprCfoZKyh78m MgpFLjioPMjy4U+72QQ7xLEceOlE1JEyha72A= 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; bh=qp/ABM+pQIZUqjHl/BI0NNF3AaRKBKYbVxyEFEG4cjU=; b=sd1uXTU0YJzB/sq7dqVtIboFG7tbgfGxfb1ouj8X/KeGFrDtFp1+3Y+9NRuc3fWbEn BUf7URsDttsGTsMAsGuTfwmhC1AZkTN72f/BtbwRmtLHMlVOf68PkUxevSXfjLoWXaKy H48KZ3RywFRkDUfcjrRW/D2e5nllFDvPDm2VSRUuNWvZje/lu9yTGabOzmE/CpUvrDzX nlME1QKtPYH03iiqDeBdsT9aGUTxWVxVDGBLRxTSxNBprD+0GTJXisQBY6fkbSst1u1Y QGk3ZEqd7as8aq+wOslYrlcnUkjK8TLnZ1V/VHJbOFz+urHUujJoKg+VEd31+O13ivGS Upyg== X-Gm-Message-State: AKS2vOzJyVDk1KpJfzbvz9z51NKSmoTavi0Ad5QTF3YMsytjKIKeGmTY cZrWaRoDPWFoeW+s X-Received: by 10.223.150.163 with SMTP id u32mr18306333wrb.195.1498585746066; Tue, 27 Jun 2017 10:49:06 -0700 (PDT) Received: from mms-0441.qualcomm.mm-sol.com ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id 92sm27625244wrb.55.2017.06.27.10.49.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jun 2017 10:49:05 -0700 (PDT) From: Georgi Djakov To: linux-pm@vger.kernel.org, rjw@rjwysocki.net Cc: robh+dt@kernel.org, khilman@baylibre.com, mturquette@baylibre.com, gregkh@linuxfoundation.org, vincent.guittot@linaro.org, skannan@codeaurora.org, sboyd@codeaurora.org, andy.gross@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v1 0/3] Introduce on-chip interconnect API Date: Tue, 27 Jun 2017 20:49:00 +0300 Message-Id: <20170627174903.27978-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.13.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Modern SoCs have multiple processors and various dedicated cores (video, gpu, graphics, modem). These cores are talking to each other and can generate a lot of data flowing through the on-chip interconnects. These interconnect buses could form different topologies such as crossbar, point to point buses, hierarchical buses or use the network-on-chip concept. These buses have been sized usually to handle use cases with high data throughput but it is not necessary all the time and consume a lot of power. Furthermore, the priority between masters can vary depending on the running use case like video playback or cpu intensive tasks. Having an API to control the requirement of the system in term of bandwidth and QoS, so we can adapt the interconnect configuration to match those by scaling the frequencies, setting link priority and tuning QoS parameters. This configuration can be a static, one-time operation done at boot for some platforms or a dynamic set of operations that happen at run-time. This patchset introduce a new API to get the requirement and configure the interconnect buses across the entire chipset to fit with the current demand. The API is NOT for changing the performance of the endpoint devices, but only the interconnect path in between them. The API is using a consumer/provider-based model, where the providers are the interconnect controllers and the consumers could be various drivers. The consumers request interconnect resources (path) to an endpoint and set the desired constraints on this data flow path. The provider(s) receive requests from consumers and aggregate these requests for all master-slave pairs on that path. Then the providers configure each participating in the topology node according to the requested data flow path, physical links and constraints. The topology could be complicated and multi-tiered and is SoC specific. Below is a simplified diagram of a real-world SoC topology. The interconnect providers are the memory front-end and the NoCs. +----------------+ +----------------+ | HW Accelerator |--->| M NoC |<---------------+ +----------------+ +----------------+ | | | +------------+ +-------------+ V +------+ | | | +--------+ | PCIe | | | | | Slaves | +------+ | | | +--------+ | | C NoC | V V | | +------------------+ +------------------------+ | | +-----+ | |-->| |-->| |-->| CPU | | |-->| |<--| | +-----+ | Memory | | S NoC | +------------+ | |<--| |---------+ | | |<--| |<------+ | | +--------+ +------------------+ +------------------------+ | | +-->| Slaves | ^ ^ ^ ^ | | +--------+ | | | | | V +-----+ | +-----+ +-----+ +---------+ +----------------+ +--------+ | CPU | | | GPU | | DSP | | Masters |-->| P NoC |-->| Slaves | +-----+ | +-----+ +-----+ +---------+ +----------------+ +--------+ | +-------+ | Modem | +-------+ This RFC does not implement all features but only main skeleton to check the validity of the proposal. TODO: * Constraints are currently stored in internal data structure. Should PM QoS be used instead? * Extend interconect_set() to handle parameters such as latency and other QoS values. * Cache the path between the nodes instead of walking the graph on each get(). * Sync interconnect requests with the idle state of the device. Summary of the patches: Patch 1 introduces the interconnect API. Patch 2 creates the first vendor specific interconnect controller driver. Patch 3 is a proposal for DT bindings Changes since RFC v2 (https://lkml.org/lkml/2017/6/12/316) * Converted documentation to rst format. * Fixed an incorrect call to mutex_lock. Renamed max_bw to peak_bw. Changes since RFC v1 (https://lkml.org/lkml/2017/5/15/605) * Refactored code into shorter functions. * Added a new aggregate() API function. * Rearranged some structs to reduce padding bytes. Changes since RFC v0 (https://lkml.org/lkml/2017/3/1/599) * Removed DT support and added optional Patch 3 with new bindings proposal. * Converted the topology into internal driver data. * Made the framework modular. * interconnect_get() now takes (src and dst ports as arguments). * Removed public declarations of some structs. * Now passing prev/next nodes to the vendor driver. * Properly remove requests on _put(). * Added refcounting. * Updated documentation. * Changed struct interconnect_path to use array instead of linked list. Georgi Djakov (3): interconnect: Add generic interconnect controller API interconnect: Add Qualcomm msm8916 interconnect provider driver dt-bindings: Interconnect device-tree bindings draft .../bindings/interconnect/interconnect.txt | 75 ++++ Documentation/interconnect/interconnect.rst | 71 ++++ drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/interconnect/Kconfig | 15 + drivers/interconnect/Makefile | 2 + drivers/interconnect/interconnect.c | 376 ++++++++++++++++++ drivers/interconnect/qcom/Kconfig | 12 + drivers/interconnect/qcom/Makefile | 2 + drivers/interconnect/qcom/interconnect_msm8916.c | 421 +++++++++++++++++++++ include/dt-bindings/interconnect/qcom,msm8916.h | 87 +++++ include/linux/interconnect-consumer.h | 72 ++++ include/linux/interconnect-provider.h | 120 ++++++ 13 files changed, 1256 insertions(+) create mode 100644 Documentation/devicetree/bindings/interconnect/interconnect.txt create mode 100644 Documentation/interconnect/interconnect.rst create mode 100644 drivers/interconnect/Kconfig create mode 100644 drivers/interconnect/Makefile create mode 100644 drivers/interconnect/interconnect.c create mode 100644 drivers/interconnect/qcom/Kconfig create mode 100644 drivers/interconnect/qcom/Makefile create mode 100644 drivers/interconnect/qcom/interconnect_msm8916.c create mode 100644 include/dt-bindings/interconnect/qcom,msm8916.h create mode 100644 include/linux/interconnect-consumer.h create mode 100644 include/linux/interconnect-provider.h