All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>, john.garry@huawei.com
Subject: [PATCH 3/3] irqchip/gic-v3-its: Flag device allocation as proxied if behind a PCI bridge
Date: Sun, 29 Nov 2020 13:52:08 +0000	[thread overview]
Message-ID: <20201129135208.680293-4-maz@kernel.org> (raw)
In-Reply-To: <20201129135208.680293-1-maz@kernel.org>

An aliasing PCI bridge is another case where we should flag the
corresponding allocation as "proxied", as MSIs are coming with
the bridge's RID, and not the originating device's.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 drivers/irqchip/irq-gic-v3-its-pci-msi.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index 87711e0f8014..ad2810c017ed 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -67,11 +67,16 @@ static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
 	/*
 	 * If pdev is downstream of any aliasing bridges, take an upper
 	 * bound of how many other vectors could map to the same DevID.
+	 * Also tell the ITS that the signalling will come from a proxy
+	 * device, and that special allocation rules apply.
 	 */
 	pci_for_each_dma_alias(pdev, its_get_pci_alias, &alias_dev);
-	if (alias_dev != pdev && alias_dev->subordinate)
-		pci_walk_bus(alias_dev->subordinate, its_pci_msi_vec_count,
-			     &alias_count);
+	if (alias_dev != pdev) {
+		if (alias_dev->subordinate)
+			pci_walk_bus(alias_dev->subordinate,
+				     its_pci_msi_vec_count, &alias_count);
+		info->flags |= MSI_ALLOC_FLAGS_PROXY_DEVICE;
+	}
 
 	/* ITS specific DeviceID, as the core ITS ignores dev. */
 	info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain, pdev);
-- 
2.28.0


  parent reply	other threads:[~2020-11-29 13:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 13:52 [PATCH 0/3] MSI: Track device proxying when allocating MSIs Marc Zyngier
2020-11-29 13:52 ` [PATCH 1/3] platform-msi: Track shared domain allocation Marc Zyngier
2020-12-11 14:58   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2020-11-29 13:52 ` [PATCH 2/3] irqchip/gic-v3-its: Tag ITS device as shared if allocating for a proxy device Marc Zyngier
2020-12-11 14:58   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2020-11-29 13:52 ` Marc Zyngier [this message]
2020-12-11 14:58   ` [irqchip: irq/irqchip-next] irqchip/gic-v3-its: Flag device allocation as proxied if behind a PCI bridge irqchip-bot for Marc Zyngier
2020-11-30 13:14 ` [PATCH 0/3] MSI: Track device proxying when allocating MSIs John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201129135208.680293-4-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.