From patchwork Thu Feb 25 22:23:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 8427031 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 235329F52D for ; Thu, 25 Feb 2016 22:25:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4994920268 for ; Thu, 25 Feb 2016 22:25:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 764AC2024C for ; Thu, 25 Feb 2016 22:25:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZ4Ji-0008Ig-Ch; Thu, 25 Feb 2016 22:23:26 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZ4Je-0008DJ-Ef for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2016 22:23:23 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u1PMN0vW014341; Thu, 25 Feb 2016 16:23:00 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1PMN0AR019509; Thu, 25 Feb 2016 16:23:00 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Thu, 25 Feb 2016 16:22:59 -0600 Received: from ula0868495.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1PMMxD5020680; Thu, 25 Feb 2016 16:22:59 -0600 From: Murali Karicheri To: , , , , Subject: [PATCH] PCI: keystone: fix msi code that retrieves the pp struct ptr Date: Thu, 25 Feb 2016 17:23:04 -0500 Message-ID: <1456438984-22111-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160225_142322_602238_F0E56D9D X-CRM114-Status: GOOD ( 12.88 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Recent update to pcie-designware core driver, commit "cbce79005 PCI: designware: Make driver arch-agnostic" broke the keystone PCI driver. This is because, the way pp struct ptr is retrieved from msi desc has changed and require similar update in pci-keystone-dw.c as well. This patch fix this issue. Here is the early boot crash log seen on K2E EVM. [ 1.012999] pci 0000:00:00.0: PCI bridge to [bus 01] [ 1.018073] pci 0000:00:00.0: bridge window [io 0x1000-0x1fff] [ 1.024308] pci 0000:00:00.0: bridge window [mem 0x60000000-0x600fffff] [ 1.031216] pci 0000:00:00.0: bridge window [mem 0x60100000-0x601fffff pref] [ 1.038736] Unable to handle kernel NULL pointer dereference at virtual address 00000030 [ 1.046950] pgd = c0003000 [ 1.049750] [00000030] *pgd=80000800004003, *pmd=00000000 [ 1.055265] Internal error: Oops: 206 [#1] PREEMPT SMP ARM [ 1.060860] Modules linked in: [ 1.064013] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.2-00139-gb74f926 #2 [ 1.071266] Hardware name: Keystone [ 1.074853] task: eb888000 ti: eb890000 task.ti: eb890000 [ 1.080364] PC is at ks_dw_pcie_msi_irq_unmask+0x24/0x58 [ 1.085785] LR is at ks_dw_pcie_msi_irq_unmask+0x18/0x58 [ 1.091206] pc : [] lr : [] psr: 60000093 [ 1.091206] sp : eb891bc8 ip : 00000000 fp : ebb15010 [ 1.102915] r10: 00000051 r9 : 60000013 r8 : ebafaa20 [ 1.108247] r7 : ebaa9f80 r6 : eb9fd0c0 r5 : ebafa9d0 r4 : ebafa9c0 [ 1.114889] r3 : 00000051 r2 : 00000000 r1 : 00000001 r0 : ebb14c18 [ 1.121533] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel [ 1.129049] Control: 30c5387d Table: 00003000 DAC: fffffffd [ 1.134905] Process swapper/0 (pid: 1, stack limit = 0xeb890210) [ 1.141023] Stack: (0xeb891bc8 to 0xeb892000) Signed-off-by: Murali Karicheri --- - Need this fix in 4.4.4 as well drivers/pci/host/pci-keystone-dw.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/pci/host/pci-keystone-dw.c b/drivers/pci/host/pci-keystone-dw.c index ed34c95..6153853 100644 --- a/drivers/pci/host/pci-keystone-dw.c +++ b/drivers/pci/host/pci-keystone-dw.c @@ -58,11 +58,6 @@ #define to_keystone_pcie(x) container_of(x, struct keystone_pcie, pp) -static inline struct pcie_port *sys_to_pcie(struct pci_sys_data *sys) -{ - return sys->private_data; -} - static inline void update_reg_offset_bit_pos(u32 offset, u32 *reg_offset, u32 *bit_pos) { @@ -108,7 +103,7 @@ static void ks_dw_pcie_msi_irq_ack(struct irq_data *d) struct pcie_port *pp; msi = irq_data_get_msi_desc(d); - pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi)); + pp = (struct pcie_port *) msi_desc_to_pci_sysdata(msi); ks_pcie = to_keystone_pcie(pp); offset = d->irq - irq_linear_revmap(pp->irq_domain, 0); update_reg_offset_bit_pos(offset, ®_offset, &bit_pos); @@ -146,7 +141,7 @@ static void ks_dw_pcie_msi_irq_mask(struct irq_data *d) u32 offset; msi = irq_data_get_msi_desc(d); - pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi)); + pp = (struct pcie_port *) msi_desc_to_pci_sysdata(msi); ks_pcie = to_keystone_pcie(pp); offset = d->irq - irq_linear_revmap(pp->irq_domain, 0); @@ -167,7 +162,7 @@ static void ks_dw_pcie_msi_irq_unmask(struct irq_data *d) u32 offset; msi = irq_data_get_msi_desc(d); - pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi)); + pp = (struct pcie_port *) msi_desc_to_pci_sysdata(msi); ks_pcie = to_keystone_pcie(pp); offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);