Re: [patch V2 09/21] genirq/msi: Make MSI descriptor iterators device domain aware

From: Thomas Gleixner
Date: Thu Nov 24 2022 - 10:55:24 EST


On Thu, Nov 24 2022 at 15:46, Marc Zyngier wrote:
> On Mon, 21 Nov 2022 14:36:29 +0000,
> Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> +static int msi_get_domain_base_index(struct device *dev, unsigned int domid)
>> +{
>> + lockdep_assert_held(&dev->msi.data->mutex);
>> +
>> + if (WARN_ON_ONCE(domid >= MSI_MAX_DEVICE_IRQDOMAINS))
>> + return -ENODEV;
>> +
>> + if (WARN_ON_ONCE(!dev->msi.data->__irqdomains[domid]))
>> + return -ENODEV;
>> +
>> + return domid * MSI_XA_DOMAIN_SIZE;
>> +}
>
> So what I understand of this is that we split the index space into
> segments, one per msi_domain_ids, MSI_XA_DOMAIN_SIZE apart.
>
> Why didn't you decide to go all the way and have one xarray per
> irqdomain? It's not that big a structure, and it would make the whole
> thing a bit more straightforward.
>
> Or do you anticipate cases where you'd walk the __store xarray across
> irqdomains?

Not really. I just found it conveniant to deal with one, but yes we
could do the same thing with two xarrays.

But at the very end it does not make a huge difference. Fine with me
either way.

Thanks,

tglx