Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp856048imu; Tue, 20 Nov 2018 08:00:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/XlHCLMA1lFwKIi+9Ov3VOQBSrNO4OC5XfL+4Qh47eTskgWmCljkP5Vaq54jyM2CahE8Inq X-Received: by 2002:a63:d005:: with SMTP id z5mr2405864pgf.64.1542729639966; Tue, 20 Nov 2018 08:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729639; cv=none; d=google.com; s=arc-20160816; b=pZCfFjNYEGFsNOOE4z1ZxAEIoREqaKpUt8g3vZ4wAtNUfdqwBBWsEx8npn2dBpgevl 1koDNNNlzGVCPrPInQcNYDfIK/Hqkoatl39VzXo43m2Dw+xUea/nHfsK89hUH5ulGdRx 1+SccMmNTPikKXs9hyFU891nZ1OFRWRPLBy2XHimiSwa549qnoatv9IP6H+J07MpQ/Qs 3ks34Kyk6xaxbPhosScpBY7YQJ2al3Kgvg5EvEIXV5tuNmdqfxT3yCH7x0Gy9jzyoEnq 5ETR0YPRNumob1l1+ShG3KwOPIZwRCj0Xailppe0LAjowCYezs4TvD3ByH57cTPJ7BSq hXxQ== 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=K7rDdsRBxzLSxyHmL1i9ojUubg1idCe5WOAmjcZYgLw=; b=Dhvv/sGEIoJzhOZ3g/6t1TmiTmvzKUZ/JKiUrCAD7qULpxI1Za9VfkeLQYDVdsdnKA pzjt3TBV+HObaG6FXm2k5akZYUj1tkoFks6SP1UfNm7GWrflpzzB0HUy4aEl/uqJvgHx RCvZxCeym015IjmunJITnT2Ex41jChuOmASbcOKUrMjbH4st7aRBhFzOxkXy0XRQ3fqZ X7inBWEGqYBwybTbqHW9lMSZ7mflYWu3LFpKE9eeeXgyJ8WoHBssyGat6kUrgrHZe/xE lY4rLUQ2Z+fuhMxaSpRlyjDu7iGajz0ojdmZhMHutvBWaTCAT9kqxyikyVUqNp6CgDzg FxKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=0GHyHRpN; 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 u23si43101860pgb.66.2018.11.20.08.00.24; Tue, 20 Nov 2018 08:00:39 -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=@agner.ch header.s=dkim header.b=0GHyHRpN; 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 S1728166AbeKTX4U (ORCPT + 99 others); Tue, 20 Nov 2018 18:56:20 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:47292 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727536AbeKTX4T (ORCPT ); Tue, 20 Nov 2018 18:56:19 -0500 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id A83235C2673; Tue, 20 Nov 2018 14:27:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1542720429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K7rDdsRBxzLSxyHmL1i9ojUubg1idCe5WOAmjcZYgLw=; b=0GHyHRpNCj1WLOCzvICmmsO3eKN9j6BssqU6E8uomUgJKVqi3yMu8+UngiAFGqNIYj1yDg kmeMEkRzP/kHCZRZ72THjfFb3gS4w+tMmg67cOFQMFI52KZw6pFrGjI5SVulTZhULr5gVy 1Mj6G8NrqJnj6dlUrXoPilouz9CricU= From: Stefan Agner To: jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, l.stach@pengutronix.de, tpiepho@impinj.com Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH v2 3/3] PCI: imx6: limit DBI register length Date: Tue, 20 Nov 2018 14:27:05 +0100 Message-Id: <20181120132705.6917-3-stefan@agner.ch> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181120132705.6917-1-stefan@agner.ch> References: <20181120132705.6917-1-stefan@agner.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Define the length of the DBI registers. This makes sure that the kernel does not access registers beyond that point, avoiding the following abort on a i.MX 6Quad: # cat /sys/devices/soc0/soc/1ffc000.pcie/pci0000\:00/0000\:00\:00.0/config [ 100.021433] Unhandled fault: imprecise external abort (0x1406) at 0xb6ea7000 ... [ 100.056423] PC is at dw_pcie_read+0x50/0x84 [ 100.060790] LR is at dw_pcie_rd_own_conf+0x44/0x48 ... Signed-off-by: Stefan Agner --- drivers/pci/controller/dwc/pci-imx6.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 7ac1a639fe91..41d6127b40ad 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -41,6 +41,7 @@ enum imx6_pcie_variants { struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; + int dbi_length; }; struct imx6_pcie { @@ -779,6 +780,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) break; } + pci->dbi_length = imx6_pcie->drvdata->dbi_length; + /* Grab GPR config register range */ imx6_pcie->iomuxc_gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); @@ -839,7 +842,7 @@ static void imx6_pcie_shutdown(struct platform_device *pdev) } static const struct imx6_pcie_drvdata drvdata[] = { - [IMX6Q] = { .variant = IMX6Q }, + [IMX6Q] = { .variant = IMX6Q, .dbi_length = 0x15c }, [IMX6SX] = { .variant = IMX6SX }, [IMX6QP] = { .variant = IMX6QP }, [IMX7D] = { .variant = IMX7D }, -- 2.19.1