Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3105721lqp; Mon, 25 Mar 2024 21:59:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXnjiI90LHayj5u0JGuuYnQcgjsf715O6i5NsZiwmMyi/IfY7oIFQye4LdZQxY9NTMr85LG3Ui1x+pXpAF6pPT2j3td4SGJ8sR+JfFnqw== X-Google-Smtp-Source: AGHT+IGrSd1CxmGfBfjSPfVlU7Y9tmlR6UYVPj8CJ31PASxR+YtxG0dMcs3uZySgXtKQAckBsEbB X-Received: by 2002:a05:6214:1c83:b0:696:7567:ef74 with SMTP id ib3-20020a0562141c8300b006967567ef74mr9229667qvb.27.1711429183889; Mon, 25 Mar 2024 21:59:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711429183; cv=pass; d=google.com; s=arc-20160816; b=iUImxI+PEDj1yHWd3qXgtWQEGFotF+oEQCWKp1Y0ht7a7Y0bDGStKjP7NmS/UhRYpA zouHprD5ydq3JdfpP4In/BTvmQ+SwXgDAf2Dp9+gESXbJ5/Kb66sMWHdminmlVI4o0DN G47RFCf+hsVwxqszsvL/ZG12+2MwxhHtCB4Lp9PEx4bw+WNFRV/kU6v/Hq7l4XELc8BV njiibH0ePOZK8Y1B7x/NlNgo56SwDortG0hxck0jUMq2mmuu6QiV7DJnCnD3ye/XfjbE L8N0gNlyhBASJYvP0t4DvMpuy/Kindc5mzZIKigOH/V6gNOETFsW9LUs7MLbrR1cBmjW q8mQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cUjb4FFIv54rr7MmbTYuEQBtNz+9FaFMStjEdNaoD9U=; fh=mHDKLm8L89Ka90r1KkrIBNHFEYuGjOxgoSpO6TLdV0M=; b=Ajej/m4/6BpjEGJ3x3B2lOSyPQpcTh2O5K7S+B5gX0K0NdFp/kCIdybBpJz3LNtRtf 9+r2JXEtOoGUaZDsg2i2D4VDGlgNKP4avhTDQ/6fYwVWomMZam1y+6eHMoJ7aoA2iIez VEDeAQgXb4/Q0vTVeSuyrQyx44AM3cQ2r5Dn/stxN5l4JBIeCcfGuMPqeleFyvAQsO4q KdIhp7OrHSrA7rIy+OYSjDGmUNLNVMUhJ8ixkRsLJ6h7GHBcwdOZjMWA2k1evpz3EIGu fuys/Qx86RRPfPQt35iJFTzABEH5fSdEnqpfCLmOgZ1xkH3iBv6rLZQFegfw5P3NX3Tn s88A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aVi8fu7m; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-118365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jq12-20020ad45fcc000000b0069163f623b8si9172850qvb.20.2024.03.25.21.59.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 21:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aVi8fu7m; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-118365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8A5001C2C88F for ; Tue, 26 Mar 2024 04:59:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03AA083CA5; Tue, 26 Mar 2024 04:59:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="aVi8fu7m" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 320C35D905; Tue, 26 Mar 2024 04:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711429174; cv=none; b=Q/k5IS+UlYvdmQEahuKgKU5r7mXRUGp4mOonkcMnpJ7gqhnSEAWMDR81dnldtgKytekmyKt6bLF1TzmP2HLYyomHeHy0PX5wkSddui7DXytaRo6+YQuIl7V+G1FwPevYuT9yQnCLkAsimLlwf+5Fjz7kOZH833RMUraytWc/wis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711429174; c=relaxed/simple; bh=Kk//ja//OckJbGLtdF+s+VPF2oDr7OlrPekj8ig0JWY=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lgEwF36G2pK2T3O59sLMe7ebYK1ybA6kBhMikGFWrvnWIx3ggMYQULGt2BYM/DjSfiGJfnasNmyHV+NZLqoEU2ZYWJ/xn5Rxuj26U4VYr6LdpW1IOrdRqZSPqvs8PjW4fndZlnKIDpd9Li2JVyvkdDRnlgYxk6UTKFIDtnBiebM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=aVi8fu7m; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 42Q4xCWg102011; Mon, 25 Mar 2024 23:59:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1711429152; bh=cUjb4FFIv54rr7MmbTYuEQBtNz+9FaFMStjEdNaoD9U=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=aVi8fu7mnEddy0Tfz30Xi/MNV2qTnyIW/245IyarM3FUwzwYb6s9CGVR1lclYL6QD nj0DECU66JTcSvJsxhxSnhAXjQ4wfBv3wNkbFYSgKDJnNbJKJSdAh2KXq7QO68bG18 Vx2ZxgCQyzNrYYHyFPg0mSQv73PRXuZjlX3aoOtI= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 42Q4xCTI037922 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Mar 2024 23:59:12 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 25 Mar 2024 23:59:12 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 25 Mar 2024 23:59:12 -0500 Received: from localhost (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 42Q4xBbt061615; Mon, 25 Mar 2024 23:59:11 -0500 Date: Tue, 26 Mar 2024 10:29:10 +0530 From: Siddharth Vadapalli To: Niklas Cassel CC: Siddharth Vadapalli , , , , , , , , , , , , , Subject: Re: [PATCH v4] PCI: keystone: Fix pci_ops for AM654x SoC Message-ID: <750df13b-ee2f-4067-a9e0-7fd1ace384cf@ti.com> References: <20240325053722.1955433-1-s-vadapalli@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 On Mon, Mar 25, 2024 at 02:45:09PM +0100, Niklas Cassel wrote: > Hello Siddharth, > > On Mon, Mar 25, 2024 at 05:52:28PM +0530, Siddharth Vadapalli wrote: > > On Mon, Mar 25, 2024 at 12:23:05PM +0100, Niklas Cassel wrote: > > > On Mon, Mar 25, 2024 at 11:07:22AM +0530, Siddharth Vadapalli wrote: > > > > @@ -822,6 +788,23 @@ static int __init ks_pcie_host_init(struct dw_pcie_rp *pp) > > > > if (ret < 0) > > > > return ret; > > > > > > > > > > > + if (!ks_pcie->is_am6) { > > > > > > Perhaps add a comment here stating WHY this is needed for v3.65a (!is_am6). > > > > > > From reading the old threads, it appears that v3.65a: > > > -Has no support for iATUs. iATU-specific resource handling code is to be > > > bypassed for v3.65 h/w. Thus v3.65a has it's own .child_ops implementation, > > > so that pcie-designware-host.c does not configure the iATUs. > > > -v3.65a has it's own .msi_init implementation, so that pcie-designware-host.c > > > does not call dw_pcie_msi_host_init() to configure the MSI controller. > > > > > > While 4.90a: > > > -Does have iATU support. > > > -Does use the generic dw_pcie_msi_host_init(). > > > > > > Considering the major differences (with v3.65a being the outlier) here, > > > I think it would have been a much wiser idea to have two different glue > > > drivers for these two compatibles (ti,keystone-pcie and ti,am654-pcie-rc). > > > > > > Right now the driver is quite hard to read, most of the functions in this > > > driver exist because v3.65a does not have an iATU and does not use the > > > generic DWC way to handle MSIs. Additionally, you have "if (!ks_pcie->is_am6)" > > > spread out all over the driver, to control quite major things, like if you > > > should overload .child_ops, or if you should set up inbound translation without > > > an iATU. This makes is even harder to see which code is actually used for > > > am654... like the fact that it actually uses the generic way to handle MSIs... > > > > > > The driver for am654 would be much nicer since many of the functions in > > > this driver would not be needed (and the fact that you have only implemented > > > EP support for am654 and not for v3.65a). All EP related stuff would be in > > > the am654 file/driver. > > > You could keep the quirky stuff for v3.65a in the existing pci-keystone.c > > > driver. > > > > > > (I guess if there is a function that is identical between the twos, you could > > > have a pci-keystone-common.{c,h} that can be used by both drivers, but from > > > the looks of it, they seem to share very little code. > > > > Thank you for reviewing the patch. I agree that two drivers will be > > better considering the !ks_pcie->is_am6 present throughout the driver. > > However, I hope you notice the fact that commit: > > 6ab15b5e7057 PCI: dwc: keystone: Convert .scan_bus() callback to use add_bus > > introduced a regression in a driver which was working prior to that > > commit for AM654. While there are flaws in the driver and it needs to be > > split to handle v3.65a and other versions in a cleaner manner, I am > > unable to understand why that is a precursor to fixing the regression. > > > > If splitting the driver is the only way to fix this regression, please > > let me know and I will work on that instead, though it will take up more > > time. > > I think you are misunderstanding me. > > I think this patch is fine, except for the comment that I gave: > "Perhaps add a comment here stating WHY this is needed for v3.65a (!is_am6)." > > Like: > > /* > * This is only needed for !am654 since it has its own msi_irq_chip > * implementation. (am654 uses the generic msi_irq_chip implementation.) > */ > if (!ks_pcie->is_am6) { > ... > } > > > In fact, if you move this code to ks_pcie_msi_host_init(), instead of > ks_pcie_host_init(), you would not need a comment (or a if (!ks_pcie->is_am6)), > since ks_pcie_msi_host_init() is only executed by !am654. This seems much better :) In the current code, the execution is as follows: ks_pcie_probe() dw_pcie_host_init() pci_host_probe() ks_pcie_v3_65_add_bus() Moving the contents of ks_pcie_v3_65_add_bus() to ks_pcie_msi_host_init() will result in: ks_pcie_probe() dw_pcie_host_init() if (pci_msi_enabled()) if (pp->ops->msi_init) { ret = pp->ops->msi_init(pp); ks_pcie_msi_host_init() pci_host_probe() I will update this patch based on your suggestion. If it's alright, may I also add your "Suggested-by" tag for the v5 patch? Please let me know. > > > > > My suggestion to split this driver to two different drivers is just because > I noticed how different they are (am654 has iATUs, uses generic msi_irq_chip > implementation and has EP-mode support. !am654 has no iATUs, its own MSI > implementation and no EP-mode support.) > > So the am654 driver would look like most other DWC glue drivers. > The non-am654 driver would look mostly like it looks today, except you would > remove the EP-mode support. > > However, this suggestion can of course be implemented sometime in the future > and should not be a blocker for the patch in $subject. Thank you for clarifying. Regards, Siddharth.