Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3720529imj; Tue, 12 Feb 2019 03:35:37 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaff86OcsgSuQ5nN6wkbdhgaXDhjG1lGEBbhPOg4KBqmWqBqfQoUIO7zV0MEWeFk1TRTWQv X-Received: by 2002:a65:6110:: with SMTP id z16mr3270533pgu.330.1549971337362; Tue, 12 Feb 2019 03:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549971337; cv=none; d=google.com; s=arc-20160816; b=wD/vT856T6cMhV1IA8wbpC5DhuiS0uMwz8fXQzNwUyfPaFKd2iXDuxKTJhgHQlbk8k 7GGI2iT5IJFnpboUXXJAILX1Q7btzcB6QPytFALnbCYeIa863bCivQAfBnhUVlaBwCCt 4DyY3gHcXBEkQ+6s2mkFLqTjZbjwt9lupCP1p0KxhPNXcZfmKhkXBhl4lOH3upihNyD5 /kWv1ME9xKeyB1YBXA+hNdtuWJZmW5ao2qQL7aXwoULhYKBDZFNUugPYHvr7lvPiPV4O z62Dn8wB/7moPj/Eqidt+kM8zgZ1RGID5ZyyAVv0FysvSMjKIZ/45OaCABsQDyRaTd5D d0Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=iY0fi1I2QJNrxX4GFY2GbhCo3x2bQ4TgM9gjKU6uPlU=; b=x7mfytTKhGOyOauTzZ2IMzY6Tpe2qCAtrCtMuSFN2FJ7jGBnHXgZuDaDZOrqbPbRjP yMcmdWSnLw/CyeL9xC3CE5FIosnxeQxtHpsg/HUHvRWjUrr0VrlZJ8PblJFMRuk5lMkI A85Ue++0apLRck4jIOuSiahn2ZaFPzoCQ/9hMYZe3Qj2zSYpdnBRneTpy+6Ui0afO+cu 6I5Hq3uxM/1RVy1ZEiKl5aUD/wU1AZegYi6F/OiSvqJ2HAP5DJoHKl1mNVYQL4k0H+4S iT1S2xE/6sy0xQ50Plxo2K0xEWAlI7Qf74yk3+hvSglwRby0QaHxCNOXyzbhHHCsPeLB R/aQ== 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 y3si11616229pgp.48.2019.02.12.03.35.21; Tue, 12 Feb 2019 03:35:37 -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 S1728362AbfBLLdK (ORCPT + 99 others); Tue, 12 Feb 2019 06:33:10 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36160 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfBLLdK (ORCPT ); Tue, 12 Feb 2019 06:33:10 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21FE280D; Tue, 12 Feb 2019 03:33:10 -0800 (PST) Received: from red-moon (red-moon.cambridge.arm.com [10.1.197.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7966D3F589; Tue, 12 Feb 2019 03:33:08 -0800 (PST) Date: Tue, 12 Feb 2019 11:33:06 +0000 From: Lorenzo Pieralisi To: Lucas Stach Cc: Bjorn Helgaas , Stefan Agner , jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, tpiepho@impinj.com, leonard.crestez@nxp.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] PCI: imx6: limit DBI register length Message-ID: <20190212113257.GA23658@red-moon> References: <14fafdf52d19feb9c926c312f4e3ba7ff8a4bad9.1549446867.git.stefan@agner.ch> <119211b4f2e9ada55b86041d009656e49c2b5281.1549446867.git.stefan@agner.ch> <20190211213900.GA247873@google.com> <1549961694.2546.18.camel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1549961694.2546.18.camel@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 12, 2019 at 09:54:54AM +0100, Lucas Stach wrote: > Hi Bjorn, > > Am Montag, den 11.02.2019, 15:39 -0600 schrieb Bjorn Helgaas: > > On Wed, Feb 06, 2019 at 10:57:32AM +0100, Stefan Agner wrote: > > > 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 > > > ? ... > > > > I assume this problem happens when using the pci_read_config() path or > > something similar? > > > > Could this be solved using pci_dev.cfg_size instead of building a new > > dwc-specific mechanism???There are some quirks that set dev->cfg_size > > to keep from reading past certain points in config space, e.g., > > quirk_citrine(), quirk_nfp6000(). > > > > I'm not necessarily opposed to doing it in dwc, but maybe there's some > > advantage in reducing the number of ways of doing the same thing. > > This actually started out as a quirk changing the cfg size. But the > valid config space size seems to be different between root ports that > share the same (broken) device ID (Synopsys abcd), so I doubt that this > would be easier and/or any cleaner to implement as a quirk. There are two things here: matching the root port and setting the cfg size limit. I agree with Bjorn that the cfg size limit, given that it is implemented in core code should be leveraged instead of reinventing the wheel to solve the same problem in driver specific code. In the quirk code I do not think it is that complicated to retrieve the IMX variant to apply the quirk accordingly on the pci_dev. Please let me know if that's feasible so that I can drop the patches from the branch and update it with a new version. Thanks, Lorenzo