PCI: iproc: fix the base vector number allocation for multi-MSI
PATCH 1/2 PCI: iproc: fix the base vector number allocation for multi-MSI
Commit fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.
--- drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/pci/controller/pcie-iproc-msi.c +11 -10
@@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); -/* Allocate 'nr_cpus' number of MSI vectors each time */ - hwirq =bitmap_find_next_zero_area (msi->bitmap, msi->nr_msi_vecs,0 , - msi->nr_cpus,0 ); -if (hwirq < msi->nr_msi_vecs) { -bitmap_set (msi->bitmap, hwirq, msi->nr_cpus); - }else { -mutex_unlock (&msi->bitmap_lock); -return -ENOSPC ; - } +/* +* Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors +* each time +*/ + hwirq =bitmap_find_free_region (msi->bitmap, msi->nr_msi_vecs, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock); +if (hwirq <0 ) +return -ENOSPC ; +for (i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &iproc_msi_bottom_irq_chip,
@@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); hwirq =hwirq_to_canonical_hwirq (msi, data->hwirq); -bitmap_clear (msi->bitmap, hwirq, msi->nr_cpus); +bitmap_release_region (msi->bitmap, hwirq, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock);
Signature · 1 line
2.31.0
PATCH 2/2 PCI: iproc: Support multi-MSI only on uniprocessor kernel
The interrupt affinity scheme used by this driver is incompatible with multi-MSI as it implies moving the doorbell address to that of another MSI group. This isn't possible for multi-MSI, as all the MSIs must have the same doorbell address. As such it is restricted to systems with a single CPU.
--- drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-iproc-msi.c +7 -1
@@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = {static struct msi_domain_info iproc_msi_domain_info = { .flags =MSI_FLAG_USE_DEF_DOM_OPS |MSI_FLAG_USE_DEF_CHIP_OPS | -MSI_FLAG_MULTI_PCI_MSI |MSI_FLAG_PCI_MSIX , +MSI_FLAG_PCI_MSIX , .chip = &iproc_msi_irq_chip, };
@@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,struct iproc_msi *msi = domain->host_data;int hwirq, i; +if (msi->nr_cpus >1 && nr_irqs >1 ) +return -EINVAL ; +mutex_lock (&msi->bitmap_lock);/*
@@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)mutex_init (&msi->bitmap_lock); msi->nr_cpus =num_possible_cpus (); +if (msi->nr_cpus ==1 ) + iproc_msi_domain_info.flags |=MSI_FLAG_MULTI_PCI_MSI ; + msi->nr_irqs =of_irq_count (node);if (!msi->nr_irqs) {dev_err (pcie->dev,"found no MSI GIC interrupt\n" );
Signature · 1 line
2.31.0
Re: [PATCH 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel
Quoted 9 lines · Sandor Bodo-Merle
The interrupt affinity scheme used by this driver is incompatible with multi-MSI as it implies moving the doorbell address to that of another MSI group. This isn't possible for multi-MSI, as all the MSIs must have the same doorbell address. As such it is restricted to systems with a single CPU.
Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Marc Zyngier <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Re: [PATCH 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel
In reply to Sandor Bodo-MerleQuoted 27 lines · Sandor Bodo-Merle
The interrupt affinity scheme used by this driver is incompatible with multi-MSI as it implies moving the doorbell address to that of another MSI group. This isn't possible for multi-MSI, as all the MSIs must have the same doorbell address. As such it is restricted to systems with a single CPU.
Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Marc Zyngier <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>--- drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/pci/controller/pcie-iproc-msi.c +1
-1@@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = {static struct msi_domain_info iproc_msi_domain_info = { .flags =MSI_FLAG_USE_DEF_DOM_OPS |MSI_FLAG_USE_DEF_CHIP_OPS | -MSI_FLAG_MULTI_PCI_MSI |MSI_FLAG_PCI_MSIX , +MSI_FLAG_PCI_MSIX , .chip = &iproc_msi_irq_chip, };
drivers/pci/controller/pcie-iproc-msi.c static int iproc_msi_irq_domain_alloc(struct irq_domain *domain, · line 255
Quoted 6 lines
drivers/pci/controller/pcie-iproc-msi.c +3
-0@@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,struct iproc_msi *msi = domain->host_data;int hwirq, i; +if (msi->nr_cpus >1 && nr_irqs >1 ) +return -EINVAL ; +
This should never happen since the framework would have guarded against this. But I guess it does not hurt to have the check here.
Quoted 5 lines
drivers/pci/controller/pcie-iproc-msi.c +0
-0mutex_lock (&msi->bitmap_lock);/*
drivers/pci/controller/pcie-iproc-msi.c int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) · line 551
Quoted 9 lines
drivers/pci/controller/pcie-iproc-msi.c +3
-0@@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)mutex_init (&msi->bitmap_lock); msi->nr_cpus =num_possible_cpus (); +if (msi->nr_cpus ==1 ) + iproc_msi_domain_info.flags |=MSI_FLAG_MULTI_PCI_MSI ; + msi->nr_irqs =of_irq_count (node);if (!msi->nr_irqs) {dev_err (pcie->dev,"found no MSI GIC interrupt\n" );
Looks fine to me. Thanks.
Pali Rohár
Acked-byRe: [PATCH 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel
Quoted 31 lines · On Monday 07 June 2021 09:48:21 Ray Jui wrote:
Quoted 30 lines · Sandor Bodo-Merle
The interrupt affinity scheme used by this driver is incompatible with multi-MSI as it implies moving the doorbell address to that of another MSI group. This isn't possible for multi-MSI, as all the MSIs must have the same doorbell address. As such it is restricted to systems with a single CPU.
Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Marc Zyngier <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>--- drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/pci/controller/pcie-iproc-msi.c +1
-1@@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = {static struct msi_domain_info iproc_msi_domain_info = { .flags =MSI_FLAG_USE_DEF_DOM_OPS |MSI_FLAG_USE_DEF_CHIP_OPS | -MSI_FLAG_MULTI_PCI_MSI |MSI_FLAG_PCI_MSIX , +MSI_FLAG_PCI_MSIX , .chip = &iproc_msi_irq_chip, };@@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,struct iproc_msi *msi = domain->host_data;int hwirq, i;
Quoted 6 lines
drivers/pci/controller/pcie-iproc-msi.c static int iproc_msi_irq_domain_alloc(struct irq_domain *domain, · line 255
Quoted 3 lines
drivers/pci/controller/pcie-iproc-msi.c +3
-0+if (msi->nr_cpus >1 && nr_irqs >1 ) +return -EINVAL ; +This should never happen since the framework would have guarded against this. But I guess it does not hurt to have the check here.
Yes, this should not happen, but I suggested to add a comment or assert or some other way to document this kind of constrain. Lot of times code is copy+pasted to new drivers and because only this one driver has .alloc function which is using nr_cpus for allocating msi bitmap, it really makes sense to document this constrain also explicitly.
Quoted 9 lines
drivers/pci/controller/pcie-iproc-msi.c int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) · line 547
Quoted 9 lines
drivers/pci/controller/pcie-iproc-msi.c +2
-0mutex_lock (&msi->bitmap_lock);/* @@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)mutex_init (&msi->bitmap_lock); msi->nr_cpus =num_possible_cpus (); +if (msi->nr_cpus ==1 ) + iproc_msi_domain_info.flags |=MSI_FLAG_MULTI_PCI_MSI ;
^^
Just a small note: there are two spaces instead of just one
Otherwise looks good to me:
Quoted 9 lines
drivers/pci/controller/pcie-iproc-msi.c int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) · line 551
Quoted 5 lines
drivers/pci/controller/pcie-iproc-msi.c +1
-0+ msi->nr_irqs =of_irq_count (node);if (!msi->nr_irqs) {dev_err (pcie->dev,"found no MSI GIC interrupt\n" );Looks fine to me. Thanks.
Acked-by Ray Jui <[email protected]>
Re: [PATCH 2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel
In reply to Sandor Bodo-MerleQuoted 6 lines · Sandor Bodo-Merle
The interrupt affinity scheme used by this driver is incompatible with multi-MSI as it implies moving the doorbell address to that of another MSI group. This isn't possible for multi-MSI, as all the MSIs must have the same doorbell address. As such it is restricted to systems with a single CPU.
Quoted 6 lines
Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Marc Zyngier <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>--- drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Can you just resend the series with the very minor changes requested fixed please ?
Please carry/apply the review tags as well.
Thanks,
Lorenzo
Quoted 36 lines
drivers/pci/controller/pcie-iproc-msi.c +7
-1@@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = {static struct msi_domain_info iproc_msi_domain_info = { .flags =MSI_FLAG_USE_DEF_DOM_OPS |MSI_FLAG_USE_DEF_CHIP_OPS | -MSI_FLAG_MULTI_PCI_MSI |MSI_FLAG_PCI_MSIX , +MSI_FLAG_PCI_MSIX , .chip = &iproc_msi_irq_chip, };@@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,struct iproc_msi *msi = domain->host_data;int hwirq, i; +if (msi->nr_cpus >1 && nr_irqs >1 ) +return -EINVAL ; +mutex_lock (&msi->bitmap_lock);/* @@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)mutex_init (&msi->bitmap_lock); msi->nr_cpus =num_possible_cpus (); +if (msi->nr_cpus ==1 ) + iproc_msi_domain_info.flags |=MSI_FLAG_MULTI_PCI_MSI ; + msi->nr_irqs =of_irq_count (node);if (!msi->nr_irqs) {dev_err (pcie->dev,"found no MSI GIC interrupt\n" );Signature · 1 line
2.31.0
PATCH v2 1/2 PCI: iproc: Fix multi-MSI base vector number allocation
Commit fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.
--- drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/pci/controller/pcie-iproc-msi.c +11 -10
@@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); -/* Allocate 'nr_cpus' number of MSI vectors each time */ - hwirq =bitmap_find_next_zero_area (msi->bitmap, msi->nr_msi_vecs,0 , - msi->nr_cpus,0 ); -if (hwirq < msi->nr_msi_vecs) { -bitmap_set (msi->bitmap, hwirq, msi->nr_cpus); - }else { -mutex_unlock (&msi->bitmap_lock); -return -ENOSPC ; - } +/* +* Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors +* each time +*/ + hwirq =bitmap_find_free_region (msi->bitmap, msi->nr_msi_vecs, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock); +if (hwirq <0 ) +return -ENOSPC ; +for (i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &iproc_msi_bottom_irq_chip,
@@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); hwirq =hwirq_to_canonical_hwirq (msi, data->hwirq); -bitmap_clear (msi->bitmap, hwirq, msi->nr_cpus); +bitmap_release_region (msi->bitmap, hwirq, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock);
Signature · 1 line
2.31.0
Lorenzo Pieralisi
AppliedRe: [PATCH v2 1/2] PCI: iproc: Fix multi-MSI base vector number allocation
Quoted 4 lines · Sandor Bodo-Merle
Commit
fc54bae28818("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.
Applied to pci/iproc, thanks!
[1/2] PCI: iproc: Fix multi-MSI base vector number allocation
https://git.kernel.org/lpieralisi/pci/c/e673d697b9 [2/2] PCI: iproc: Support multi-MSI only on uniprocessor kernel https://git.kernel.org/lpieralisi/pci/c/2dc0a201d0
Thanks,
Lorenzo
PATCH v2 2/2 PCI: iproc: Support multi-MSI only on uniprocessor kernel
In reply to Lorenzo PieralisiThe interrupt affinity scheme used by this driver is incompatible with multi-MSI as it implies moving the doorbell address to that of another MSI group. This isn't possible for multi-MSI, as all the MSIs must have the same doorbell address. As such it is restricted to systems with a single CPU.
--- drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-iproc-msi.c +7 -1
@@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = {static struct msi_domain_info iproc_msi_domain_info = { .flags =MSI_FLAG_USE_DEF_DOM_OPS |MSI_FLAG_USE_DEF_CHIP_OPS | -MSI_FLAG_MULTI_PCI_MSI |MSI_FLAG_PCI_MSIX , +MSI_FLAG_PCI_MSIX , .chip = &iproc_msi_irq_chip, };
@@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,struct iproc_msi *msi = domain->host_data;int hwirq, i; +if (msi->nr_cpus >1 && nr_irqs >1 ) +return -EINVAL ; +mutex_lock (&msi->bitmap_lock);/*
@@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)mutex_init (&msi->bitmap_lock); msi->nr_cpus =num_possible_cpus (); +if (msi->nr_cpus ==1 ) + iproc_msi_domain_info.flags |=MSI_FLAG_MULTI_PCI_MSI ; + msi->nr_irqs =of_irq_count (node);if (!msi->nr_irqs) {dev_err (pcie->dev,"found no MSI GIC interrupt\n" );
Signature · 1 line
2.31.0
Quoted 8 lines · Sandor Bodo-Merle
Commit
fc54bae28818("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Pali Rohár <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>
M.
Signature · 6 lines
Who you jivin' with that Cosmik Debris? _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 8 lines · On Sunday 06 June 2021 14:30:43 Sandor Bodo-Merle wrote:
Commit
fc54bae28818("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Pali Rohár <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>
Quoted 49 lines
--- drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)drivers/pci/controller/pcie-iproc-msi.c +11
-10@@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); -/* Allocate 'nr_cpus' number of MSI vectors each time */ - hwirq =bitmap_find_next_zero_area (msi->bitmap, msi->nr_msi_vecs,0 , - msi->nr_cpus,0 ); -if (hwirq < msi->nr_msi_vecs) { -bitmap_set (msi->bitmap, hwirq, msi->nr_cpus); - }else { -mutex_unlock (&msi->bitmap_lock); -return -ENOSPC ; - } +/* +* Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors +* each time +*/ + hwirq =bitmap_find_free_region (msi->bitmap, msi->nr_msi_vecs, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock); +if (hwirq <0 ) +return -ENOSPC ; +for (i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &iproc_msi_bottom_irq_chip,@@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); hwirq =hwirq_to_canonical_hwirq (msi, data->hwirq); -bitmap_clear (msi->bitmap, hwirq, msi->nr_cpus); +bitmap_release_region (msi->bitmap, hwirq, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock);Signature · 1 line
2.31.0
Quoted 46 lines · Sandor Bodo-Merle
Commit
fc54bae28818("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Pali Rohár <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>--- drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)drivers/pci/controller/pcie-iproc-msi.c +9
-9@@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); -/* Allocate 'nr_cpus' number of MSI vectors each time */ - hwirq =bitmap_find_next_zero_area (msi->bitmap, msi->nr_msi_vecs,0 , - msi->nr_cpus,0 ); -if (hwirq < msi->nr_msi_vecs) { -bitmap_set (msi->bitmap, hwirq, msi->nr_cpus); - }else { -mutex_unlock (&msi->bitmap_lock); -return -ENOSPC ; - } +/* +* Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors +* each time +*/ + hwirq =bitmap_find_free_region (msi->bitmap, msi->nr_msi_vecs, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock); +if (hwirq <0 ) +return -ENOSPC ; +for (i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &iproc_msi_bottom_irq_chip,
drivers/pci/controller/pcie-iproc-msi.c static void iproc_msi_irq_domain_free(struct irq_domain *domain, · line 291
Quoted 9 lines
drivers/pci/controller/pcie-iproc-msi.c +2
-1@@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); hwirq =hwirq_to_canonical_hwirq (msi, data->hwirq); -bitmap_clear (msi->bitmap, hwirq, msi->nr_cpus); +bitmap_release_region (msi->bitmap, hwirq, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock);
Looks good to me too. Thanks.
Quoted 8 lines · Sandor Bodo-Merle
Commit
fc54bae28818("PCI: iproc: Allow allocation of multiple MSIs") introduced multi-MSI support with a broken allocation mechanism (it failed to reserve the proper number of bits from the inner domain). Natural alignment of the base vector number was also not guaranteed.Fixes fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs")Reported-by Pali Rohár <[email protected]>Signed-off-by Sandor Bodo-Merle <[email protected]>
Looks good to me; thanks for splitting this. I think Lorenzo will take care of this and maybe he'll also adjust the subject to match the other patch, e.g.,
- PCI: iproc: fix the base vector number allocation for multi-MSI
+ PCI: iproc: Fix multi-MSI base vector number allocation
Quoted 49 lines
--- drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)drivers/pci/controller/pcie-iproc-msi.c +11
-10@@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); -/* Allocate 'nr_cpus' number of MSI vectors each time */ - hwirq =bitmap_find_next_zero_area (msi->bitmap, msi->nr_msi_vecs,0 , - msi->nr_cpus,0 ); -if (hwirq < msi->nr_msi_vecs) { -bitmap_set (msi->bitmap, hwirq, msi->nr_cpus); - }else { -mutex_unlock (&msi->bitmap_lock); -return -ENOSPC ; - } +/* +* Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors +* each time +*/ + hwirq =bitmap_find_free_region (msi->bitmap, msi->nr_msi_vecs, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock); +if (hwirq <0 ) +return -ENOSPC ; +for (i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &iproc_msi_bottom_irq_chip,@@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_domain *domain,mutex_lock (&msi->bitmap_lock); hwirq =hwirq_to_canonical_hwirq (msi, data->hwirq); -bitmap_clear (msi->bitmap, hwirq, msi->nr_cpus); +bitmap_release_region (msi->bitmap, hwirq, +order_base_2 (msi->nr_cpus * nr_irqs));mutex_unlock (&msi->bitmap_lock);Signature · 1 line
2.31.0