Re: [patch 13/33] x86/apic/vector: Provide MSI parent domain

From: Jason Gunthorpe
Date: Wed Nov 16 2022 - 14:18:29 EST


On Fri, Nov 11, 2022 at 02:58:31PM +0100, Thomas Gleixner wrote:

> +/**
> + * x86_vector_init_dev_msi_info - Domain info setup for MSI domains
> + * @dev: The device for which the domain should be created
> + * @domain: The (root) domain providing this callback
> + * @real_parent: The real parent domain of the to initialize domain
> + * @info: The domain info for the to initialize domain
> + *
> + * This function is to be used for all types of MSI domains above the x86
> + * vector domain and any intermediates. The domain specific functionality
> + * is determined via the @real_parent.
> + */
> +static bool x86_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
> + struct irq_domain *real_parent, struct msi_domain_info *info)
> +{
> + const struct msi_parent_ops *pops = real_parent->msi_parent_ops;
> +
> + /* MSI parent domain specific settings */
> + switch (real_parent->bus_token) {
> + case DOMAIN_BUS_ANY:
> + /* Only the vector domain can have the ANY token */
> + if (WARN_ON_ONCE(domain != real_parent))
> + return false;
> + info->chip->irq_set_affinity = msi_set_affinity;
> + /* See msi_set_affinity() for the gory details */
> + info->flags |= MSI_FLAG_NOMASK_QUIRK;
> + break;
> + default:
> + WARN_ON_ONCE(1);
> + return false;
> + }
> +
> + /* Is the target supported? */
> + switch(info->bus_token) {
> + case DOMAIN_BUS_PCI_DEVICE_MSI:
> + case DOMAIN_BUS_PCI_DEVICE_MSIX:
> + break;
> + default:
> + WARN_ON_ONCE(1);
> + return false;

Why does x86 care how the vector is ultimately programmed into the
device?

The leaking of the MSI programming model into the irq implementations
seems like there is still a troubled modularity.

I understand that some implementations rely on a hypercall/trap or
whatever and must know MSI vs MSI-X, but I'm surprised to see this
here.

Jason