Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2658767imj; Mon, 11 Feb 2019 06:36:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IaEfA5LlLP2Wyu2tSgsD0a774An6tNhLhcRrq4stjdtD3qaH+3/CQEAesbZFB/MkY5CHkUc X-Received: by 2002:a63:cc4e:: with SMTP id q14mr33500727pgi.291.1549895765540; Mon, 11 Feb 2019 06:36:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895765; cv=none; d=google.com; s=arc-20160816; b=MgRFvRV1YCNp7G31Nvv9f+C4QYuxFe5uvXY7xR1M/MrxaRKQsVkuqNsh9xAxQqHGvh qIgBq6mNEibpQA5l4ugqu+9I18oDttjCHMlOwBBk6mKjB86QVI173qsQ/rTw/8uePS3r eEP2qc+We0RAFneyelxy7CbqC+cQuBcn50JcxxcLWqgV1kKPQfSnjyv1553FmehRfqdm IlQ6lpMoXIC1QRKbHIp8VzkkNgUhIxv2vdf7jl8P667l8CdKVXhw6ph/tmesbKpdZmZT 2jg2KID24psQZjm79BXSnkbUqO0W1xWzF2IE5hhePBcxTKTuNLa0CdVu2WFGl5JlJwQY moBw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L3/sWc/da4G1obz7oM8s/42NdmEHEPNa4X+SRItj1sM=; b=P1x25dA0vFo3M87OubmwIGEwLkUYapvQB06hS0cB7tgdUgjqSNKk3BZALj+4vGKZ3Y I3QusYMfRcJ6Zf+jv0Qa6l7fDk/PK0QJQaHdPzpUJdvnqxSCESq7SK2325HjgqxMYkcu Rh2dBxkx+ppHaHZqhYqFjMj1B6/3KfERQGIEUmLkc5BiGlyx7Oxt9B9Zo/l0ok8hcV/m VRdLx/NU+gXfH0LCuKGZn+XGgWexWict0TjOstl8eAONjh8pRP8tghIM3Ddz1Afqlpic b37HkbKRX17/rcvSzbf3AQzS397kqxCLzDsL0hI+0ZbyA0c8FMU6EEqNhj6UJF6bx4aO 3jRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ESQ1uX8g; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p126si9685495pgp.529.2019.02.11.06.35.48; Mon, 11 Feb 2019 06:36:05 -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=ESQ1uX8g; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730967AbfBKOfG (ORCPT + 99 others); Mon, 11 Feb 2019 09:35:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:43578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730620AbfBKOfD (ORCPT ); Mon, 11 Feb 2019 09:35:03 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 897D7204EC; Mon, 11 Feb 2019 14:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895703; bh=Zn9JiRD1ga91bt9+izdjohaVEZpbLMNbcTT02MTffs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ESQ1uX8gKW56G5pELIeE1fKOqMT6B2NIUD71/XcjCcEq3xhIoxqUV6ZgHZte7G+tv kKR/HBmmiGH9XnWW1E+fomd50gnvMCrI63lvBueeSyeNkt1H4COKPm+tyja11EuKXA +txO7DPbBT6lKJ3LetCubtVizeYT2PkXzo4tN4w0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Zhu , Bjorn Helgaas , Sven Van Asbroeck , Trent Piepho , Lucas Stach , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 4.20 277/352] PCI: imx: Enable MSI from downstream components Date: Mon, 11 Feb 2019 15:18:24 +0100 Message-Id: <20190211141904.588959791@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 88af6bff945f..6b54528b5f0c 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -67,6 +67,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 @@ -840,6 +841,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) @@ -981,6 +983,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