From patchwork Tue Mar 14 04:46:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 6578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1567528wrd; Mon, 13 Mar 2023 22:01:15 -0700 (PDT) X-Google-Smtp-Source: AK7set8Wro3K0nAs60Sl70EtZEoTjDPp1zAgC7arQjpji1Ew7Sxyw7hPaEcrHQxwrH0vLNG/s+ax X-Received: by 2002:a05:6102:3b0a:b0:411:bee5:86d with SMTP id x10-20020a0561023b0a00b00411bee5086dmr10285761vsu.6.1678770075015; Mon, 13 Mar 2023 22:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678770075; cv=none; d=google.com; s=arc-20160816; b=MBNrpoI5oTCt0fzYsikvCNCNbq8SgJ89kmdkjG+tlggrXgqarXwcQqOJtqSkXnbPkc bZkqny+12ZzXX5ghgGv1yOoSL8WedQD8pGDrhQIOSvIan26QTGp1CgIviL340xdgzBLV 8NYmxhjdxDgRw08/V6M7hqY1vZRz4VrmhoyFTrhU2ZP8MagV3q1iGm+eMUcMQ0IKK+lV jSeWrNdmPY05dK0fHWhtuVvdzpFOgC/EquoMHpQIwaTWZTHfpyULbVofHlhmpn1tSVLo k9XgsVJYDBG5E8id/j0fTmd5T6NO+nt8H0YUwucYWOYQv/C+UOj1Wf1Yu/Jm+/sweUQm sEgQ== 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=UasGxUvD/6g4IwIcOZQz9JmOw1F78bhUJX7l6AUhgEk=; b=SQw8GFMwWzfTQ7CDGEnxkQcdpPlbs22bJAflZsP55fJQgg2Q0BxqM4fGwyC8BzPT3/ Lw1zfB197zFnuk5n3/15kVzhkdETjXGb7TFh8C1n8vyt5Kx/x4mk6cnBNpgubcxCzm7N 1UbVRcBccovQZX7rPDyG6wsH145G9aPWleqwSj6v/KZQPDmNJmqvRDOQz5MUIgg/QX4y EZqZ0U60rXLdyF+85JpJ3OVFgw01UpdOujqR5lD0R0P4tlAyxhD3gnzR+PzqhoOyyGb0 zdC14xq35itmcRCBwoclb8G9ITX++r4vOwDDOnuhyvj525dMMhEOQ4agcVXnBKzM6OB0 cZkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ABdMLy0q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a056102200f00b00412510beedasi824898vsr.707.2023.03.13.22.00.59; Mon, 13 Mar 2023 22:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ABdMLy0q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229473AbjCNEqh (ORCPT + 99 others); Tue, 14 Mar 2023 00:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjCNEqg (ORCPT ); Tue, 14 Mar 2023 00:46:36 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E65E25FA58 for ; Mon, 13 Mar 2023 21:46:33 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id l9-20020a17090a3f0900b0023d32684e7fso323186pjc.1 for ; Mon, 13 Mar 2023 21:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678769193; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UasGxUvD/6g4IwIcOZQz9JmOw1F78bhUJX7l6AUhgEk=; b=ABdMLy0qDOTqhAEOBhgimyuNWzeR/Zq5TUIKYOS3Qg/oz1Q5nV6Cu5vjpZE7o0ErJE VygRD7tCfY+mb/m6T1HY1BV4iLZl17WK7INjQXz1vFJbAwPDgrH9mqIhXJEwovlPh817 v4KfnPuyqnKGTBW4VwbI2FAuYqWefezJqTn1wWm4bRXfQ4lmAl886AsC3YPdHUtQIOYD yNXAyIyd+J+NzElYfwRWL+RJSS0FC49fJqpUiGx4tpzBKxgZF35qh5dXw3tLtRwNFxqg t4NwwSppme77as7jki7UhJ4c4MFT3lpfWn688RVhVCHdN+EegQtAzgJ06V01dMBAtUxa E8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678769193; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UasGxUvD/6g4IwIcOZQz9JmOw1F78bhUJX7l6AUhgEk=; b=pJj9aJSeFW5naHx938vDrYi591W+7D2A8D6uvap/Soh8xTjJGwJKzYOYPCnwUO/yd9 tvaqtAiV4GbNAW6f4LVcpe6vCbF10igorus47rUC7NbWHTzLcJ8vr01xItSL3ES0p9XD VPbTztexiS8L0UltAYkJGQVpW9VHfzgqxXBKfKmseMm7xMkgo9Tf2TJiJ39EFK+RWtkg er96S5L5YgQ26unwcqvcYjXrxIBtC7Oe5DMU+sacQmpjAYmCeIN7Ucq90I4QN+zR4oYp CMkJgzQSXdER3+n4lCoC/gX/5xwAS1cJGXLFquL2Lvn9vK05krZxbXrXpre2++m8gRlq bDCw== X-Gm-Message-State: AO0yUKXsZPHDZy3f8q90QrNZIjbEUZmnP8Qucp77JxGhm9e/r4Q75vG2 M2PLRcR353eqWTX0kIYEzld3frVh7JhrTtGoLQ== X-Received: by 2002:a17:902:c946:b0:19c:be03:d1ba with SMTP id i6-20020a170902c94600b0019cbe03d1bamr42635675pla.6.1678769193313; Mon, 13 Mar 2023 21:46:33 -0700 (PDT) Received: from localhost.localdomain ([117.217.177.49]) by smtp.gmail.com with ESMTPSA id lh13-20020a170903290d00b0019c2b1c4ad4sm690125plb.6.2023.03.13.21.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 21:46:32 -0700 (PDT) From: Manivannan Sadhasivam To: lpieralisi@kernel.org, kw@linux.com Cc: kishon@kernel.org, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 0/7] Add support for MHI Endpoint function driver Date: Tue, 14 Mar 2023 10:16:16 +0530 Message-Id: <20230314044623.10254-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760318010077234744?= X-GMAIL-MSGID: =?utf-8?q?1760318010077234744?= Hello, This series adds support for Modem Host Interface (MHI) Endpoint function driver and few updates to the PCI endpoint core. MHI === MHI is the communication protocol used by the host machines to control and communicate with the Qualcomm modems/WLAN devices over any high speed physical bus like PCIe. In Linux kernel, MHI is modeled as a bus driver [1] and there are two instances of MHI used in a typical setup. 1. MHI host - MHI implementation for the host machines like x86/ARM64. 2. MHI Endpoint - MHI implementation for the endpoint devices like modems. MHI EPF ======= The MHI Endpoint function driver (MHI EPF) is used on the MHI endpoint devices like modems. The MHI EPF driver sits in between the PCIe EP and MHI EP bus and carries out all of the PCIe related activities like BAR config, PCIe Event handling, MMIO read/write etc,... for the MHI EP bus. Below is the simple representation of the setup: +----------------------------------------------------+ | Endpoint CPU | | | +------------+ | +------------+ +-----------+ +-----------+ | | | | | | | | | | | | | | | MHI EP | | | | | | PCIe Bus | Modem DSP +---+---+ Bus +---+ MHI EPF +---+ PCIe EP +---+--------- | | | | | | | | | | | | | | | | | | | | +------------+ | +------------+ +-----------+ +-----------+ | | | | | +----------------------------------------------------+ The data packets will be read from the Modem DSP by the MHI stack and will be transmitted to the host machine over PCIe bus with the help of MHI EPF driver. Test setup ========== This series has been tested on Snapdragon X55 modem a.k.a SDX55 connected to the ARM64 host machine. Thanks, Mani [1] https://www.kernel.org/doc/html/latest/mhi/mhi.html Changes in v3: * Fixed the probe function of EPF_VNTB driver Changes in v2: * Rebased on top of v6.3-rc1 * Switched to the new callback interface for passing events from EPC to EPF * Dropped one patch related to notifier Manivannan Sadhasivam (7): PCI: endpoint: Pass EPF device ID to the probe function PCI: endpoint: Warn and return if EPC is started/stopped multiple times PCI: endpoint: Add linkdown notifier support PCI: endpoint: Add BME notifier support PCI: qcom-ep: Add support for Link down notification PCI: qcom-ep: Add support for BME notification PCI: endpoint: Add PCI Endpoint function driver for MHI bus drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 + drivers/pci/endpoint/functions/Kconfig | 10 + drivers/pci/endpoint/functions/Makefile | 1 + drivers/pci/endpoint/functions/pci-epf-mhi.c | 454 ++++++++++++++++++ drivers/pci/endpoint/functions/pci-epf-ntb.c | 3 +- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- drivers/pci/endpoint/pci-ep-cfs.c | 3 + drivers/pci/endpoint/pci-epc-core.c | 52 ++ drivers/pci/endpoint/pci-epf-core.c | 8 +- include/linux/pci-epc.h | 2 + include/linux/pci-epf.h | 8 +- 12 files changed, 540 insertions(+), 7 deletions(-) create mode 100644 drivers/pci/endpoint/functions/pci-epf-mhi.c