Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3693611imu; Mon, 28 Jan 2019 09:09:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7zx9f4d7MEc9puxJMw9tmnTJzck2whxf855jx4T48PQfl0zV/47BgZVY+g20Ol5v9Iid4m X-Received: by 2002:a17:902:7448:: with SMTP id e8mr21775651plt.120.1548695391778; Mon, 28 Jan 2019 09:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695391; cv=none; d=google.com; s=arc-20160816; b=ZxrxIZ5OQN4lBFTdt+1o66jiufm/jHXGzqrGFW05dBbK3lXFmK7vOsMgug5j7xY4QG v0rBbcWiwjUndT92HSG08JBtDnGnvSjUwwWHkNDyi5wMBukahxjxmUwdta1XpcXsWLpo oIAobpli/wa7QyJQfFf/0f44H/Vyc5VVYE2HVgCZOY+SxSung7YEJcWNTwYOcGTGNKRS cii1wKRLIvNCXoF3ksxmSuJoSLSIsaeiiOQOKmFvllDEQBhs3A0+o5FQxsPS5t+di6rL rIUEPPZGlnOWiNIRWz8+bqdfNp5GD0si1SEOBH7w6MUAFKZhb6KInVIuJgQZHMB9az+W Fqqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EVhlSjB8ZhqZSSZllz25ppMZfAGbhfokKky2ZOaZ5OA=; b=gO3PKPkEX2n/ATst7UDIvhvZd3akTapMOPE872H8sqjBe7Ta8aKNo5G6ziI9PwBEs3 Aocrg1FGGMulZBsiACzsLjFX2jTLYimEddy/KFAdT/zg9DW7pwo4FJ3AKpQhXK9oIO1h h9IGS5IqleD5ox29+Zu/jJ1FymJ23svenP/xXJUhMqpLzbhiLV0D+fi0FWFVIVmc2Dnb x0iWoO2TLZK9Kp/7FDdubZwoFyRmPuaqQ+mxkWazBMmwAqe9uUd65ejehPgNS8y3TsYX nqlKpHD1XytxI/mvj3yMhTYRqAtzPioKHUHeP6KWOYPQPWnSqg+yDD8njqVjt1SJbQ+2 ju9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v8WBKy8J; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 124si34187361pgg.397.2019.01.28.09.09.36; Mon, 28 Jan 2019 09:09:51 -0800 (PST) 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=@kernel.org header.s=default header.b=v8WBKy8J; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732289AbfA1QLW (ORCPT + 99 others); Mon, 28 Jan 2019 11:11:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:38238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732946AbfA1QLU (ORCPT ); Mon, 28 Jan 2019 11:11:20 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E640F21848; Mon, 28 Jan 2019 16:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691879; bh=uw0z4E7PVxrvOp0CHfm/JYgC63VqKPLLD3oM5p4QVAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v8WBKy8JS8lTc1sjadinweOqCX+KQOsOEd3PAQBLkL+2ScaDLxbIZA8NPvkeCbgSG 4YlVPwSeOopeZFVnjcoE6La/S/oy0vj1S1xniL/+xAGTfajG37hl5HVZv7C9Q+09Z/ imb2bT6qHC/HDmAj4xlgW03m9EeRMdA1CaEkOXD0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Richard Zhu , Bjorn Helgaas , Sasha Levin , linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 246/258] PCI: imx: Enable MSI from downstream components Date: Mon, 28 Jan 2019 10:59:12 -0500 Message-Id: <20190128155924.51521-246-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Richard Zhu [ Upstream commit 75cb8d20c112aba70f23d98e3f8d0a38ace16006 ] The MSI Enable bit in the MSI Capability (PCIe r4.0, sec 7.7.1.2) controls whether a Function can request service using MSI. i.MX6 Root Ports implement the MSI Capability and may use MSI to request service for events like PME, hotplug, AER, etc. In addition, on i.MX6, the MSI Enable bit controls delivery of MSI interrupts from components below the Root Port. Prior to f3fdfc4ac3a2 ("PCI: Remove host driver Kconfig selection of CONFIG_PCIEPORTBUS"), enabling CONFIG_PCI_IMX6 automatically also enabled CONFIG_PCIEPORTBUS, and when portdrv claimed the Root Ports, it set the MSI Enable bit so it could use PME, hotplug, AER, etc. As a side effect, that also enabled delivery of MSI interrupts from downstream components. The imx6q-pcie driver itself does not depend on portdrv, so set MSI Enable in imx6q-pcie so MSI from downstream components works even if nobody uses MSI for the Root Port events. Fixes: f3fdfc4ac3a2 ("PCI: Remove host driver Kconfig selection of CONFIG_PCIEPORTBUS") Signed-off-by: Richard Zhu Signed-off-by: Bjorn Helgaas Tested-by: Sven Van Asbroeck Tested-by: Trent Piepho Reviewed-by: Lucas Stach Acked-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pci-imx6.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 975050a69494..3826b444298c 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -66,6 +66,7 @@ struct imx6_pcie { #define PHY_PLL_LOCK_WAIT_USLEEP_MAX 200 /* PCIe Root Complex registers (memory-mapped) */ +#define PCIE_RC_IMX6_MSI_CAP 0x50 #define PCIE_RC_LCR 0x7c #define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN1 0x1 #define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2 0x2 @@ -682,6 +683,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) struct resource *dbi_base; struct device_node *node = dev->of_node; int ret; + u16 val; imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); if (!imx6_pcie) @@ -816,6 +818,14 @@ static int imx6_pcie_probe(struct platform_device *pdev) if (ret < 0) return ret; + if (pci_msi_enabled()) { + val = dw_pcie_readw_dbi(pci, PCIE_RC_IMX6_MSI_CAP + + PCI_MSI_FLAGS); + val |= PCI_MSI_FLAGS_ENABLE; + dw_pcie_writew_dbi(pci, PCIE_RC_IMX6_MSI_CAP + PCI_MSI_FLAGS, + val); + } + return 0; } -- 2.19.1