Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp797425imu; Tue, 20 Nov 2018 07:08:06 -0800 (PST) X-Google-Smtp-Source: AJdET5fllf5hPla+Ml3hZKTeowA8w7nCdLczb4Gql8db6ph9C7GJpvJk/x7MGbIbGHuSgCqokK+n X-Received: by 2002:a62:3501:: with SMTP id c1-v6mr2504558pfa.173.1542726486888; Tue, 20 Nov 2018 07:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542726486; cv=none; d=google.com; s=arc-20160816; b=0YNSRbk154zDibRQmJUYNpDF2FtnC1ADmQXVm/h1BoR+SdcK/28s7hU/EPWor36M/a qp9MdVtenEryGZsdUv97ObceJYRnX7yb88EOjYY2BnSqAh4UgyZqrJ3CyZoK/WtTlfUb cSAPitBKboS8ToErgJkmXIOLI4EudLi6xfRFa3rgD8g2hMdGDu+YpeRKUfAmOG3Xtffu Ajlfk2mJxYURLqBHFblxPizqPN6enSpvR2yBl123EOHOF4uxFK6BuGe3m99rVJf9VaAo ajl6nG1inwmBGcQOHy5U8FRf0k9bbIpQEx/9fWkaSH+0824c3xaFa+YjhlmmfNTEH+G2 FjrQ== 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:date:cc:to:from:subject:message-id; bh=AalfyaTKmKgXVd0D6AxM/x1aB59E+Fs7402cr+DpcrY=; b=ez2A/jaeXXBJlVYqLk2sXLiVM3CI6b97RPpPjIt9FOBy/yaVB6SEZAfAsvLxRzcG8k 65TJ1E2jPOQSu2LNSowwMTxi8ns3efQrH9nElIobtSM6H9bo4U7ZVATLB7TzaSRXdEE+ V8ZrnJkHgdD4fmQf2grkybQM9B0v/jdQwSt5YU46wQFV6nUuftGWQxQDtGIsucAtBFKN FkIaRK4r9twiGkMbtMH2+rfiQvLkEfiQnQTMU9v/XVOFoqEzYly8K3SP5HnfgnJfLuwV C3TVANw1OMN24ktdRz9ZPkHlyBtwqzzCT67lu4Vj7OA9mFbPF9KGz2Q5YlVhpwIZH9gk Gqag== ARC-Authentication-Results: i=1; mx.google.com; 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 g7-v6si11266376plp.130.2018.11.20.07.07.46; Tue, 20 Nov 2018 07:08:06 -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; 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 S1727457AbeKUBGe (ORCPT + 99 others); Tue, 20 Nov 2018 20:06:34 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:46675 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbeKUBGe (ORCPT ); Tue, 20 Nov 2018 20:06:34 -0500 Received: from kresse.hi.pengutronix.de ([2001:67c:670:100:1d::2a]) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1gP79C-0008KW-1b; Tue, 20 Nov 2018 15:37:02 +0100 Message-ID: <1542724621.2508.16.camel@pengutronix.de> Subject: Re: [PATCH v2 3/3] PCI: imx6: limit DBI register length From: Lucas Stach To: Stefan Agner , jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, tpiepho@impinj.com Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 20 Nov 2018 15:37:01 +0100 In-Reply-To: <20181120132705.6917-3-stefan@agner.ch> References: <20181120132705.6917-1-stefan@agner.ch> <20181120132705.6917-3-stefan@agner.ch> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::2a X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Dienstag, den 20.11.2018, 14:27 +0100 schrieb Stefan Agner: > 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 > --- >  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 },