kvm__start_timer(kvm);
- kvm__arch_setup_firmware(kvm);
+ exit_code = kvm__arch_setup_firmware(kvm);
+ if (exit_code)
+ goto err;
for (i = 0; i < nrcpus; i++) {
kvm_cpus[i] = kvm_cpu__init(kvm, i);
exit_code = 1;
}
+err:
compat__print_all_messages();
fb__stop();
void kvm__arch_set_cmdline(char *cmdline, bool video);
void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, const char *hugetlbfs_path, u64 ram_size, const char *name);
-void kvm__arch_setup_firmware(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__arch_setup_firmware
*/
-void kvm__arch_setup_firmware(struct kvm *kvm)
+int kvm__arch_setup_firmware(struct kvm *kvm)
{
/* Load RTAS */
/* Init FDT */
setup_fdt(kvm);
+
+ return 0;
}
struct kvm;
-void mptable_setup(struct kvm *kvm, unsigned int ncpus);
+int mptable_setup(struct kvm *kvm, unsigned int ncpus);
#endif /* KVM_MPTABLE_H_ */
* This function is a main routine where we poke guest memory
* and install BIOS there.
*/
-void kvm__arch_setup_firmware(struct kvm *kvm)
+int kvm__arch_setup_firmware(struct kvm *kvm)
{
/* standart minimal configuration */
setup_bios(kvm);
/* FIXME: SMP, ACPI and friends here */
/* MP table */
- mptable_setup(kvm, kvm->nrcpus);
+ return mptable_setup(kvm, kvm->nrcpus);
}
void kvm__arch_periodic_poll(struct kvm *kvm)
/**
* mptable_setup - create mptable and fill guest memory with it
*/
-void mptable_setup(struct kvm *kvm, unsigned int ncpus)
+int mptable_setup(struct kvm *kvm, unsigned int ncpus)
{
unsigned long real_mpc_table, real_mpf_intel, size;
struct mpf_intel *mpf_intel;
*/
if (size > (unsigned long)(MB_BIOS_END - bios_rom_size) ||
- size > MPTABLE_MAX_SIZE)
- die("MP table is too big");
+ size > MPTABLE_MAX_SIZE) {
+ free(mpc_table);
+ pr_err("MP table is too big");
+ return -1;
+ }
/*
* OK, it is time to move it to guest memory.
memcpy(guest_flat_to_host(kvm, real_mpc_table), mpc_table, size);
free(mpc_table);
+ return 0;
}