On Fri, Nov 18, 2022 at 11:08:55PM +0100, Thomas Gleixner wrote: > I looked into this and it gets ugly very fast. > > The above has two parts: > > iobase is domain specific and setup by the domain code > > cookie is per interrupt allocation. That's where the instance > queue or whatever connects to the domain. > > I can abuse the fields for PCI/MSI of course, but see below. I don't know that we need to store the second one forever in the desc. I was thinking this information is ephemeral, just used during alloc, and if the msi domain driver wishes some of it to be stored then it should do so. > Sure I could make both cookies plain u64, but I hate these forced type > casts and the above is simple to handle and understand. I guess, they aren't what I think of as cookies, so I wouldn't make them u64 in the first place. The argument to msi_domain_alloc_irq_at() ideally wants to be a per-domain-type struct so we can folow it around more cleanly. This is C so we have to type erase it as a void * through the core code, but OK. The second one is typically called "driver private data" in device driver subsystems that can't use container_of for some reason - just a chunk of data the driver can associate with a core owned struct. The usual pattern for driver private data is for the core to provide some kind of accessor void *get_priv() (think dev_get_drvdata()) or whatever. But I do understand your point about keeping the drivers away from things. Maybe some other pattern is better in this case. Jason