]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
kvm tools: Do setup_fdt() later, get powerpc to boot again
authorMichael Ellerman <michael@ellerman.id.au>
Fri, 5 Oct 2012 01:15:19 +0000 (11:15 +1000)
committerPekka Enberg <penberg@kernel.org>
Fri, 5 Oct 2012 06:29:29 +0000 (09:29 +0300)
In commit e3d3ced "kernel load/firmware cleanup", the call to
kvm__arch_setup_firmware() was moved. Previously more or less at the end
of the init sequence, but that commit moved it into kvm__init() which
is a core_init() call and so runs quite early.

This broke booting powerpc guests, as setup_fdt() needs to be called
later in the setup sequence. In particular it looks at kvm->nrcpus,
which is uninitialised at that point.

In general setup_fdt() needs to run late in the sequence, as it encodes
the setup of the machine into the device tree.

So move setup_fdt() out of kvm__arch_setup_firmware() and make it a
firmware_init() call of its own.

With this patch I am able to boot guests again on HV KVM.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/powerpc/kvm.c

index e4f53157e2ef6a108fc42ebc6e092ea8c8642314..d675265454afdace494e76e2a97502d203e018db 100644 (file)
@@ -286,7 +286,7 @@ static void generate_segment_page_sizes(struct kvm_ppc_smmu_info *info, struct f
  * and whilst most PPC targets will require CPU/memory nodes, others like RTAS
  * should eventually be added separately.
  */
-static void setup_fdt(struct kvm *kvm)
+static int setup_fdt(struct kvm *kvm)
 {
        uint64_t        mem_reg_property[] = { 0, cpu_to_be64(kvm->ram_size) };
        int             smp_cpus = kvm->nrcpus;
@@ -488,7 +488,10 @@ static void setup_fdt(struct kvm *kvm)
        _FDT(fdt_pack(fdt_dest));
 
        free(segment_page_sizes.value);
+
+       return 0;
 }
+firmware_init(setup_fdt);
 
 /**
  * kvm__arch_setup_firmware
@@ -517,9 +520,6 @@ int kvm__arch_setup_firmware(struct kvm *kvm)
 
        /* Load SLOF */
 
-       /* Init FDT */
-       setup_fdt(kvm);
-
        return 0;
 }