unmap all the memory maped memory for guest ram.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
void kvm__arch_set_cmdline(char *cmdline, bool video);
void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size);
+void kvm__arch_delete_ram(struct kvm *kvm);
int kvm__arch_setup_firmware(struct kvm *kvm);
bool kvm__arch_cpu_supports_vm(void);
void kvm__arch_periodic_poll(struct kvm *kvm);
{
kvm__stop_timer(kvm);
- munmap(kvm->ram_start, kvm->ram_size);
+ kvm__arch_delete_ram(kvm);
kvm_ipc__stop();
kvm__remove_socket(kvm->name);
free(kvm);
"which is not yet supported.");
}
+void kvm__arch_delete_ram(struct kvm *kvm)
+{
+ munmap(kvm->ram_start, kvm->ram_size);
+}
+
void kvm__irq_line(struct kvm *kvm, int irq, int level)
{
fprintf(stderr, "irq_line(%d, %d)\n", irq, level);
die_perror("KVM_CREATE_IRQCHIP ioctl");
}
+void kvm__arch_delete_ram(struct kvm *kvm)
+{
+ if (kvm->ram_size < KVM_32BIT_GAP_START)
+ munmap(kvm->ram_start, kvm->ram_size);
+ else
+ munmap(kvm->ram_start, kvm->ram_size + KVM_32BIT_GAP_SIZE);
+}
+
void kvm__irq_line(struct kvm *kvm, int irq, int level)
{
struct kvm_irq_level irq_level;