linux/virt/kvm/arm/arm.c
/**
 * Initialize Hyp-mode and memory mappings on all CPUs.
 */
Initialize Hyp-mode and memory mappings on all CPUs.
Initialize Hyp - mode and memory mappings on all CPUs .
int kvm_arch_init(void *opaque)
{
	int err;
	int ret, cpu;
	bool in_hyp_mode;
	if (!is_hyp_mode_available()) {
		kvm_info("HYP mode not available\n");
		return -ENODEV;
	}
	if (!kvm_arch_check_sve_has_vhe()) {
		kvm_pr_unimpl("SVE system without VHE unsupported.  Broken cpu?");
		return -ENODEV;
	}
	for_each_online_cpu(cpu) {
		smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
		if (ret < 0) {
			kvm_err("Error, CPU %d not supported!\n", cpu);
			return -ENODEV;
		}
	}
	err = init_common_resources();
	if (err)
		return err;
	in_hyp_mode = is_kernel_in_hyp_mode();
	if (!in_hyp_mode) {
		err = init_hyp_mode();
		if (err)
			goto out_err;
	}
	err = init_subsystems();
	if (err)
		goto out_hyp;
	if (in_hyp_mode)
		kvm_info("VHE mode initialized successfully\n");
	else
		kvm_info("Hyp mode initialized successfully\n");
	return 0;
out_hyp:
	if (!in_hyp_mode)
		teardown_hyp_mode();
out_err:
	return err;
}
int kvm_arch_init ( void * opaque ) { int err ; int ret , cpu ; bool in_hyp_mode ; if ( ! is_hyp_mode_available ( ) ) { kvm_info ( " \n " ) ; return - ENODEV ; } if ( ! kvm_arch_check_sve_has_vhe ( ) ) { kvm_pr_unimpl ( " " ) ; return - ENODEV ; } for_each_online_cpu ( cpu ) { smp_call_function_single ( cpu , check_kvm_target_cpu , & ret , 1 ) ; if ( ret < 0 ) { kvm_err ( " \n " , cpu ) ; return - ENODEV ; } } err = init_common_resources ( ) ; if ( err ) return err ; in_hyp_mode = is_kernel_in_hyp_mode ( ) ; if ( ! in_hyp_mode ) { err = init_hyp_mode ( ) ; if ( err ) goto out_err ; } err = init_subsystems ( ) ; if ( err ) goto out_hyp ; if ( in_hyp_mode ) kvm_info ( " \n " ) ; else kvm_info ( " \n " ) ; return 0 ; out_hyp : if ( ! in_hyp_mode ) teardown_hyp_mode ( ) ; out_err : return err ; }
Initialize Hyp-mode and memory mappings on all CPUs.
Initialize Hyp - mode and memory mappings on all CPUs .