mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
system/physmem: Per-AddressSpace bounce buffering
Instead of using a single global bounce buffer, give each AddressSpace its own bounce buffer. The MapClient callback mechanism moves to AddressSpace accordingly. This is in preparation for generalizing bounce buffer handling further to allow multiple bounce buffers, with a total allocation limit configured per AddressSpace. Reviewed-by: Peter Xu <peterx@redhat.com> Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Mattias Nissler <mnissler@rivosinc.com> Message-ID: <20240507094210.300566-2-mnissler@rivosinc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> [PMD: Split patch, part 2/2] Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
5c62719710
commit
69e78f1b34
3 changed files with 53 additions and 46 deletions
|
@ -1112,6 +1112,19 @@ struct MemoryListener {
|
|||
QTAILQ_ENTRY(MemoryListener) link_as;
|
||||
};
|
||||
|
||||
typedef struct AddressSpaceMapClient {
|
||||
QEMUBH *bh;
|
||||
QLIST_ENTRY(AddressSpaceMapClient) link;
|
||||
} AddressSpaceMapClient;
|
||||
|
||||
typedef struct {
|
||||
MemoryRegion *mr;
|
||||
void *buffer;
|
||||
hwaddr addr;
|
||||
hwaddr len;
|
||||
bool in_use;
|
||||
} BounceBuffer;
|
||||
|
||||
/**
|
||||
* struct AddressSpace: describes a mapping of addresses to #MemoryRegion objects
|
||||
*/
|
||||
|
@ -1129,6 +1142,12 @@ struct AddressSpace {
|
|||
struct MemoryRegionIoeventfd *ioeventfds;
|
||||
QTAILQ_HEAD(, MemoryListener) listeners;
|
||||
QTAILQ_ENTRY(AddressSpace) address_spaces_link;
|
||||
|
||||
/* Bounce buffer to use for this address space. */
|
||||
BounceBuffer bounce;
|
||||
/* List of callbacks to invoke when buffers free up */
|
||||
QemuMutex map_client_list_lock;
|
||||
QLIST_HEAD(, AddressSpaceMapClient) map_client_list;
|
||||
};
|
||||
|
||||
typedef struct AddressSpaceDispatch AddressSpaceDispatch;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue