On Sun, May 22, 2011 at 2:36 PM, Avi Kivity <avi@xxxxxxxxxx> wrote: > On 05/22/2011 12:32 PM, Blue Swirl wrote: >> >> >> Â> Â Â+void memory_region_add_coalescing(MemoryRegion *mr, >> >> Â> Â Â+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âtarget_phys_addr_t offset, >> >> Â> Â Â+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âtarget_phys_addr_t size); >> >> Â> Â Â+/* Disable MMIO coalescing for the region. */ >> >> Â> Â Â+void memory_region_clear_coalescing(MemoryRegion *mr); >> >> >> >> ÂPerhaps the interface could be more generic, like >> >> Â+void memory_region_set_property(MemoryRegion *mr, unsigned flags); >> >> Â+void memory_region_clear_property(MemoryRegion *mr, unsigned flags); >> >> >> > >> > ÂCoalescing is a complex property, not just a boolean attribute. ÂWe >> > probably >> > Âwill have a number of boolean attributes later, though. >> >> But what is the difference between adding coalescing to an area and >> setting the bit property 'coalescing' to an area? At least what you >> propose now is not so complex that it couldn't be handled as a single >> bit. > > Look at the API - add_coalescing() sets the coalescing property on a > subrange of the memory region, not the entire region. Right, but doesn't the same apply to any other properties, they may apply to a full range or just a subrange? > (motivation - hw/e1000.c). > >> >> Â> Â Â+ * conflicts are resolved by having a higher @priority hide a >> >> lower >> >> Â> Â@priority. >> >> Â> Â Â+ * Subregions without priority are taken as @priority 0. >> >> Â> Â Â+ */ >> >> Â> Â Â+void memory_region_add_subregion_overlap(MemoryRegion *mr, >> >> Â> Â Â+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â target_phys_addr_t >> >> offset, >> >> Â> Â Â+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â MemoryRegion >> >> *subregion, >> >> Â> Â Â+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â unsigned priority); >> >> Â> Â Â+/* Remove a subregion. */ >> >> Â> Â Â+void memory_region_del_subregion(MemoryRegion *mr, >> >> Â> Â Â+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â MemoryRegion *subregion); >> >> >> >> ÂWhat would the subregions be used for? >> > >> > ÂSubregions describe the flow of data through the memory bus. ÂWe'd have >> > a >> > Âsubregion for the PCI bus, with its own subregions for various BARs, >> > with >> > Âsome having subregions for dispatching different MMIO types within the >> > BAR. >> > >> > ÂThis allows, for example, the PCI layer to move a BAR without the PCI >> > device >> > Âknowing anything about it. >> >> But why can't a first class region be used for that? > > Subregions are first-class regions. ÂIn fact all regions are subregions > except the root. Oh, I see now. Maybe the comments should describe this. Or perhaps the terms should be something like 'bus/bridge/root' and 'region' instead of 'region' and 'subregion'? > It's a tree of regions, each level adding an offset, clipping, and perhaps > other attributes, with the leaves providing actual memory (mmio or RAM). I thought that there are two classes of regions, like PCI device vs. a single BAR. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html