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 5274AC5AD49 for ; Tue, 3 Jun 2025 12:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SYqZQG5I/vp1fWhpO72cTKEeUIZPfDXS4RqKyLDgcgo=; b=VhpedAfKM3Iy4UoEdN7CePnTUz c6IRmaTyKv7o5CtLdayQspdJE7C3aA5XjNcLK2d5Itvq0IlRtJaACZobI7UTRZwl6h3uuCMKVro+K Yx36PnEcPNuV+ZbYbogjJkW7HlI89xmIdATAkpZkxjcLQ2CNNR7oa6+3Tj3stiHwd7SJADn0CTDcg uFKqRhYRgqApc9xTLr85E80qth0FjO2F7nV5VayV/vm4KNEMbVXfinlxg0wI6fuolUHdeF2UXwDxS Oscigsiqe/3JbSaBswf+Jwfxi7aqJnIIwwBpIgD/hFquNnY1PXL33ZU6a6J7VFyPoNAB3VauMugUN tOy7K4Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMR8d-0000000Axoo-3oJk; Tue, 03 Jun 2025 12:53:07 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMR6T-0000000AxXx-0WL5 for linux-arm-kernel@lists.infradead.org; Tue, 03 Jun 2025 12:50:54 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 61F3BA501CD; Tue, 3 Jun 2025 12:50:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A51FC4CEED; Tue, 3 Jun 2025 12:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748955052; bh=obmWgo5IbP5r+MBsvL6ZnYbtDpu9BYwK9noBJQMsAFA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DBCZ7hII0FYbzBURCHDIlDFLdjaGqNLLb1P1OkPY3u1nj5Ur1LG+qPHOYtFxMq8Xu 6iwtsVdRJdKzjqMfFeOW0tb8UMAjA8fwlAziFmMu38eiN1b4ht9Cn7Bej5yvIIbUIl SwlYT86MRqJP21sbEYanrY2i0i9iphayDE7nWxFeka1nkovGOeP4WfsP9hnog7fCNU A9adNbPphh58Z97tV7f9geyRK6hjbPjJlQXQAEK6JHHgArX5EqIGQF7YPvwVn5lzPW qtSA/lASvNT5na7ZljNv3gWNiof8sPXe7c6MFvk/JJ9p7t4yw9zipj/DVS0z7apmLX eh5VwnH57Rrqg== Received: from [149.88.19.236] (helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uMR6P-002pft-JI; Tue, 03 Jun 2025 13:50:49 +0100 Date: Tue, 03 Jun 2025 13:50:47 +0100 Message-ID: <87ldq9dm54.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: , , Thomas Gleixner , Lorenzo Pieralisi , Sascha Bischoff , Timothy Hayes Subject: Re: [PATCH v2 3/5] genirq/msi: Move prepare() call to per-device allocation In-Reply-To: <0b1d7aec-1eac-a9cd-502a-339e216e08a1@huawei.com> References: <20250513163144.2215824-1-maz@kernel.org> <20250513163144.2215824-4-maz@kernel.org> <0b1d7aec-1eac-a9cd-502a-339e216e08a1@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 149.88.19.236 X-SA-Exim-Rcpt-To: yuzenghui@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tglx@linutronix.de, lpieralisi@kernel.org, sascha.bischoff@arm.com, timothy.hayes@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250603_055053_296684_07A7D1E1 X-CRM114-Status: GOOD ( 18.54 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Zenghui, On Tue, 03 Jun 2025 09:22:47 +0100, Zenghui Yu wrote: > > > + domain->dev = dev; > > + dev->msi.data->__domains[domid].domain = domain; > > + > > + if (msi_domain_prepare_irqs(domain, dev, hwsize, &bundle->alloc_info)) { > > Does it work for MSI? hwsize is 1 in the MSI case, without taking > pci_msi_vec_count() into account. > > bool pci_setup_msi_device_domain(struct pci_dev *pdev) > { > [...] > > return pci_create_device_domain(pdev, &pci_msi_template, 1); Well spotted. This looks like a PCI bug ignoring Multi-MSI. Can you give the following a go and let people know whether that fixes your issue? Thanks, M. diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c index d7ba8795d60f..89677a21d525 100644 --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -287,7 +287,7 @@ static bool pci_create_device_domain(struct pci_dev *pdev, const struct msi_doma * - The device is removed * - MSI is disabled and a MSI-X domain is created */ -bool pci_setup_msi_device_domain(struct pci_dev *pdev) +bool pci_setup_msi_device_domain(struct pci_dev *pdev, unsigned int hwsize) { if (WARN_ON_ONCE(pdev->msix_enabled)) return false; @@ -297,7 +297,7 @@ bool pci_setup_msi_device_domain(struct pci_dev *pdev) if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSIX)) msi_remove_device_irq_domain(&pdev->dev, MSI_DEFAULT_DOMAIN); - return pci_create_device_domain(pdev, &pci_msi_template, 1); + return pci_create_device_domain(pdev, &pci_msi_template, hwsize); } /** diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index 8b8848788618..81891701840a 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -449,7 +449,7 @@ int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, if (rc) return rc; - if (!pci_setup_msi_device_domain(dev)) + if (!pci_setup_msi_device_domain(dev, nvec)) return -ENODEV; for (;;) { diff --git a/drivers/pci/msi/msi.h b/drivers/pci/msi/msi.h index ee53cf079f4e..3ab898af88a7 100644 --- a/drivers/pci/msi/msi.h +++ b/drivers/pci/msi/msi.h @@ -107,7 +107,7 @@ enum support_mode { }; bool pci_msi_domain_supports(struct pci_dev *dev, unsigned int feature_mask, enum support_mode mode); -bool pci_setup_msi_device_domain(struct pci_dev *pdev); +bool pci_setup_msi_device_domain(struct pci_dev *pdev, unsigned int hwsize); bool pci_setup_msix_device_domain(struct pci_dev *pdev, unsigned int hwsize); /* Legacy (!IRQDOMAIN) fallbacks */ -- Jazz isn't dead. It just smells funny.