Message ID | 1349280245-16341-7-git-send-email-avi@redhat.com |
---|---|
State | New |
Headers | show |
Avi Kivity <avi@redhat.com> writes: > The DMA API will use an AddressSpace to differentiate among different > initiators. > > Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Regards, Anthony Liguori > --- > memory.c | 11 +---------- > memory.h | 21 +++++++++++++++++++++ > 2 files changed, 22 insertions(+), 10 deletions(-) > > diff --git a/memory.c b/memory.c > index 7e9e373..431a867 100644 > --- a/memory.c > +++ b/memory.c > @@ -216,17 +216,8 @@ struct FlatView { > unsigned nr_allocated; > }; > > -typedef struct AddressSpace AddressSpace; > typedef struct AddressSpaceOps AddressSpaceOps; > > -/* A system address space - I/O, memory, etc. */ > -struct AddressSpace { > - MemoryRegion *root; > - FlatView *current_map; > - int ioeventfd_nb; > - MemoryRegionIoeventfd *ioeventfds; > -}; > - > #define FOR_EACH_FLAT_RANGE(var, view) \ > for (var = (view)->ranges; var < (view)->ranges + (view)->nr; ++var) > > @@ -1510,7 +1501,7 @@ void memory_listener_unregister(MemoryListener *listener) > QTAILQ_REMOVE(&memory_listeners, listener, link); > } > > -static void address_space_init(AddressSpace *as, MemoryRegion *root) > +void address_space_init(AddressSpace *as, MemoryRegion *root) > { > memory_region_transaction_begin(); > as->root = root; > diff --git a/memory.h b/memory.h > index 37ce151..a1d75e7 100644 > --- a/memory.h > +++ b/memory.h > @@ -157,6 +157,19 @@ struct MemoryRegionPortio { > > #define PORTIO_END_OF_LIST() { } > > +typedef struct AddressSpace AddressSpace; > + > +/** > + * AddressSpace: describes a mapping of addresses to #MemoryRegion objects > + */ > +struct AddressSpace { > + /* All fields are private. */ > + MemoryRegion *root; > + struct FlatView *current_map; > + int ioeventfd_nb; > + struct MemoryRegionIoeventfd *ioeventfds; > +}; > + > typedef struct MemoryRegionSection MemoryRegionSection; > > /** > @@ -776,6 +789,14 @@ void memory_global_dirty_log_stop(void); > > void mtree_info(fprintf_function mon_printf, void *f); > > +/** > + * address_space_init: initializes an address space > + * > + * @as: an uninitialized #AddressSpace > + * @root: a #MemoryRegion that routes addesses for the address space > + */ > +void address_space_init(AddressSpace *as, MemoryRegion *root); > + > #endif > > #endif > -- > 1.7.12
diff --git a/memory.c b/memory.c index 7e9e373..431a867 100644 --- a/memory.c +++ b/memory.c @@ -216,17 +216,8 @@ struct FlatView { unsigned nr_allocated; }; -typedef struct AddressSpace AddressSpace; typedef struct AddressSpaceOps AddressSpaceOps; -/* A system address space - I/O, memory, etc. */ -struct AddressSpace { - MemoryRegion *root; - FlatView *current_map; - int ioeventfd_nb; - MemoryRegionIoeventfd *ioeventfds; -}; - #define FOR_EACH_FLAT_RANGE(var, view) \ for (var = (view)->ranges; var < (view)->ranges + (view)->nr; ++var) @@ -1510,7 +1501,7 @@ void memory_listener_unregister(MemoryListener *listener) QTAILQ_REMOVE(&memory_listeners, listener, link); } -static void address_space_init(AddressSpace *as, MemoryRegion *root) +void address_space_init(AddressSpace *as, MemoryRegion *root) { memory_region_transaction_begin(); as->root = root; diff --git a/memory.h b/memory.h index 37ce151..a1d75e7 100644 --- a/memory.h +++ b/memory.h @@ -157,6 +157,19 @@ struct MemoryRegionPortio { #define PORTIO_END_OF_LIST() { } +typedef struct AddressSpace AddressSpace; + +/** + * AddressSpace: describes a mapping of addresses to #MemoryRegion objects + */ +struct AddressSpace { + /* All fields are private. */ + MemoryRegion *root; + struct FlatView *current_map; + int ioeventfd_nb; + struct MemoryRegionIoeventfd *ioeventfds; +}; + typedef struct MemoryRegionSection MemoryRegionSection; /** @@ -776,6 +789,14 @@ void memory_global_dirty_log_stop(void); void mtree_info(fprintf_function mon_printf, void *f); +/** + * address_space_init: initializes an address space + * + * @as: an uninitialized #AddressSpace + * @root: a #MemoryRegion that routes addesses for the address space + */ +void address_space_init(AddressSpace *as, MemoryRegion *root); + #endif #endif
The DMA API will use an AddressSpace to differentiate among different initiators. Signed-off-by: Avi Kivity <avi@redhat.com> --- memory.c | 11 +---------- memory.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-)