@@ -61,11 +61,6 @@ void kvm__init_ram(struct kvm *kvm)
phys_start, phys_start + phys_size - 1, (u64)kvm->ram_start);
}
-void kvm__arch_delete_ram(struct kvm *kvm)
-{
- munmap(kvm->ram_start, kvm->ram_size);
-}
-
void kvm__arch_read_term(struct kvm *kvm)
{
serial8250__update_consoles(kvm);
@@ -198,7 +198,6 @@ void kvm__arch_validate_cfg(struct kvm *kvm);
void kvm__arch_set_cmdline(char *cmdline, bool video);
void kvm__arch_init(struct kvm *kvm);
u64 kvm__arch_default_ram_address(void);
-void kvm__arch_delete_ram(struct kvm *kvm);
int kvm__arch_setup_firmware(struct kvm *kvm);
int kvm__arch_free_firmware(struct kvm *kvm);
bool kvm__arch_cpu_supports_vm(void);
@@ -169,14 +169,19 @@ struct kvm *kvm__new(void)
return kvm;
}
-int kvm__exit(struct kvm *kvm)
+static void kvm__delete_ram(struct kvm *kvm)
{
- struct kvm_mem_bank *bank, *tmp;
-
- kvm__arch_delete_ram(kvm);
+ munmap(kvm->ram_start, kvm->ram_size);
if (kvm->ram_fd >= 0)
close(kvm->ram_fd);
+}
+
+int kvm__exit(struct kvm *kvm)
+{
+ struct kvm_mem_bank *bank, *tmp;
+
+ kvm__delete_ram(kvm);
list_for_each_entry_safe(bank, tmp, &kvm->mem_banks, list) {
list_del(&bank->list);
@@ -56,11 +56,6 @@ void kvm__init_ram(struct kvm *kvm)
}
}
-void kvm__arch_delete_ram(struct kvm *kvm)
-{
- munmap(kvm->ram_start, kvm->ram_size);
-}
-
void kvm__arch_set_cmdline(char *cmdline, bool video)
{
@@ -148,11 +148,6 @@ void kvm__arch_init(struct kvm *kvm)
SPAPR_PCI_IO_WIN_SIZE);
}
-void kvm__arch_delete_ram(struct kvm *kvm)
-{
- munmap(kvm->ram_start, kvm->ram_size);
-}
-
void kvm__irq_trigger(struct kvm *kvm, int irq)
{
kvm__irq_line(kvm, irq, 1);
@@ -46,11 +46,6 @@ void kvm__init_ram(struct kvm *kvm)
kvm->arch.memory_guest_start = phys_start;
}
-void kvm__arch_delete_ram(struct kvm *kvm)
-{
- munmap(kvm->ram_start, kvm->ram_size);
-}
-
void kvm__arch_read_term(struct kvm *kvm)
{
serial8250__update_consoles(kvm);
@@ -177,11 +177,6 @@ void kvm__arch_init(struct kvm *kvm)
die_perror("KVM_CREATE_IRQCHIP ioctl");
}
-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)
{
struct kvm_irq_level irq_level;
Now that deleting ram is the same across all architectures, no need for arch-specific deletion of ram. No functional change intended. Signed-off-by: Fuad Tabba <tabba@google.com> --- arm/kvm.c | 5 ----- include/kvm/kvm.h | 1 - kvm.c | 13 +++++++++---- mips/kvm.c | 5 ----- powerpc/kvm.c | 5 ----- riscv/kvm.c | 5 ----- x86/kvm.c | 5 ----- 7 files changed, 9 insertions(+), 30 deletions(-)