irqchip/gic-v3-its: Use allocation size from the prepare call
authorMarc Zyngier <maz@kernel.org>
Tue, 13 May 2025 16:31:44 +0000 (17:31 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 14 May 2025 10:36:42 +0000 (12:36 +0200)
Now that .msi_prepare() gets called at the right time and not
with semi-random parameters, remove the ugly hack that tried
to fix up the number of allocated vectors.

It is now correct by construction.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250513163144.2215824-6-maz@kernel.org
drivers/irqchip/irq-gic-v3-its-msi-parent.c

index 958736622fa5739d4db122661f9f9389945e558b..6a5f64f120d4ae05d3ae9c22ecc873d81b652fa3 100644 (file)
@@ -67,17 +67,6 @@ static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
        /* ITS specific DeviceID, as the core ITS ignores dev. */
        info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain->parent, pdev);
 
-       /*
-        * @domain->msi_domain_info->hwsize contains the size of the
-        * MSI[-X] domain, but vector allocation happens one by one. This
-        * needs some thought when MSI comes into play as the size of MSI
-        * might be unknown at domain creation time and therefore set to
-        * MSI_MAX_INDEX.
-        */
-       msi_info = msi_get_domain_info(domain);
-       if (msi_info->hwsize > nvec)
-               nvec = msi_info->hwsize;
-
        /*
         * Always allocate a power of 2, and special case device 0 for
         * broken systems where the DevID is not wired (and all devices
@@ -151,14 +140,6 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev,
        /* ITS specific DeviceID, as the core ITS ignores dev. */
        info->scratchpad[0].ul = dev_id;
 
-       /*
-        * @domain->msi_domain_info->hwsize contains the size of the device
-        * domain, but vector allocation happens one by one.
-        */
-       msi_info = msi_get_domain_info(domain);
-       if (msi_info->hwsize > nvec)
-               nvec = msi_info->hwsize;
-
        /* Allocate at least 32 MSIs, and always as a power of 2 */
        nvec = max_t(int, 32, roundup_pow_of_two(nvec));