@@ -57,7 +57,7 @@ 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_init(struct kvm *kvm)
{
/*
* Allocate guest memory. We must align our buffer to 64K to
@@ -65,9 +65,10 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
* If using THP, then our minimal alignment becomes 2M.
* 2M trumps 64K, so let's go with that.
*/
- kvm->ram_size = ram_size;
+ kvm->ram_size = kvm->cfg.ram_size;
kvm->arch.ram_alloc_size = kvm->ram_size + SZ_2M;
- kvm->arch.ram_alloc_start = mmap_anon_or_hugetlbfs(kvm, hugetlbfs_path,
+ kvm->arch.ram_alloc_start = mmap_anon_or_hugetlbfs(kvm,
+ kvm->cfg.hugetlbfs_path,
kvm->arch.ram_alloc_size);
if (kvm->arch.ram_alloc_start == MAP_FAILED)
@@ -189,7 +189,7 @@ void kvm__remove_socket(const char *name);
void kvm__arch_validate_cfg(struct kvm *kvm);
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_init(struct kvm *kvm);
void kvm__arch_delete_ram(struct kvm *kvm);
int kvm__arch_setup_firmware(struct kvm *kvm);
int kvm__arch_free_firmware(struct kvm *kvm);
@@ -479,7 +479,7 @@ int kvm__init(struct kvm *kvm)
goto err_vm_fd;
}
- kvm__arch_init(kvm, kvm->cfg.hugetlbfs_path, kvm->cfg.ram_size);
+ kvm__arch_init(kvm);
INIT_LIST_HEAD(&kvm->mem_banks);
kvm__init_ram(kvm);
@@ -61,12 +61,13 @@ void kvm__arch_set_cmdline(char *cmdline, bool video)
}
/* Architecture-specific KVM init */
-void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
+void kvm__arch_init(struct kvm *kvm)
{
int ret;
- kvm->ram_start = mmap_anon_or_hugetlbfs(kvm, hugetlbfs_path, ram_size);
- kvm->ram_size = ram_size;
+ kvm->ram_size = kvm->cfg.ram_size;
+ kvm->ram_start = mmap_anon_or_hugetlbfs(kvm, kvm->cfg.hugetlbfs_path,
+ kvm->ram_size);
if (kvm->ram_start == MAP_FAILED)
die("out of memory");
@@ -92,12 +92,13 @@ void kvm__arch_set_cmdline(char *cmdline, bool video)
}
/* Architecture-specific KVM init */
-void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
+void kvm__arch_init(struct kvm *kvm)
{
+ const char *hugetlbfs_path = kvm->cfg.hugetlbfs_path;
int cap_ppc_rma;
unsigned long hpt;
- kvm->ram_size = ram_size;
+ kvm->ram_size = kvm->cfg.ram_size;
/* Map "default" hugetblfs path to the standard 16M mount point */
if (hugetlbfs_path && !strcmp(hugetlbfs_path, "default"))
@@ -56,7 +56,7 @@ 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_init(struct kvm *kvm)
{
/*
* Allocate guest memory. We must align our buffer to 64K to
@@ -64,9 +64,10 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
* If using THP, then our minimal alignment becomes 2M.
* 2M trumps 64K, so let's go with that.
*/
- kvm->ram_size = min(ram_size, (u64)RISCV_MAX_MEMORY(kvm));
+ kvm->ram_size = min(kvm->cfg.ram_size, (u64)RISCV_MAX_MEMORY(kvm));
kvm->arch.ram_alloc_size = kvm->ram_size + SZ_2M;
- kvm->arch.ram_alloc_start = mmap_anon_or_hugetlbfs(kvm, hugetlbfs_path,
+ kvm->arch.ram_alloc_start = mmap_anon_or_hugetlbfs(kvm,
+ kvm->cfg.hugetlbfs_path,
kvm->arch.ram_alloc_size);
if (kvm->arch.ram_alloc_start == MAP_FAILED)
@@ -134,9 +134,11 @@ void kvm__arch_set_cmdline(char *cmdline, bool video)
}
/* Architecture-specific KVM init */
-void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
+void kvm__arch_init(struct kvm *kvm)
{
+ const char *hugetlbfs_path = kvm->cfg.hugetlbfs_path;
struct kvm_pit_config pit_config = { .flags = 0, };
+ u64 ram_size = kvm->cfg.ram_size;
int ret;
ret = ioctl(kvm->vm_fd, KVM_SET_TSS_ADDR, 0xfffbd000);