spapr: Add /chosen to FDT only at reset time to preserve kernel and initramdisk
commita49f62b9fd7cf825d7c1f6fad10d865220ff01b2
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Thu, 24 Oct 2019 04:13:08 +0000 (24 15:13 +1100)
committerLaurent Vivier <lvivier@redhat.com>
Mon, 18 Nov 2019 10:50:33 +0000 (18 11:50 +0100)
tree20900ecf0af2c9a8b7c5b5a02a26fd6fc6e0a75c
parent0a83b47055246d3942084f03fc54731c4fb9b731
spapr: Add /chosen to FDT only at reset time to preserve kernel and initramdisk

Since "spapr: Render full FDT on ibm,client-architecture-support" we build
the entire flatten device tree (FDT) twice - at the reset time and
when "ibm,client-architecture-support" (CAS) is called. The full FDT from
CAS is then applied on top of the SLOF internal device tree.

This is mostly ok, however there is a case when the QEMU is started with
-initrd and for some reason the guest decided to move/unpack the init RAM
disk image - the guest correctly notifies SLOF about the change but
at CAS it is overridden with the QEMU initial location addresses and
the guest may fail to boot if the original initrd memory was changed.

This fixes the problem by only adding the /chosen node at the reset time
to prevent the original QEMU's linux,initrd-start/linux,initrd-end to
override the updated addresses.

This only treats /chosen differently as we know there is a special case
already and it is unlikely anything else will need to change /chosen at CAS
we are better off not touching /chosen after we handed it over to SLOF.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20191024041308.5673-1-aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
hw/ppc/spapr.c