On Tue, Nov 02, 2010 at 08:00:38AM -0600, Alex Williamson wrote: > On Tue, 2010-11-02 at 11:25 +0200, Michael S. Tsirkin wrote: > > On Mon, Nov 01, 2010 at 11:37:53PM -0600, Alex Williamson wrote: > > > Avoid needing to get the MSI capability flags every time we need to > > > check the capability length. This also makes it accessible outside > > > of msi.c, making it easier for users to filter config space writes > > > using msi_cap and msi_cap_size. > > > > I think for this last use-case, we are better off with returning a > > boolean from msi_write_config which tells us whether the write is in > > range. This has the advantage in that it will also work well for other > > capabilities. Or second best, if that is insufficient for some reason, > > export an msi_cap_size function. > > Returning whether the write was in range isn't enough. For device > assignment, I need to know whether the capability was enabled or > disabled. This currently means checking the enable state before and > after calling msi_write_config and doing the appropriate backend setup.
Sounds good. Why does this mean you need the capability size? bool was_enabled = msi_enabled(dev); msi_write_config(..) if (was_enabled != msi_enabled(dev)) { } > I think the only way I could blindly call the msi/x write config > routines is if we init the capability with enable/disable callbacks. > I'd be ok with an msi_cap_size function if we don't want to go that far > too. What do you prefer? Thanks, > > Alex