Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp727461lqp; Wed, 22 May 2024 19:36:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSrbQrEG7wZx+BpvlzrjAwdTVfdP+FuBk9S7/lMJ+Zdqy3TuvUVVoHX9HslgB2cUr6U6N0ME7hFUPsc0j8YpLRb8paFK5mSRKZg+pcPQ== X-Google-Smtp-Source: AGHT+IFwfFGozxZ+IylaS3OnjyBH5E5OcpvmfnTQjuOR3rBO0haWmJAHk6RNgOnormkhDLkLLlUK X-Received: by 2002:a17:902:dacf:b0:1f3:421d:add2 with SMTP id d9443c01a7336-1f3421db170mr2643405ad.51.1716431763824; Wed, 22 May 2024 19:36:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716431763; cv=pass; d=google.com; s=arc-20160816; b=whWgTXcKZMF7sD54Cv9BEKmaF62h55G/NArJrNStGVe7zNlkCgh0Vgdr3+TMj5kb6/ 5k4KlUQnGgnJ9hxMHK3biwvylRLGNdTZ4j/MsTK9g9tbM3w/ojdT/rfgTES3Wn2MXtCV Lyjia/zCSS6WOm5/4UzlSji8cNlG57isjnR45NDJbTFrAx9wQrtNvm4Gp8lL+VEVgzwq o6lT9yUKlWNVnK8gFnNwCmYNZJ4Q8j7rl3wH2knG7EZy6E3Kt/bg2XV4pKWFhMYHn7dd pH8b22B+4LdKQ7mvSCOr81mSrarXbxMoG56MlLz8G6PqS1ZyOFaBDn6VizH+zrkYgNNS JIXg== 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:message-id:subject:cc:to:from :date:dkim-signature; bh=6nI3Ois7B3fMfb622A5UeronWsYN9wImP0udGxkZ/FU=; fh=SlDK3PGQgoxdGsdryErwkHCYxjUO+NBBCaQG/KHHr6Y=; b=opgWePxkNxtR5cuk79Drgklaw235gMqPZNv1yRArrU8fzWOGBOcYndb6FS65cf5x4J R84EPj6HyyIpeFobr1gzC7UOhWHmD78qVdmRKG828PGWtSUb/JjdU77Ue1eoJUh5cgNo 1HIs4ItAuYOs/qkoNPNE8BPjAX21W7X4ge52g4MGXI4RYlSvPDw4rS3ZPqHwaUQ29WfJ E/vfI4BtjqHluCOSqqgit2XRk1+sg291os1Fd2WZ2gQFB7K7dEGXCnhb24jeJ+UYvFwn IVsqOrDpRnUr0zU0MJkQwG4JGpfH4bUoToIYlRaWgXm4J/3/U7cPt6+pg74RmD+JJQGu x7Xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LNO9S6KF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-186919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186919-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f2fd982e4fsi8206905ad.65.2024.05.22.19.36.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 19:36:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LNO9S6KF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-186919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186919-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7553B2822DF for ; Thu, 23 May 2024 02:36:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CEE613A884; Thu, 23 May 2024 02:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LNO9S6KF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0C78A3FD4; Thu, 23 May 2024 02:35:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716431753; cv=none; b=Z1t4ervQvBY367fbkGkZqgT4O54dvtFSjcedB/PdRF20wkYDNhlP370BTOBGX28JF7cyLhVDYnkmAIyTkm/O+5OvSlZZ1Y0uhD7M7GT0iklLK9GGTHQCr23H3jUy/2ZtThPftsanKgJMC74rXnNz25LXwXwqX4esaBxL3bEI1bc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716431753; c=relaxed/simple; bh=zhQmBBMVvVCkundq1HInPxU/OC6UeXZbEC1QHoq4MM0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=VR6R4twHhQKP1EuPiWFlTrwYAYMmb2oIJnNaZI2jZgasViwGlG8VgOJfvvOUNeRmwSU3PFJ1UvIEDpoV8OlbE4O1xOU8Irezp+VlEuYZ3n7FuA8cDbyTYwlPZT5poY2W/nD1QjDaGH31vRn6eIG7xxg3+ckuVZkRfho0jC9uKrs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LNO9S6KF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D00BC2BBFC; Thu, 23 May 2024 02:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716431751; bh=zhQmBBMVvVCkundq1HInPxU/OC6UeXZbEC1QHoq4MM0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=LNO9S6KF9l4oOc3kcBGJfxz5pKwqRYXEmJYz3V9pgrdttmlESBaQm/hoMx3+KOaY7 FkxP5yzzbYHruF0zmZtpP7ykzAho52khy2ht7lVarOnqDTFfdQc0sLPbGKqhXl5laB qliAvxnzrW0rtc9YgYifg+6mjCWp3SbIHe2VHel9IfIliZxIyP7MprmwiTFjG3TMvt epw8JG0eE9GbqmpgalCCTjmpRMF2fLummkTK/6uS2ZHtw7h0MeUg8YwI9cHzsC5bgM w6EVMARW4sQXbpDIWWukIP+I/uCHwCB9gFNNL5BLK0YK6l7IrUkvr1RJFx5OyhyjgW 0hjOf2wQ/B4UA== Date: Wed, 22 May 2024 21:35:49 -0500 From: Bjorn Helgaas To: Minda Chen Cc: Lorenzo Pieralisi , Conor Dooley , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Thomas Gleixner , Daire McNamara , Emil Renner Berthing , Krzysztof Kozlowski , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-pci@vger.kernel.org" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie Subject: Re: [PATCH v16 08/22] PCI: microchip: Change the argument of plda_pcie_setup_iomems() Message-ID: <20240523023549.GA105928@bhelgaas> 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: On Thu, May 23, 2024 at 01:09:58AM +0000, Minda Chen wrote: > > On Wed, May 22, 2024 at 01:50:57AM +0000, Minda Chen wrote: > > > > The patch is OK, but the subject line is not very informative. It > > > > should be useful all by itself even without the commit log. > > > > "Change the argument of X" doesn't say anything about why we would > > > > want to do that. > > > > > > > > On Thu, Mar 28, 2024 at 05:18:21PM +0800, Minda Chen wrote: > > > > > If other vendor do not select PCI_HOST_COMMON, the driver data is > > > > > not struct pci_host_bridge. > > > > > > > > Also, I don't think this is the real problem. Your > > > > PCIE_MICROCHIP_HOST Kconfig selects PCI_HOST_COMMON, and the > > driver > > > > calls pci_host_common_probe(), so the driver wouldn't even build > > > > without PCI_HOST_COMMON. > > > > > > > > This patch is already applied and ready to go, but if you can tell > > > > us what's really going on here, I'd like to update the commit log. > > > > > > > It is modified for Starfive code. Starfive JH7110 PCIe do not select > > > PCI_HOST_COMMON > > > plda_pcie_setup_iomems() will be changed to common plda code. > > > > > > I think I can modify the title and commit log like this. > > > > > > Title: > > > PCI: microchip: Get struct pci_host_bridge pointer from platform code > > > > > > Since plda_pcie_setup_iomems() will be a common PLDA core driver > > > function, but the argument0 is a struct platform_device pointer. > > > plda_pcie_setup_iomems() actually using struct pci_host_bridge pointer > > > other than platform_device pointer. Further more if a new PLDA core > > > PCIe driver do not select PCI_HOST_COMMON, the platform driver data is > > > not struct pci_host_bridge pointer. So get struct pci_host_bridge > > > pointer from platform code function > > > mc_platform_init() and make it to be an argument of > > > plda_pcie_setup_iomems(). > > > > OK, I see what you're doing. This actually has nothing to do with whether > > PCI_HOST_COMMON is *enabled*. It has to do with whether drivers use > > pci_host_common_probe(). Here's what I propose: > > > > PCI: plda: Pass pci_host_bridge to plda_pcie_setup_iomems() > > > > plda_pcie_setup_iomems() needs the bridge->windows list from struct > > pci_host_bridge and is currently used only by pcie-microchip-host.c. This > > driver uses pci_host_common_probe(), which sets a pci_host_bridge as the > > drvdata, so plda_pcie_setup_iomems() used platform_get_drvdata() to find > > the pci_host_bridge. > > > > But we also want to use plda_pcie_setup_iomems() in the new pcie-starfive.c > > driver, which does not use pci_host_common_probe() and will have struct > > starfive_jh7110_pcie as its drvdata, so pass the pci_host_bridge directly > > to plda_pcie_setup_iomems() so it doesn't need platform_get_drvdata() to > > find it. > > > OK, Thanks. > > I see PCIe 6.10 changed have been merged to main line. > Should I resend this patch set base on 6.10-rc1? No need, I rebased it to f0bae243b2bc ("Merge tag 'pci-v6.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci") already and it will be a trivial rebase to v6.10-rc1 next week. The current pci/controller/microchip branch is at: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=ed261441e224 Let me know if anything is missing from there. I can't merge it into linux-next until v6.10-rc1 is tagged, but as soon as it is, I'll put it in linux-next. > > > > > Move calling platform_get_drvdata() to mc_platform_init(). > > > > > > > > > > Signed-off-by: Minda Chen > > > > > Reviewed-by: Conor Dooley > > > > > --- > > > > > drivers/pci/controller/plda/pcie-microchip-host.c | 6 +++--- > > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c > > > > > b/drivers/pci/controller/plda/pcie-microchip-host.c > > > > > index 9b367927cd32..805870aed61d 100644 > > > > > --- a/drivers/pci/controller/plda/pcie-microchip-host.c > > > > > +++ b/drivers/pci/controller/plda/pcie-microchip-host.c > > > > > @@ -876,11 +876,10 @@ static void plda_pcie_setup_window(void > > > > > __iomem > > > > *bridge_base_addr, u32 index, > > > > > writel(0, bridge_base_addr + ATR0_PCIE_WIN0_SRC_ADDR); } > > > > > > > > > > -static int plda_pcie_setup_iomems(struct platform_device *pdev, > > > > > +static int plda_pcie_setup_iomems(struct pci_host_bridge *bridge, > > > > > struct plda_pcie_rp *port) > > > > > { > > > > > void __iomem *bridge_base_addr = port->bridge_addr; > > > > > - struct pci_host_bridge *bridge = platform_get_drvdata(pdev); > > > > > struct resource_entry *entry; > > > > > u64 pci_addr; > > > > > u32 index = 1; > > > > > @@ -1018,6 +1017,7 @@ static int mc_platform_init(struct > > > > > pci_config_window *cfg) { > > > > > struct device *dev = cfg->parent; > > > > > struct platform_device *pdev = to_platform_device(dev); > > > > > + struct pci_host_bridge *bridge = platform_get_drvdata(pdev); > > > > > void __iomem *bridge_base_addr = > > > > > port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; > > > > > int ret; > > > > > @@ -1031,7 +1031,7 @@ static int mc_platform_init(struct > > > > pci_config_window *cfg) > > > > > mc_pcie_enable_msi(port, cfg->win); > > > > > > > > > > /* Configure non-config space outbound ranges */ > > > > > - ret = plda_pcie_setup_iomems(pdev, &port->plda); > > > > > + ret = plda_pcie_setup_iomems(bridge, &port->plda); > > > > > if (ret) > > > > > return ret; > > > > > > > > > > -- > > > > > 2.17.1 > > > > >