Re: [patch 08/20] genirq/msi: Make MSI descriptor iterators device domain aware

From: Jason Gunthorpe
Date: Wed Nov 16 2022 - 13:36:16 EST


On Fri, Nov 11, 2022 at 02:56:50PM +0100, Thomas Gleixner wrote:
> To support multiple MSI interrupt domains per device it is necessary to
> segment the xarray MSI descriptor storage. Each domain gets up to
> MSI_MAX_INDEX entries.

This kinds of suggests that the new per-device MSI domains should hold
this storage instead of per-device xarray?

I suppose the reason to avoid this is because alot of the driver
facing API is now built on vector index numbers that index this
xarray?

But on the other hand can we just say drivers using multiple domains
are "new" and they should use some new style pointer based interface
so we don't have to have arrays of things?

At least, I'd like to understand a bit better the motivation for using
a domain ID instead of a pointer.

It feels like we are baking in several hard coded limits with this
choice

> +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;
> +}
> +
> +
> /**

Extra new line

Jason