Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8474271imu; Tue, 4 Dec 2018 08:56:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wswg22M5P0iEw08dZ+110ngibG8PA2SlvxGq50ntF756Kix3j/ujCkhMhV3n0TBbtd3Eqh X-Received: by 2002:a63:413:: with SMTP id 19mr16059972pge.7.1543942599056; Tue, 04 Dec 2018 08:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543942599; cv=none; d=google.com; s=arc-20160816; b=BtHcrLeCEUiP4K2h/668PbncxDSFfU78Hl+uj9WhDasDne7fJ7vKC7BWMZZRG16/u3 roxZQmFcfzeGDQNqE0yGb+U5tnbOIK1ZYqfP4G4uh6Gdmh2iN/lJGyUcT5MZGuKYbQt1 mUXDwCNYhrWuObaNmpWOB70Un19eNNzk3Otc68RvcuByIyUC9Gp8kT3JkvI4EN7J8P99 D3ke12Wa5mnLTKrPMr9kRwb8h/X/b4RpW+7sPMCw6yB3Kd4QmEtSZ8yZlDebN94RTwzc kreX1VopU1Vr3pv40BTCusR3ymJvhFPmd860lmiOxsa7UqNivmUToas2jRkpdGtr1jhs FMDw== 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=LhdC4oPsx0c5SbbzIOCXLSzbgGLPbjjL7+nHoArKlYE=; b=kqmmu0+mXNSODuM1u8fmPH+fycQ3NJT4oMby+pLetL5V61Tl3nAoVAS1oDeVY/5Vlq OZ+FvtVzSjtQxGNLjYyu0dIlw7BAxCA32ngcq6uXvV0RXQPQdFPevSOkFjypRzOs8O0O qwFhjfFA/88Fuzhqe4luQtubNUDhjGvBd9diwqVq6cc+pugxPv1fhQqMrJhySR2Hup2j Xjs8bwRHrrEPJd3+teC0PEDlIJZStHvJpFsbfl3ntujNzXsjMUB7MINDZ7F3wIfPhTsD nkoYa1DXeq5W/nmX15652G9IR/CV1I01yas7FpR58IJy6UId8hg0ENkl/KhFK1tECaTR wxZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=FhzzqNir; 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 59si19370627ple.291.2018.12.04.08.56.23; Tue, 04 Dec 2018 08:56: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=FhzzqNir; 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 S1727219AbeLDQzl (ORCPT + 99 others); Tue, 4 Dec 2018 11:55:41 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:36344 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726570AbeLDQzg (ORCPT ); Tue, 4 Dec 2018 11:55:36 -0500 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 665FF5C1222; Tue, 4 Dec 2018 17:55:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1543942534; 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=LhdC4oPsx0c5SbbzIOCXLSzbgGLPbjjL7+nHoArKlYE=; b=FhzzqNiru/acAGmljYsC0iWPgAKaSd/UUourb7eS/J4EUjeASLfi+Nvk4F0DZ2UbEXIUxo CrJLQ6N76qqjkq9vGbckbDgDd36SeDpu1EBtir/1iEXJv7sQsaZmRxxilzWCup3QJKton8 fGno7LbDjtLL2patP2MAkXO9hnjag68= From: Stefan Agner To: lorenzo.pieralisi@arm.com, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, l.stach@pengutronix.de, tpiepho@impinj.com Cc: leonard.crestez@nxp.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH v4 3/3] PCI: imx6: limit DBI register length Date: Tue, 4 Dec 2018 17:55:28 +0100 Message-Id: <20181204165528.15534-3-stefan@agner.ch> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181204165528.15534-1-stefan@agner.ch> References: <20181204165528.15534-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 Reviewed-by: Lucas Stach --- Changes in v3: - Rebase on pci/dwc Changes in v4: - Rebase on pci/dwc 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 45cbdf2ccf80..a69eb625ed18 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -43,6 +43,7 @@ enum imx6_pcie_variants { struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; + int dbi_length; }; struct imx6_pcie { @@ -1015,6 +1016,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) break; } + pci->dbi_length = imx6_pcie->drvdata->dbi_length; + /* Grab turnoff reset */ imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); if (IS_ERR(imx6_pcie->turnoff_reset)) { @@ -1086,7 +1089,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