Merge tag 'pull-target-arm-20221114' of https://git.linaro.org/people/pmaydell/qemu...
[qemu/ar7.git] / include / sysemu / block-ram-registrar.h
blobd8b2f7942ba1650bdf5b4244a05667a496ce089e
1 /*
2 * BlockBackend RAM Registrar
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
7 #ifndef BLOCK_RAM_REGISTRAR_H
8 #define BLOCK_RAM_REGISTRAR_H
10 #include "exec/ramlist.h"
12 /**
13 * struct BlockRAMRegistrar:
15 * Keeps RAMBlock memory registered with a BlockBackend using
16 * blk_register_buf() including hotplugged memory.
18 * Emulated devices or other BlockBackend users initialize a BlockRAMRegistrar
19 * with blk_ram_registrar_init() before submitting I/O requests with the
20 * BDRV_REQ_REGISTERED_BUF flag set.
22 typedef struct {
23 BlockBackend *blk;
24 RAMBlockNotifier notifier;
25 bool ok;
26 } BlockRAMRegistrar;
28 void blk_ram_registrar_init(BlockRAMRegistrar *r, BlockBackend *blk);
29 void blk_ram_registrar_destroy(BlockRAMRegistrar *r);
31 /* Have all RAMBlocks been registered successfully? */
32 static inline bool blk_ram_registrar_ok(BlockRAMRegistrar *r)
34 return r->ok;
37 #endif /* BLOCK_RAM_REGISTRAR_H */