Re: [patch 19/33] genirq/msi: Provide msi_desc::msi_data

From: Thomas Gleixner
Date: Thu Nov 17 2022 - 03:49:16 EST


On Wed, Nov 16 2022 at 15:28, Jason Gunthorpe wrote:
> On Fri, Nov 11, 2022 at 02:58:41PM +0100, Thomas Gleixner wrote:
>> +/**
>> + * struct msi_desc_data - Generic MSI descriptor data
>> + * @iobase: Pointer to the IOMEM base adress for interrupt callbacks
>> + * @cookie: Device cookie provided at allocation time
>> + *
>> + * The content of this data is implementation defined, e.g. PCI/IMS
>> + * implementations will define the meaning of the data.
>> + */
>> +struct msi_desc_data {
>> + void __iomem *iobase;
>> + union msi_dev_cookie cookie;
>> +};
>
> It would be nice to see the pci_msi_desc converted to a domain
> specific storage as well.
>
> Maybe could be written
>
> struct msi_desc {
> u64 domain_data[2];
> }
>
> struct pci_msi_desc {
> u32 msi_mask;
> u8 multiple : 3;
> u8 multi_cap : 3;
> u8 can_mask : 1;
> u8 is_64 : 1;
> u8 mask_pos;
> u16 default_irq;
> }
> static_assert(sizeof(struct pci_msi_desc) <= sizeof(((struct msi_desc *)0)->domain_data));
>
> struct pci_msix_desc {
> u32 msix_ctrl;
> u8 multiple : 3;
> u8 multi_cap : 3;
> u8 can_mask : 1;
> u8 is_64 : 1;
> u16 default_irq;
> void __iomem *mask_base;
> }
> static_assert(sizeof(struct pci_msix_desc) <= sizeof(((struct msi_desc *)0)->domain_data));
>
> ideally hidden in the pci code with some irq_chip facing export API to
> snoop in the bits a few places need
>
> We've used 128 bits for the PCI descriptor, we might as well like
> everyone have all 128 bits for whatever they want to do

Not sure because we end up with nasty type casts for

> struct msi_desc {
> u64 domain_data[2];
> }

Let me think about it.

Thanks,

tglx