On Sun, May 22, 2011 at 9:45 AM, Avi Kivity <avi@xxxxxxxxxx> wrote: > On 05/20/2011 08:59 PM, Blue Swirl wrote: >> >> On Thu, May 19, 2011 at 5:12 PM, Avi Kivity<avi@xxxxxxxxxx> Âwrote: >> > ÂThe memory API separates the attributes of a memory region (its size, >> > how >> > Âreads or writes are handled, dirty logging, and coalescing) from where >> > it >> > Âis mapped and whether it is enabled. ÂThis allows a device to configure >> > Âa memory region once, then hand it off to its parent bus to map it >> > according >> > Âto the bus configuration. >> > >> > ÂHierarchical registration also allows a device to compose a region out >> > of >> > Âa number of sub-regions with different properties; for example some may >> > be >> > ÂRAM while others may be MMIO. > >> > Â+void memory_region_set_log(MemoryRegion *mr, bool log, unsigned >> > client); >> > Â+/* Enable memory coalescing for the region. ÂMMIO ->write callbacks >> > may be >> > Â+ * delayed until a non-coalesced MMIO is issued. >> > Â+ */ >> > Â+void memory_region_set_coalescing(MemoryRegion *mr); >> > Â+/* Enable memory coalescing for a sub-range of the region. ÂMMIO >> > ->write >> > Â+ * callbacks may be delayed until a non-coalesced MMIO is issued. >> > Â+ */ >> > Â+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. >> > Â+ * 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? -- 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