All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	<lokeshvutla@ti.com>, Robin Murphy <Robin.Murphy@arm.com>
Subject: Re: [PATCH 3/3] irqchip/gic-v3-its: Include "msi-map-mask" for calculating nvecs
Date: Mon, 20 Sep 2021 09:36:14 +0100	[thread overview]
Message-ID: <875yuvwsn5.wl-maz@kernel.org> (raw)
In-Reply-To: <20210920064133.14115-4-kishon@ti.com>

+ Robin, who has dealt with a lot of the stuff here.

On Mon, 20 Sep 2021 07:41:33 +0100,
Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> Using "msi-map-mask" in device tree lets multiple PCIe requestor ID to
> use the same GIC ITS device ID. So while creating the Interrupt
> Translation Table (ITT) for a specific GIC ITS device ID, the total number
> of interrupts required by all the PCIe requestor ID that maps to the
> same GIC ITS device ID should be calculated
> 
> Add support for gic-v3-its to include "msi-map-mask" property in device
> tree for calculating the total number of MSI interrupts in
> its_pci_msi_prepare().
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/irqchip/irq-gic-v3-its-pci-msi.c | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
> index ad2810c017ed..c79bca1a5787 100644
> --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
> +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
> @@ -54,9 +54,13 @@ static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
>  static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
>  			       int nvec, msi_alloc_info_t *info)
>  {
> +	int alias_count = 0, map_count = 0, minnvec = 1, ret;
>  	struct pci_dev *pdev, *alias_dev;
>  	struct msi_domain_info *msi_info;
> -	int alias_count = 0, minnvec = 1;
> +	struct device *parent_dev;
> +	struct pci_bus *root_bus;
> +	struct device_node *np;
> +	u32 map_mask, rid;
>  
>  	if (!dev_is_pci(dev))
>  		return -EINVAL;
> @@ -78,6 +82,21 @@ static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
>  		info->flags |= MSI_ALLOC_FLAGS_PROXY_DEVICE;
>  	}
>  
> +	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) {

Move the declaration of np, ret and map_count here.

> +		np = parent_dev->of_node;
> +		if (!np)
> +			continue;
> +
> +		ret = of_property_read_u32(np, "msi-map-mask", &map_mask);
> +		if (!ret && map_mask != 0xffff) {
> +			rid = pci_dev_id(pdev) & map_mask;
> +			root_bus = find_pci_root_bus(pdev->bus);
> +			__pci_walk_bus(root_bus, its_pci_msi_vec_count, &map_count, rid, map_mask);
> +			break;
> +		}
> +	}
> +	alias_count = max(map_count, alias_count);

Move this after the call to __pci_walk_bus().

> +
>  	/* ITS specific DeviceID, as the core ITS ignores dev. */
>  	info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain, pdev);

If you don't set the PROXY_DEVICE flag, bad thing will happen when the
canonical device is removed.

Ultimately, this should be moved into a separate helper, along the
line of pci_for_each_dma_alias(). It probably also needs to have an
ACPI counterpart.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2021-09-20  8:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  6:41 [PATCH 0/3] PCI/gic-v3-its: Add support for same ITS device ID for multiple PCIe devices Kishon Vijay Abraham I
2021-09-20  6:41 ` [PATCH 1/3] PCI: Add support in pci_walk_bus() to invoke callback matching RID Kishon Vijay Abraham I
2021-09-20  8:56   ` Marc Zyngier
2021-09-20 14:28     ` Kishon Vijay Abraham I
2021-09-20 18:01       ` Marc Zyngier
2021-09-22  1:26         ` Kishon Vijay Abraham I
2021-09-27 14:45           ` Marc Zyngier
2021-09-27 14:56             ` Kishon Vijay Abraham I
2021-09-20  6:41 ` [PATCH 2/3] PCI: Export find_pci_root_bus() Kishon Vijay Abraham I
2021-09-20  8:37   ` Marc Zyngier
2021-09-20  6:41 ` [PATCH 3/3] irqchip/gic-v3-its: Include "msi-map-mask" for calculating nvecs Kishon Vijay Abraham I
2021-09-20  8:36   ` Marc Zyngier [this message]
2021-09-20  9:14 ` [PATCH 0/3] PCI/gic-v3-its: Add support for same ITS device ID for multiple PCIe devices Marc Zyngier
2021-09-20 11:22   ` Kishon Vijay Abraham I
2021-09-20 11:36     ` Marc Zyngier

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=875yuvwsn5.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=Robin.Murphy@arm.com \
    --cc=bhelgaas@google.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lokeshvutla@ti.com \
    --cc=lorenzo.pieralisi@arm.com \
    --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.