mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
ramblock-notifier: new
This adds a notify interface of ram block additions and removals. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
fb5e19d2e1
commit
0987d735a3
6 changed files with 112 additions and 49 deletions
29
numa.c
29
numa.c
|
@ -25,6 +25,7 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "sysemu/numa.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "exec/ramlist.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include "qom/cpu.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
@ -572,3 +573,31 @@ int numa_get_node_for_cpu(int idx)
|
|||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void ram_block_notifier_add(RAMBlockNotifier *n)
|
||||
{
|
||||
QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next);
|
||||
}
|
||||
|
||||
void ram_block_notifier_remove(RAMBlockNotifier *n)
|
||||
{
|
||||
QLIST_REMOVE(n, next);
|
||||
}
|
||||
|
||||
void ram_block_notify_add(void *host, size_t size)
|
||||
{
|
||||
RAMBlockNotifier *notifier;
|
||||
|
||||
QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
|
||||
notifier->ram_block_added(notifier, host, size);
|
||||
}
|
||||
}
|
||||
|
||||
void ram_block_notify_remove(void *host, size_t size)
|
||||
{
|
||||
RAMBlockNotifier *notifier;
|
||||
|
||||
QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
|
||||
notifier->ram_block_removed(notifier, host, size);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue