From patchwork Tue Mar 7 15:14:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 6246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2491063wrd; Tue, 7 Mar 2023 07:22:45 -0800 (PST) X-Google-Smtp-Source: AK7set//GT2TOkTFosrRKynqVlsAoRZN7TKl35OK/Gc8JhSdTIMdGoLKyTvvy5SbyXzX8fK2LT03 X-Received: by 2002:aa7:c0c5:0:b0:4c1:2252:f72c with SMTP id j5-20020aa7c0c5000000b004c12252f72cmr14973381edp.27.1678202565728; Tue, 07 Mar 2023 07:22:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678202565; cv=none; d=google.com; s=arc-20160816; b=YU4saIsmWahSmimR44UWIqBJdRlxiiDo5RE/d8yTvwTNC0GJ6zMeGQDYSHU0++5Xon WSi6h3zfNKBfwDZxxGnUh4A7vBap/lEUZCCpcpntwuj62585QufcItTd4sYshvbd42qG glitg3GnqPPHdmJVvmqyJO9FGsNb7b2W3D8vZRcVvfoeCMgS4FjMbf92uGOcCQagasKv LnYdxMpkO+LTHwn1GoKR174xi2dMP0XJakdsbV2AwxfqQndCa7vEqcBQeUdxwI9JaGXU 69+wvn6Kfgjl5qM28oN/L05KI3p+Wj8tbseTvlYZv06Gcc77zzEy+TxLtuza3G2TvGFk Aovw== 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=LqmFNKWByCqJbPc1emmBvQnrjWKD9WeXgWA3mO4LgXA=; b=LUo3SB/TAz45ufRda2i8yQ19Yaa5dSo2LmJNUXZC+L/DaFttndtOiX881jIgGF1YcR FAWGyo70xOplIOSXZ4nGhDlfqeNl+eVl6h49aAyip6n+W6B11fH4IcgDpgvHYPv12HPG ojzQgeAhLNLLu5SrJUiURGbBJsF0qQN8t9ODziz83CYG6JZ7OirGVOzIF1hzhf4lLkZA 475uE0hJWOl+t76HcZB2h3qXsH/K2cSisyyno+jr5wgv9KrsRYRrjLEo6sW+n4KbtzVc fJdHOcTsP90Flxcmh7WyDUydJShXbr3uQYCC9SMLgu542tCaoFRyuyv76WmgxlZvQPCW w07w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eJNN+L1Q; 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 f1-20020a170906138100b008db44ebf302si197849ejc.133.2023.03.07.07.22.21; Tue, 07 Mar 2023 07:22:45 -0800 (PST) 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=eJNN+L1Q; 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 S230190AbjCGPRs (ORCPT + 99 others); Tue, 7 Mar 2023 10:17:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjCGPR1 (ORCPT ); Tue, 7 Mar 2023 10:17:27 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14BE774DCB for ; Tue, 7 Mar 2023 07:14:25 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id p6so14478583plf.0 for ; Tue, 07 Mar 2023 07:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678202064; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LqmFNKWByCqJbPc1emmBvQnrjWKD9WeXgWA3mO4LgXA=; b=eJNN+L1QyFr8/aPosDFOsZAZewkHLl9B0giInwtXhhcgSiq5wZDk+VeDfqsZIpAv8K BYx3t8fWTA58WWqemhyuUJgncbMXdN8QB4MF9/SLP16gtoyiDWFYb9YU4kx8LL6vc+/E IyxMMIRP8o+t1KEoSxtZaYAyiScQS1qgssHLjdSgGsg/jTen01mYNEUwhgT3gqYnzo1v ixYpDgPj9Wy8BZHarDeOBJ63fxJC5yOUp0V/W90lofYoTPm/PweKzea4HMFjhKon8Xy8 JwkoqvzNLBWPzYfUNAOwnWTlKlHNqB5Sh44o/lIl5VwKcv380KcdF4mE/suryomXPLy7 2aZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678202064; 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=LqmFNKWByCqJbPc1emmBvQnrjWKD9WeXgWA3mO4LgXA=; b=b227DqkId46t/y3CfeiBgZ1pXLb7eADouj/oBk2Y/i93Z/EaCp/veeglus5v/6joui hcNL5SgEGDZB9ocjnYz1QS3L4MM4WZwNoJHcMdbSu8F2CHj76bj0yMlt2lOGFZCvymCD zGEKFXW+Lfd+QaW/7osA4quq1MubIsdtcOPmv9x0p/6kJVwI21qDYuAVZ/HxwQcVXlcP +Xy4Pk3vdaqaEMxl84t0O9YqdGcR/Bcc+rLrH8+ehJ12ABm5iz0QEzRM1e9/6X67YXy6 5psjTooA7qsqln8ZVPiG6WG/ReJx7MC5ohnAJBudGH0sD7iCb5CENLWirMyfwGdvbZ40 U0Pg== X-Gm-Message-State: AO0yUKWWVTrK4R3mGfrq1RGWWBwA1WbOOuI1kw7Z2HxsGHRsGeizHBxk cUhyvf207ZUOaLuNCm31xg2U X-Received: by 2002:a17:903:187:b0:19d:16fa:ba48 with SMTP id z7-20020a170903018700b0019d16faba48mr17970574plg.28.1678202064462; Tue, 07 Mar 2023 07:14:24 -0800 (PST) Received: from localhost.localdomain ([59.97.52.140]) by smtp.gmail.com with ESMTPSA id t8-20020a17090340c800b0019c2cf12d15sm8549332pld.116.2023.03.07.07.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 07:14:23 -0800 (PST) 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 v2 0/7] Add support for MHI Endpoint function driver Date: Tue, 7 Mar 2023 20:44:09 +0530 Message-Id: <20230307151416.176595-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?1759722933684682833?= X-GMAIL-MSGID: =?utf-8?q?1759722933684682833?= 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 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/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 +- 11 files changed, 539 insertions(+), 6 deletions(-) create mode 100644 drivers/pci/endpoint/functions/pci-epf-mhi.c