On 2011-09-19 14:42, Avi Kivity wrote: > On 09/19/2011 03:32 PM, Jan Kiszka wrote: >> > It's opt-in. If a device sets >> > MemoryRegionOps::impl.{min,max}_access_size = 1, it will only be fed >> > byte accesses (the core will take care of breaking apart larger >> > writes). If it sets MemoryRegionOps::impl.{min,max}_access_size = >> 4, it >> > will only get long accesses (and the core will/should shift/mask or >> > RMW). Refusing illegal access sizes is done using >> > MemoryRegionOps::valid. Most of this is unimplemented unfortunately. >> >> That makes sense (for non-old_portio users). >> >> > > The trick of having a way to register N callbacks with one shot is worth > growing. Ideally each register in a BAR would have a callback and we'd > do something like > > MemoryRegionOps mydev_ops = { > .registers = { > { MYDEV_REG_x, 4, 4, mydev_reg_x_read, mydev_reg_x_write, }, > ... > }, > } > > with hints to the core like "this register sits at this offset, use it > for reads instead of a callback", or, "this is a read-only register".
This has pros and cons. If you have n registers to dispatch, you then have to write n function prologues and maybe epilogues instead of just one. Specifically if the register access is trivial, that could case quite some LoC blowup on the device side. What may have a better ratio are generic register get/set handlers. Jan
signature.asc
Description: OpenPGP digital signature