On 2024-12-09 1:12 AM, Chen Wang wrote:[......]
+How does this work? The irqdomain is instantiated with size == priv->num_irqs,
+static int sg2042_msi_allocate_hwirq(struct sg2042_msi_data *priv, int num_req)
+{
+ int first;
+
+ guard(mutex)(&priv->msi_map_lock);
+ first = bitmap_find_free_region(priv->msi_map, priv->num_irqs,
+ get_count_order(num_req));
+ return first >= 0 ? priv->irq_first + first : -ENOSPC;
so hwirqs must be less than priv->num_irqs. It also quite simplifies the code
for hwirq be a number between 0 and priv->num_irqs. You only need to apply the
offset when allocating the parent IRQ:
fwspec.param[0] = priv->irq_first + hwirq;