diff options
Diffstat (limited to 'kernel/irq/irqdomain.c')
-rw-r--r-- | kernel/irq/irqdomain.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 49a77727db42..4e69e24d3d7d 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -148,7 +148,8 @@ static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain, | |||
148 | * @host_data: Controller private data pointer | 148 | * @host_data: Controller private data pointer |
149 | * | 149 | * |
150 | * Allocates a legacy irq_domain if irq_base is positive or a linear | 150 | * Allocates a legacy irq_domain if irq_base is positive or a linear |
151 | * domain otherwise. | 151 | * domain otherwise. For the legacy domain, IRQ descriptors will also |
152 | * be allocated. | ||
152 | * | 153 | * |
153 | * This is intended to implement the expected behaviour for most | 154 | * This is intended to implement the expected behaviour for most |
154 | * interrupt controllers which is that a linear mapping should | 155 | * interrupt controllers which is that a linear mapping should |
@@ -162,11 +163,33 @@ struct irq_domain *irq_domain_add_simple(struct device_node *of_node, | |||
162 | const struct irq_domain_ops *ops, | 163 | const struct irq_domain_ops *ops, |
163 | void *host_data) | 164 | void *host_data) |
164 | { | 165 | { |
165 | if (first_irq > 0) | 166 | if (first_irq > 0) { |
166 | return irq_domain_add_legacy(of_node, size, first_irq, 0, | 167 | int irq_base; |
168 | |||
169 | if (IS_ENABLED(CONFIG_SPARSE_IRQ)) { | ||
170 | /* | ||
171 | * Set the descriptor allocator to search for a | ||
172 | * 1-to-1 mapping, such as irq_alloc_desc_at(). | ||
173 | * Use of_node_to_nid() which is defined to | ||
174 | * numa_node_id() on platforms that have no custom | ||
175 | * implementation. | ||
176 | */ | ||
177 | irq_base = irq_alloc_descs(first_irq, first_irq, size, | ||
178 | of_node_to_nid(of_node)); | ||
179 | if (irq_base < 0) { | ||
180 | WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n", | ||
181 | first_irq); | ||
182 | irq_base = first_irq; | ||
183 | } | ||
184 | } else | ||
185 | irq_base = first_irq; | ||
186 | |||
187 | return irq_domain_add_legacy(of_node, size, irq_base, 0, | ||
167 | ops, host_data); | 188 | ops, host_data); |
168 | else | 189 | } |
169 | return irq_domain_add_linear(of_node, size, ops, host_data); | 190 | |
191 | /* A linear domain is the default */ | ||
192 | return irq_domain_add_linear(of_node, size, ops, host_data); | ||
170 | } | 193 | } |
171 | 194 | ||
172 | /** | 195 | /** |