From patchwork Mon Jan 10 01:50:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 12708119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7FADC433F5 for ; Mon, 10 Jan 2022 01:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oV5qKzJ7zI5GEQdCzYbznPtgUlgeOYBZkE3NVR0gs/Y=; b=R6VDI4rt0evTDE LJvrbemMfobyGOjSHuA+Ybqbg+MfC7uZV22/HpOBvjdxO8IzyZw7/ezp0JtA9XqhACNnqumWmnmP1 sy0KJYItY5GDX7OD32XGkepxozOMugd0mZPYFKrH/Hh6I5P5RiK2voTDKUej6H5Sogj8kR51iyapO 0dSuxvG2kaT9o8dzFJYJSdJHuBBnb8Vx+G/YkYfP3qlV6eJktTqgvMdLS8QaZ1T7cXe8UMtUlKp+r esGIRyc9rjI9lZG01515WYnid0+wPDdeUzBX82BsCOVKb0aytBXAYhtfHQZHXtaZilpiudZRfwSZv J2CIX9u/xHgidFhpZtuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6jwd-008pwS-8M; Mon, 10 Jan 2022 01:57:59 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6jpp-008llh-Uh for linux-arm-kernel@lists.infradead.org; Mon, 10 Jan 2022 01:50:59 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D93760F61; Mon, 10 Jan 2022 01:50:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28CD0C36AF5; Mon, 10 Jan 2022 01:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641779456; bh=dTXgpWiybwA/hCGFY5arTv+LKbZ+aZewd6YanDfyWEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bria5oNNYw5PUQKTKUWUEvjvkv3ubiXrESFz7qIK9VEDpA45nOT1Ch10pR+PEHuy/ tTU2J8Kr9EEx4tTkUp7VDzC0Q96m9va8X3PJkOPnLtwB7JQAp5BLtFTPoCFwBF7fcC IadTwCro5Ll6RmV94Qr/sc6Mgtl7teyfqrmoq+pOW0Qtqsoi/9wbg73qmXufI/PqPy HSIHn2q7Z7fokq2I1VMZ36GxyA+RKJ+czveNtyGkishYdlRkdZ1Ex05BdQL6gwo55b DmcYWzNXb1SojJBIfEx7JzT/30mkAMRkGpM4c0CsOul6wthh1W8pqvu9k/gWwOXuUo cuRkCOxp05Q2A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Marc Zyngier , Lorenzo Pieralisi , Bjorn Helgaas Cc: pali@kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH v2 16/23] PCI: aardvark: Add support for PME interrupts Date: Mon, 10 Jan 2022 02:50:11 +0100 Message-Id: <20220110015018.26359-17-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220110015018.26359-1-kabel@kernel.org> References: <20220110015018.26359-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220109_175058_101297_4394AC8C X-CRM114-Status: GOOD ( 13.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Pali Rohár Currently enabling PCI_EXP_RTSTA_PME bit in PCI_EXP_RTCTL register does nothing. This is because PCIe PME driver expects to receive PCIe interrupt defined in PCI_EXP_FLAGS_IRQ register, but aardvark hardware does not trigger PCIe INTx/MSI interrupt for PME event, rather it triggers custom aardvark interrupt which this driver is not processing yet. Fix this issue by handling PME interrupt in advk_pcie_handle_int() and chaining it to PCIe interrupt 0 with generic_handle_domain_irq() (since aardvark sets PCI_EXP_FLAGS_IRQ to zero). With this change PCIe PME driver finally starts receiving PME interrupt. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- drivers/pci/controller/pci-aardvark.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index e7b9ca31c79c..3f2d570bfbb5 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1487,6 +1487,18 @@ static void advk_pcie_handle_int(struct advk_pcie *pcie) isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); + /* Process PME interrupt */ + if (isr0_status & PCIE_MSG_PM_PME_MASK) { + /* + * Do not clear PME interrupt bit in ISR0, it is cleared by IRQ + * receiver by writing to the PCI_EXP_RTSTA register of emulated + * root bridge. Aardvark HW returns zero for PCI_EXP_FLAGS_IRQ, + * so use PCIe interrupt 0. + */ + if (generic_handle_domain_irq(pcie->irq_domain, 0) == -EINVAL) + dev_err_ratelimited(&pcie->pdev->dev, "unhandled PME IRQ\n"); + } + /* Process ERR interrupt */ if (isr0_status & PCIE_ISR0_ERR_MASK) { advk_writel(pcie, PCIE_ISR0_ERR_MASK, PCIE_ISR0_REG);