From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3D54C433EF for ; Wed, 23 Feb 2022 18:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=V73Q08nzK5A6cKd0FOT3TM3onkCFtPeePgyh3AXlfjQ=; b=3hf9yktVoKjyBH zSRn7SXqdoGuBA8tsJaQUTg7/ZVcaBk/DlK2utRytZIkQfMCRWQMU2G/bqN464DpZDMyIYlTqLaDK am53t4V/8v1IERjJVxSkkdmlwt8vtd54BjrHPQUXWKdSt1wM5dJAmUfUTbnP1GAI5dR+y5n+wvta9 l53/j18uNRUrK4vLX2y7CAVTEH/RgQeHvuHAcsdS8gJxuRQR2drHXQXqxsT3g/lRCZMkdD6VhfKUz Zwo5z+ItKnq4kxwJCk2gbzVikzMJAGDejtTqu094QChs30eeAt7FOE9dkhXOMS4zoZ5rbnZBGitFs wKxEPXy1uVz86/cnLKJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMw8e-00FgSj-Er; Wed, 23 Feb 2022 18:13:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMw8Z-00FgRK-O4 for linux-arm-kernel@lists.infradead.org; Wed, 23 Feb 2022 18:13:17 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 43A67614AC; Wed, 23 Feb 2022 18:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66D4BC340EC; Wed, 23 Feb 2022 18:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645639994; bh=iXqer8BSvDJXCD5ucM7OvDJNDGRMFIug8G31VTXFMlA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=KLCL5QjgWWU5lBGajrjoqzuYCyh+cgivmiwTOHJIgK17QHMw17yxmlMWjAy+tbOHs IWzc+bFr9KXWTc21BJTTud3R47d06oQPAmDQYYJ+Sn2kYtn/+TWhizcTNaNn9uhteq SB3MLv5puWD552J01hvFSuR9MtlXhnwkZhG8YbJQUMYQie9kbhJEOYr5A314VqV9l5 dd8azdzLcqBLP4b+2nM2Z7M/1SF3QvMH/k4XFcXMP/JsaZTd7nvHlLq6si5eMIrWJf MbFWNq8ncsW9vi4SFWOdZosNvbAxnqUL0lzsUHLpFexBW8ZCtkHgfu8PLQ6cUpK6wB QSN/y1byJOcNw== Date: Wed, 23 Feb 2022 12:13:12 -0600 From: Bjorn Helgaas To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Marc Zyngier , Lorenzo Pieralisi , pali@kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 11/23] PCI: aardvark: Fix setting MSI address Message-ID: <20220223181312.GA141319@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220218154329.762831dd@thinkpad> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220223_101315_843037_0508F284 X-CRM114-Status: GOOD ( 25.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 18, 2022 at 03:43:29PM +0100, Marek Beh=FAn wrote: > On Thu, 17 Feb 2022 11:14:52 -0600 > Bjorn Helgaas wrote: > = > > > + phys_addr_t msi_addr; > > > u32 reg; > > > int i; > > > = > > > @@ -561,6 +561,11 @@ static void advk_pcie_setup_hw(struct advk_pcie = *pcie) > > > reg |=3D LANE_COUNT_1; > > > advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); > > > = > > > + /* Set MSI address */ > > > + msi_addr =3D virt_to_phys(pcie); = > > = > > Strictly speaking, msi_addr should be a pci_bus_addr_t, not a > > phys_addr_t, and virt_to_phys() doesn't return a bus address. > = > the problem here is that as far as we know currently there is no > function that converts a virtual address to pci_bus_addr_t like > virt_to_phys() does to convert to phys_addr_t. > = > On Armada 3720 there are PCIe Controller Address Decoder Registers, > which such a translating function would need to consult to do the > translation. But the default settings of these registers is to map PCIe > addresses 1 to 1 to physical addresses, and no driver changes these > registers. The poorly-named pcibios_resource_to_bus() (I think the name is my fault) is the way to convert a CPU physical address to a PCI bus address. This is implemented in terms of the host bridge windows and the translation offset in struct resource_entry, which should be set up via the pci_add_resource_offset() called from devm_of_pci_get_host_bridge_resources(). > Pali says that other drivers also use phys_addr_t, and most hardware > maps 1 to 1 by default. Yes. I think they're all technically incorrect. Most systems do map CPU phys =3D=3D PCI bus, but I point it out because it's a case where copying that pattern to new drivers will eventually bite us. > So we think that until at least an API for such a function exists, we > shuld leave it as it is. I am not against converting the phys_addr_to > to a pci_bus_addr_t, but Pali thinks that for now we should leave even > that as it is, because the virt_to_phys() function returns phys_addr_t. > = > We can add a comment there explaining this, if you want. > = > What do you think? > = > Marek _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel