Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3980300pxj; Tue, 15 Jun 2021 12:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkIF+kgERRUCngeE6B3LQhKmdvSRdOI477VhbTWNPfpmZDEk07pJFAYKTwK6hXPKY9hQo0 X-Received: by 2002:aa7:d413:: with SMTP id z19mr1517877edq.37.1623786222587; Tue, 15 Jun 2021 12:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623786222; cv=none; d=google.com; s=arc-20160816; b=FaZ6izZPEOiu3WeR0/DApvCOqtjjTsgNgefsirDgXAXQKP0Imcz/94ctbfgfVdWjKC vCJvUD+0oB1YROoVzhlcqXSPf7HtxUUNyLXd3c5RAqq2/u88mUA2GviE5TB0uhtKtZWT Urdk3XeN3aeL0IN0Y7Qk5f0TS9i608i8aOk+XMVNW60HjBsODJ2/mdyASFbFUQgNU+Uq 2UcP4z3EQLsvmeei0Q7ktj8Gc3bY+MUqL4Mq1Uc4HdndKhi4NpCBLx0RbxmwnmxMWkS+ JWTcm/24Db7lzxVXQ+/jEHaxPxGWwBIIr5Nfdbui1C7e1e6Z9QQL9awbhRoCm4km0hTl c8rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=ayCH7YahuC/28uuZw2TeZINzURK+i1dHUK8rip+cN9k=; b=CuILgM6woBjy4hF5uT4cCuZ0tVA9t3WLrZw3Q5LYT4rFFE9mzan9+hcII+zX8JPl0g jyWEo8DO5W+AZXFOUm48nrINT9J3jJBmfQCbE4qA9CdK1wExQeLv7bstAauipGUv6bFt JmCPfAkE8KirsDMNIWNdGflbuWoNtPsl6zj0dRrcrRBX8xlGOVjVsX7FVpHI8SG5YvB3 Pz/GwS7RuhfI5iMvWImfDdhWZ++qlIZLWedGstQdCJ+cwo+fSA6QIgnioJ8hsGJ8Umam 3IbLuxQKG2rDB5MVD2kwpa5pJOTGLMRiz8vKxIVhUfof74ch/XybRtaen2VoKpu6fhhL tkGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X8WBzy5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si2804509ejl.365.2021.06.15.12.43.19; Tue, 15 Jun 2021 12:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X8WBzy5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbhFOToR (ORCPT + 99 others); Tue, 15 Jun 2021 15:44:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:33052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbhFOToQ (ORCPT ); Tue, 15 Jun 2021 15:44:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 060B261166; Tue, 15 Jun 2021 19:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623786131; bh=F7vbSprOP5Rudz4mCUZIL34WYECvKuqqAhRsSQFYsyo=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=X8WBzy5JguRPGV3D65bv6IZ3C+Tud3fIsIiQVU4QjPBOn1VLl8NKFd4HoLJdIFqrz BpnR+DZV8X4/zBxMFDUPcbrmnFpDxe7O0JQuulOM3rcdsItfiRNGwFegFv9o7X5m5l wHpmJhNVC+OB24rFnFoJzxskveEXsAa9N9qk+StXgVwOEtjSekoF+rDGcke/IamgMN kr+bvlxXxcn4DfYW6lW5KBe05UjCQ6KV+67uWp6Nk7SNO7/doLJi+GNr/7iIN1PyVO cQaC4r+E94/3s7Ct0c+LCxWL8moqaNYAR/j6E2aNaPrfquUDn2hOJq7isvW/KER/bq wM8z+QIkprkag== Date: Tue, 15 Jun 2021 14:42:09 -0500 From: Bjorn Helgaas To: Jon Hunter Cc: Vidya Sagar , lorenzo.pieralisi@arm.com, bhelgaas@google.com, robh+dt@kernel.org, amurray@thegoodpenguin.co.uk, gustavo.pimentel@synopsys.com, jingoohan1@gmail.com, Joao.Pinto@synopsys.com, Thierry Reding , Krishna Thota , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Query regarding the use of pcie-designware-plat.c file Message-ID: <20210615194209.GA2908457@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2970bdf2-bef2-bdcb-6ee3-ac1181d97b78@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 09, 2021 at 05:54:38PM +0100, Jon Hunter wrote: > > On 09/06/2021 17:30, Bjorn Helgaas wrote: > > On Wed, Jun 09, 2021 at 12:52:37AM +0530, Vidya Sagar wrote: > >> Hi, > >> I would like to know what is the use of pcie-designware-plat.c file. This > >> looks like a skeleton file and can't really work with any specific hardware > >> as such. > >> Some context for this mail thread is, if the config CONFIG_PCIE_DW_PLAT is > >> enabled in a system where a Synopsys DesignWare IP based PCIe controller is > >> present and its configuration is enabled (Ex:- Tegra194 system with > >> CONFIG_PCIE_TEGRA194_HOST enabled), then, it can so happen that the probe of > >> pcie-designware-plat.c called first (because all DWC based PCIe controller > >> nodes have "snps,dw-pcie" compatibility string) and can crash the system. > > > > What's the crash? If a device claims to be compatible with > > "snps,dw-pcie" and pcie-designware-plat.c claims to know how to > > operate "snps,dw-pcie" devices, it seems like something is wrong. > > > > "snps,dw-pcie" is a generic device type, so pcie-designware-plat.c > > might not know how to operate device-specific details of some of those > > devices, but basic functionality should work and it certainly > > shouldn't crash. > > It is not really a crash but a hang when trying to access the hardware > before it has been properly initialised. This doesn't really answer my question. If the hardware claims to be compatible with "snps,dw-pcie" and a driver knows how to operate "snps,dw-pcie" devices, it should work. If the hardware requires initialization that is not part of the "snps,dw-pcie" programming model, it should not claim to be compatible with "snps,dw-pcie". Or, if pcie-designware-plat.c is missing some init that *is* part of the programming model, maybe it needs to be enhanced? > The scenario I saw was that if the Tegra194 PCIe driver was built as a > module but the pcie-designware-plat.c was built into the kernel, then on > boot we would attempt to probe the pcie-designware-plat.c driver because > module was not available yet and this would hang. Hence, I removed the > "snps,dw-pcie" compatible string for Tegra194 to avoid this and ONLY > probe the Tegra194 PCIe driver. Maybe something like driver_override (I know this is supported via sysfs, but maybe not via a kernel parameter) or a module parameter for pcie-designware-plat.c to keep it from claiming devices? > Sagar is wondering why this hang is only seen/reported for Tegra and > could this happen to other platforms? I think that is potentially could. Maybe pcie-designware-plat.c works on other platforms, i.e., they don't require the hardware init?