RE: [patch V2 02/33] genirq/msi: Provide struct msi_parent_ops

From: Tian, Kevin
Date: Wed Nov 23 2022 - 02:58:15 EST


> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Sent: Monday, November 21, 2022 10:38 PM
>
> +/**
> + * msi_parent_init_dev_msi_info - Delegate initialization of device MSI info
> down
> + * in the domain hierarchy
> + * @dev: The device for which the domain should be created
> + * @domain: The domain in the hierarchy this op is being called on
> + * @msi_parent_domain: The IRQ_DOMAIN_FLAG_MSI_PARENT
> domain for the child to
> + * be created
> + * @msi_child_info: The MSI domain info of the
> IRQ_DOMAIN_FLAG_MSI_DEVICE
> + * domain to be created
> + *
> + * Return: true on success, false otherwise
> + *
> + * This is the most complex problem of per device MSI domains and the
> + * underlying interrupt domain hierarchy:
> + *
> + * The device domain to be initialized requests the broadest feature set
> + * possible and the underlying domain hierarchy puts restrictions on it.
> + *
> + * That's trivial for a simple parent->child relationship, but it gets
> + * interesting with an intermediate domain: root->parent->child. The
> + * intermediate 'parent' can expand the capabilities which the 'root'
> + * domain is providing. So that creates a classic hen and egg problem:
> + * Which entity is doing the restrictions/expansions?
> + *
> + * One solution is to let the root domain handle the initialization that's
> + * why there is the @domain and the @msi_parent_domain pointer.

This is the part which I don't quite understand (sorry with limited knowledge
in this area).

In concept a hierarchical model has restrictions added up when moving
down to lower layers i.e. presumably the root domain decides the minimal
supported capabilities. In this case there is no need of a real parent pointer
as long as every domain in the stack incrementally adds its restrictions to
info->flags.

I can see why this is required for x86 given that MULTI_MSI is supported
only with IR. and we cannot make vector domain inclusively claiming
MULTI_MSI since it's completely broken when the vector domain becomes
the parent itself, in absence of IR.

Just be curious whether this intermediate-parent-deciding-restrictions
is generic instead of x86 specific, e.g. is it possible to have a 4-layers
hierarchy where the root parent wants to check both two intermediate
parents?

Thanks
Kevin