From nobody Sun Feb 8 10:17:19 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 78574204C2F; Wed, 4 Jun 2025 09:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749029054; cv=none; b=u2EoAeUF5oiqPA+Y8ymhbTEzS07eW5H02ayughoH7qd+I8DuxI49LSwlPUWt3lKJ3W4n2chLL4cyI9JDGmJmmrMPZLaHBR9sdwaSmq4ZeCZ3OaN9LGEghvG167wx+J/5ncRtYusIO7ykOBdAo6xPAFlfe2pkoUY6LK7Hl8mODkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749029054; c=relaxed/simple; bh=3Vt9Ersmy51fQ4UGCzG+5fBUf5HJgTPUKNpIdSpjnHU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=V8tDHeucIqRfEsFPAl6HM0CDDdBegZW7slZ8hPDaVLlXWVCswRQwu5ybSB4rJKcY0KL7LAgSOndX9xrRz3kq9vtDjMWEO+4LoUoLeMkAPFfIdq1ZxBk0R3A32QUrsX9jn/sxeYGJU/nXSxx07/IdO/geaNoFLI57RhXYGfCufJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qmKVFBJ+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=N4r51sj9; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qmKVFBJ+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="N4r51sj9" Date: Wed, 04 Jun 2025 09:24:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1749029050; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OMYbWrQ6EXrRjZdoFNsi/rJdPmu0zrgE79fu3+vahOY=; b=qmKVFBJ++JmXnhLriGTx0+0qfHCH5MKzmyOwPB0ncewRzCgAvsjFXWx1fgSh7MZ/t3tUl2 JOIOg26EGJ3aIzaHAvdQMumOk+uMZr+gyiUrAiILGl+tGAHnVvAWHGLMo533n9xjiv/APh rgWfrOnpu3y4wmnsx7g2EajUg/+5aii459iqjj3ItFGSpUIUMw8rnSrWhM90C8uw9pYUp9 utBkp8Wcmf0aIUqrvFfVlErVKKW9M98WEGcZ3mtbvhs1ZMPztEf02qLw8GyzE53Ikhe1qp 8s9Vu2N7N8W/NoaSXKJUIzknrs7okJnT2IoAvDYbzqaHiD5SD+6cenBArS1QHQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1749029050; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OMYbWrQ6EXrRjZdoFNsi/rJdPmu0zrgE79fu3+vahOY=; b=N4r51sj92GSK9ydR6XP00VmTi7imjiDm9ktSmA432AhB4i3ihEvtXnWwsMwG5CQvU0H9zK bDbsicOxO0ymE/Dg== From: "tip-bot2 for Marc Zyngier" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] PCI/MSI: Size device MSI domain with the maximum number of vectors Cc: Zenghui Yu , Marc Zyngier , Thomas Gleixner , Lorenzo Pieralisi , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250603141801.915305-1-maz@kernel.org> References: <20250603141801.915305-1-maz@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174902904863.406.10681052840126037634.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the irq/urgent branch of tip: Commit-ID: 9cc82d99b13c1ad04e3dff9182b7953a8dba10b6 Gitweb: https://git.kernel.org/tip/9cc82d99b13c1ad04e3dff9182b7953a8= dba10b6 Author: Marc Zyngier AuthorDate: Tue, 03 Jun 2025 15:18:01 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 04 Jun 2025 11:19:25 +02:00 PCI/MSI: Size device MSI domain with the maximum number of vectors Zenghui reports that since 1396e89e09f0 ("genirq/msi: Move prepare() call to per-device allocation"), his Multi-MSI capable device isn't working anymore. This is a consequence of 15c72f824b32 ("PCI/MSI: Add support for per device MSI[X] domains"), which always creates a MSI domain of size 1, even in the presence of Multi-MSI. While this was somehow working until then, moving the .prepare() call ends up sizing the ITS table with a tiny value for this device, and making the endpoint driver unhappy. Instead, always create the domain and call the .prepare() helper with the maximum expected size. Fixes: 1396e89e09f0 ("genirq/msi: Move prepare() call to per-device allocat= ion") Fixes: 15c72f824b32 ("PCI/MSI: Add support for per device MSI[X] domains") Reported-by: Zenghui Yu Signed-off-by: Marc Zyngier Signed-off-by: Thomas Gleixner Tested-by: Zenghui Yu Reviewed-by: Lorenzo Pieralisi Link: https://lore.kernel.org/all/20250603141801.915305-1-maz@kernel.org Closes: https://lore.kernel.org/r/0b1d7aec-1eac-a9cd-502a-339e216e08a1@huaw= ei.com --- drivers/pci/msi/irqdomain.c | 5 +++-- drivers/pci/msi/msi.c | 8 ++++---- drivers/pci/msi/msi.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c index d7ba879..c051527 100644 --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -271,6 +271,7 @@ static bool pci_create_device_domain(struct pci_dev *pd= ev, const struct msi_doma /** * pci_setup_msi_device_domain - Setup a device MSI interrupt domain * @pdev: The PCI device to create the domain on + * @hwsize: The maximum number of MSI vectors * * Return: * True when: @@ -287,7 +288,7 @@ static bool pci_create_device_domain(struct pci_dev *pd= ev, 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 +298,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); =20 - return pci_create_device_domain(pdev, &pci_msi_template, 1); + return pci_create_device_domain(pdev, &pci_msi_template, hwsize); } =20 /** diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index d6ce040..6ede55a 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -439,16 +439,16 @@ int __pci_enable_msi_range(struct pci_dev *dev, int m= invec, int maxvec, if (nvec < minvec) return -ENOSPC; =20 - if (nvec > maxvec) - nvec =3D maxvec; - rc =3D pci_setup_msi_context(dev); if (rc) return rc; =20 - if (!pci_setup_msi_device_domain(dev)) + if (!pci_setup_msi_device_domain(dev, nvec)) return -ENODEV; =20 + if (nvec > maxvec) + nvec =3D maxvec; + for (;;) { if (affd) { nvec =3D irq_calc_affinity_vectors(minvec, nvec, affd); diff --git a/drivers/pci/msi/msi.h b/drivers/pci/msi/msi.h index fc70b60..0b420b3 100644 --- a/drivers/pci/msi/msi.h +++ b/drivers/pci/msi/msi.h @@ -107,7 +107,7 @@ enum support_mode { }; =20 bool pci_msi_domain_supports(struct pci_dev *dev, unsigned int feature_mas= k, 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 hwsiz= e); =20 /* Legacy (!IRQDOMAIN) fallbacks */