lkml.org 
[lkml]   [2022]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [patch 21/33] genirq/msi: Provide msi_domain_alloc_irq_at()
Date
On Fri, Nov 18 2022 at 10:15, Thomas Gleixner wrote:
> On Fri, Nov 18 2022 at 01:58, Thomas Gleixner wrote:
> Of course I "tested" this by flipping default and secondary domain
> around and doing dynamic allocations from PCI/MSI-X but that won't catch
> the bug because PCI/MSI-X does not have the ALLOC_SIMPLE_DESCS flag set.
>
> Let me fix that.

Delta patch against

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git devmsi-v1G-part3

below.

Thanks,

tglx
---
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index d4f26649a185..d243ad3e5489 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -141,7 +141,7 @@ static int msi_insert_desc(struct device *dev, struct msi_desc *desc,
if (ret)
goto fail;

- desc->msi_index = index;
+ desc->msi_index = index - baseidx;
return 0;
} else {
if (index >= hwsize) {
@@ -1476,9 +1476,10 @@ struct msi_map msi_domain_alloc_irq_at(struct device *dev, unsigned int domid, u
const struct irq_affinity_desc *affdesc,
union msi_dev_cookie *cookie)
{
+ struct msi_ctrl ctrl = { .domid = domid, .nirqs = 1, };
+ struct msi_domain_info *info;
struct irq_domain *domain;
struct msi_map map = { };
- struct msi_desc *desc;
int ret;

msi_lock_descs(dev);
@@ -1503,12 +1504,16 @@ struct msi_map msi_domain_alloc_irq_at(struct device *dev, unsigned int domid, u
goto unlock;
}

- map.index = desc->msi_index;
- ret = msi_domain_alloc_irqs_range_locked(dev, domid, map.index, map.index);
- if (ret)
+ ctrl.first = ctrl.last = desc->msi_index;
+ info = domain->host_data;
+
+ ret = __msi_domain_alloc_irqs(dev, domain, &ctrl);
+ if (ret) {
map.index = ret;
- else
+ msi_domain_free_locked(dev, &ctrl);
+ } else {
map.virq = desc->irq;
+ }
unlock:
msi_unlock_descs(dev);
return map;
\
 
 \ /
  Last update: 2022-11-18 12:07    [W:0.127 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site