Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp503396lqp; Tue, 11 Jun 2024 10:23:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqGt23PvxQWc0p3Ua45B/yDgiHTR9CXvWd9mNXKCWdglgvd7sryODTgtnM9lqeZW3C0odWdURFtlPeqykUeuOe7yPlz21RpGge284cUQ== X-Google-Smtp-Source: AGHT+IGdpIdeXfRSTvxdV5tY7TbaiInV+OobktJQKiKmMqcaTtPZXWPPA7iObtI5dDWdqqxKCJpx X-Received: by 2002:a17:90b:215:b0:2c2:e45b:ecd with SMTP id 98e67ed59e1d1-2c2e45b1101mr7685058a91.12.1718126639131; Tue, 11 Jun 2024 10:23:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718126639; cv=pass; d=google.com; s=arc-20160816; b=Ccj2Q4b4i/56mSYn0GBRD5TeiZBN0q3yawjXsEO+PGkmGNi6ioK945UVj+QGb/L/YG gqATPBayr2UXA8NlotjjaBRxD+KHcN6xJeZ5CWYQWS6o2L/8qkrbdIjPDd5BWk/yq2Cy MiNG6c6st71voHMI088LjeMLKp48mMEboJuszzrnOu+P0f24oCqhuDqd7ZBf09Tsue65 1SJXDcersDa53jKoY93RBnOB1dZ1StjZ6oYiemOHbEnbmCvkE321YAevF0yVPWlvwLfO ZcFTSBm7xfaQpHZujn6kK1iTvj08QiPriWfh2gip1rGAFJROA1cT7fA2Ws92hxkkL8HT JapA== 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=jbzjBK29yPB8+QZYxG/DFsd36FLABiYwNRiHkKZQgK4=; fh=b8ciSns8pODvjCmpZ+PWalgHn9Cu8vYosN8ScBUXBHA=; b=MEbWdwtqofYeRYM2xEcfwJRssxqhPSGxEJxndmUfu+S9O8kk4Qk2LXHPsaZmNuhIbE fyOYUmJgjqrxLfZcpm02d7T9A6eX5l3dbgCVixHUyxf7kNKMaD0C8TaXqxTaJ3V5fkIb 70bxeoP4TwA1XA0bad+NICVjyxxYBLLm2faoXeTe8uXswiwupN6HnVK42VFWPIEzAzJl j3WWeICyp57YK8E7kGndgHqq0k3J7KfgnZQXTi2JBz9HOOoejyBO9J7nf9+I7yRMLyVE xpSQt0RDtpEU1AlYkxe9vs7mqxDImBRJpKwD1U7h6VsoC4IUYPAX0k0Vrwr2WulnuJA6 if3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ca3NFRtd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210323-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 98e67ed59e1d1-2c2806bd669si5798740a91.98.2024.06.11.10.23.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 10:23:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210323-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=Ca3NFRtd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210323-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 EF556283644 for ; Tue, 11 Jun 2024 17:22:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 605D050A62; Tue, 11 Jun 2024 17:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ca3NFRtd" 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 885E942067; Tue, 11 Jun 2024 17:21:54 +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=1718126514; cv=none; b=pCLACd7xS0lKQXNriSPxbBh+Ev9ijh5JM5icnLCo6R2uR3moLGsI5ju0o1TT7wh7V3Q+vl4zIKI4zrNuXDSnt07qyAMb+BpGB6CNVP2LUO/A7Cuqw1di0lMyY2yuksKdVcMXuKzSoojJBMEhMlQLijqlhKCro3HtaYnlqWngytQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718126514; c=relaxed/simple; bh=Al6HONR3WVVBrk0Upd3B3HzomVEKxemyrAHy7G9ejOA=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=SZ7Aqj5DYvpwMTPISkJ5yq1A3BlcLQ0zTJlHa5U3KeNaaHPev4GwlX+XR7jTCNq+0TwfninL0u2GdeGT2zapRPXetd27EBEiQfuGcZJTpHUnLc8In8bFhSWw7SfJIxdGwhVNOxPpAIFjNBnHMZkGvahGJVrqp3Q0zgwq383gIbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ca3NFRtd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAAB1C2BD10; Tue, 11 Jun 2024 17:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718126514; bh=Al6HONR3WVVBrk0Upd3B3HzomVEKxemyrAHy7G9ejOA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Ca3NFRtd1Be+TG67Ym1YkrdBC58hIXQz0u6Ek04a2f3Qc9+Ft0yYHuDCFeHEZHjXN XTg4mtOTNpxNg6DO2x3oSwsBmoDl+Yq9n87/BL25urTqIGI68duEeKAOPDuul0b7cu M76+vU/rN6bWPVNvaAqZAsnbhnPS2DaeFyY+fZLjirdJUAdAv+D7bK2Mg2hBT0JSN6 h5RUfeClfDIAi7MOJMY/AIqiv0zt3h7rNbxTOQe+XtTa6LksGo28+vHHsLTbYchuT0 SCnrASccS4AzCUTIGPhwWfwaiK1JxfrFXgSYfmAYWiHJjs+WEbthHcqsD20gZw8g2j yt0dI+Oq1l8qg== Date: Tue, 11 Jun 2024 12:21:47 -0500 From: Bjorn Helgaas To: Marc Zyngier Cc: Manivannan Sadhasivam , Jianjun Wang , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Matthias Brugger , AngeloGioacchino Del Regno , Ryder Lee , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jieyy.yang@mediatek.com, chuanjia.liu@mediatek.com, qizhong.cheng@mediatek.com, jian.yang@mediatek.com, jianguo.zhang@mediatek.com Subject: Re: [PATCH v2 1/3] PCI: mediatek: Allocate MSI address with dmam_alloc_coherent() Message-ID: <20240611172147.GA990220@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: <864ja2l2jd.wl-maz@kernel.org> On Sun, Jun 09, 2024 at 01:32:38PM +0100, Marc Zyngier wrote: > On Sat, 08 Jun 2024 10:01:52 +0100, > Manivannan Sadhasivam wrote: > > > > On Mon, Dec 11, 2023 at 04:52:54PM +0800, Jianjun Wang wrote: > > > Use dmam_alloc_coherent() to allocate the MSI address, instead of using > > > virt_to_phys(). > > > > What is the reason for this change? So now PCIE_MSI_VECTOR becomes unused? > > More importantly, this is yet another example of the DW reference > driver nonsense, where memory is allocated for *MSI*, while the whole > point of MSIs is that it is a write that doesn't target memory, making > any form of RAM allocation absolutely pointless. > > This silly approach has been cargo-culted for years, and while I > caught a few in my time, you can't beat copy-paste. > > IMO, this patch is only making things worse instead of fixing things. Probably partly my fault. I think there are two pieces here: 1) allocating the MSI address 2) computing the PCI bus address I don't know how to do 1), but I do encourage people not to use virt_to_phys() for 2), since (in general) CPU physical addresses are not the same as PCI bus addresses.