On 05/19/2011 02:54 PM, Gleb Natapov wrote:
> > In this case the device would call a chipset function, passing the > memory region as a parameter, and the chipset would call > m_r_add_subregion(). But then chipset can resolve all overlapping by itself and register only regions that are actually accessible by a guest software.
Sure it can (and it does now), but it's hard. This API centralizes the logic, leaving the devices/chipsets to specify what they want.
For a PC, we have at least two such cases, the ISA bus and the PCI bus.
Also there are devices that on some architectures are accessed through a chipset and on other they resides directly on a system bus. If they will need to call different memory registration api depending on how they are instantiated the code can become messy.
An example is ne2000-isa and ne2000-pci. There's no getting around some glue logic, but I think this API minimizes it (you can declare everything about your memory region in common code, the only thing that is different is registration).
-- error compiling committee.c: too many arguments to function