mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
kvm-all: drop kvm_setup_guest_memory
kvm_setup_guest_memory only does "madvise to QEMU_MADV_DONTFORK" and is only called by ram_block_add, which actually is duplicate code. Bonus: add simple comment for kvm_has_sync_mmu to make life easier. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Message-Id: <1473662096-32598-1-git-send-email-caoj.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a952c18683
commit
c2cd627ddb
4 changed files with 2 additions and 22 deletions
15
kvm-all.c
15
kvm-all.c
|
@ -2148,6 +2148,7 @@ void kvm_device_access(int fd, int group, uint64_t attr,
|
|||
}
|
||||
}
|
||||
|
||||
/* Return 1 on success, 0 on failure */
|
||||
int kvm_has_sync_mmu(void)
|
||||
{
|
||||
return kvm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
|
||||
|
@ -2190,20 +2191,6 @@ int kvm_has_intx_set_mask(void)
|
|||
return kvm_state->intx_set_mask;
|
||||
}
|
||||
|
||||
void kvm_setup_guest_memory(void *start, size_t size)
|
||||
{
|
||||
if (!kvm_has_sync_mmu()) {
|
||||
int ret = qemu_madvise(start, size, QEMU_MADV_DONTFORK);
|
||||
|
||||
if (ret) {
|
||||
perror("qemu_madvise");
|
||||
fprintf(stderr,
|
||||
"Need MADV_DONTFORK in absence of synchronous KVM MMU\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KVM_CAP_SET_GUEST_DEBUG
|
||||
struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu,
|
||||
target_ulong pc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue