ppc: Allow "-prom-env" parameter for the pseries machine, too
cover ppc: Allow "-prom-env" parameter for the pseries machine, too
Here's a slightly updated version of the patch that enables the "-prom-env" parameter for the pseries machine. The code is now only executed if nb_prom_envs > 0. That means if the user did _not_ specify a "-prom-env" parameter, there is no change in behavior (i.e. SLOF will initialize the NVRAM instead). This fixes the problem with grub2 not working because it does not find the "/options/real-mode?" property in the device tree.
If you currently want to use the "-prom-env" parameter and grub2 together, you simply have to specify -prom-env "real-mode?=true" to get it working. This will be fixed by a later update to SLOF, so that you then do not have to specify this explicitely anymore.
The second patch adds a test case for the -prom-env parameter on the pseries machine.
The patches have to be applied on top of David's ppc-for-2.8 branch since they rely on the chrp_nvram rework patches that are queued there.
Thomas Huth (2):
spapr_nvram: Pre-initialize the NVRAM to support the -prom-env
parameter
tests: Add pseries machine to the prom-env-test, too
hw/nvram/spapr_nvram.c | 6 ++++++ tests/prom-env-test.c | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter
In case we do not load the NVRAM contents from a file and the user specified the "-prom-env" parameter, use the new CHRP NVRAM helper functions to pre-initialize the NVRAM partitions, so that the SLOF firmware now can pick up the environment variables from the -prom-env parameter, too.
--- hw/nvram/spapr_nvram.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/nvram/spapr_nvram.c +6 -0
@@ -31,6 +31,7 @@#include "sysemu/block-backend.h" #include "sysemu/device_tree.h" #include "hw/sysbus.h" +#include "hw/nvram/chrp_nvram.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h"
@@ -162,6 +163,11 @@ static void spapr_nvram_realize(VIOsPAPRDevice *dev, Error **errp)error_setg (errp,"can't read spapr-nvram contents" );return ; } + }else if (nb_prom_envs >0 ) { +/* Create a system partition to pass the -prom-env variables */ +chrp_nvram_create_system_partition (nvram->buf,MIN_NVRAM_SIZE /4 ); +chrp_nvram_create_free_partition (&nvram->buf[MIN_NVRAM_SIZE /4 ], + nvram->size -MIN_NVRAM_SIZE /4 ); }spapr_rtas_register (RTAS_NVRAM_FETCH ,"nvram-fetch" , rtas_nvram_fetch);
Signature · 1 line
1.8.3.1
PATCH 2/2 tests: Add pseries machine to the prom-env-test, too
In reply to Thomas HuthNow that we also support the "-prom-env" parameter for the pseries machine, we can enable this test for this machine, too. Since booting with TCG is rather slow with the pseries machine, we also enable the "-nodefaults" parameter for this test now, so that SLOF does not have to check that much devices during boot and thus runs a little bit faster.
--- tests/prom-env-test.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
tests/prom-env-test.c +14 -9
@@ -9,11 +9,12 @@* This work is licensed under the terms of the GNU GPL, version 2 * or later. See the COPYING file in the top-level directory. * -* This test is used to check that some OpenBIOS machines can be started -* successfully in TCG mode. To do this, we first put some Forth code into -* the "boot-command" Open Firmware environment variable. This Forth code -* writes a well-known magic value to a known location in memory. Then we -* start the guest so that OpenBIOS can boot and finally run the Forth code. +* This test is used to check that some Open Firmware based machines (i.e. +* OpenBIOS or SLOF) can be started successfully in TCG mode. To do this, we +* first put some Forth code into the "boot-command" Open Firmware environment +* variable. This Forth code writes a well-known magic value to a known location +* in memory. Then we start the guest so that the firmware can boot and finally +* run the Forth code. * The testing code here then can finally check whether the value has been * successfully written into the guest memory. */
@@ -45,7 +46,8 @@ static void test_machine(const void *machine) {char *args; - args =g_strdup_printf ("-M %s,accel=tcg -prom-env 'boot-command=%x %x l!'" , + args =g_strdup_printf ("-M %s,accel=tcg -nodefaults " +"-prom-env 'boot-command=%x %x l!'" , (const char *)machine,MAGIC ,ADDRESS );qtest_start (args);
@@ -71,13 +73,16 @@ int main(int argc, char *argv[]) {const char *sparc_machines[] = {"SPARCbook" ,"Voyager" ,"SS-20" ,NULL };const char *sparc64_machines[] = {"sun4u" ,"sun4v" ,NULL }; -const char *mac_machines[] = {"mac99" ,"g3beige" ,NULL }; +const char *ppc_machines[] = {"mac99" ,"g3beige" ,NULL }; +const char *ppc64_machines[] = {"mac99" ,"g3beige" ,"pseries" ,NULL };const char *arch =qtest_get_arch ();g_test_init (&argc, &argv,NULL ); -if (!strcmp (arch,"ppc" ) || !strcmp (arch,"ppc64" )) { -add_tests (mac_machines); +if (!strcmp (arch,"ppc" )) { +add_tests (ppc_machines); + }else if (!strcmp (arch,"ppc64" )) { +add_tests (ppc64_machines); }else if (!strcmp (arch,"sparc" )) {add_tests (sparc_machines); }else if (!strcmp (arch,"sparc64" )) {
Signature · 1 line
1.8.3.1
David Gibson
AppliedQuoted 12 lines · Thomas Huth
Here's a slightly updated version of the patch that enables the "-prom-env" parameter for the pseries machine. The code is now only executed if
nb_prom_envs> 0. That means if the user did _not_ specify a "-prom-env" parameter, there is no change in behavior (i.e. SLOF will initialize the NVRAM instead). This fixes the problem with grub2 not working because it does not find the "/options/real-mode?" property in the device tree.If you currently want to use the "-prom-env" parameter and grub2 together, you simply have to specify -prom-env "real-mode?=true" to get it working. This will be fixed by a later update to SLOF, so that you then do not have to specify this explicitely anymore.
Quoted 5 lines
The second patch adds a test case for the -prom-env parameter on the pseries machine.
The patches have to be applied on top of David's ppc-for-2.8 branch since they rely on the
chrp_nvramrework patches that are queued there.
Applied to ppc-for-2.8, replacing earlier versions.
Quoted 10 lines
Thomas Huth (2):
spapr_nvram: Pre-initialize the NVRAM to support the -prom-env
parameter
tests: Add pseries machine to the prom-env-test, toohw/nvram/spapr_nvram.c | 6 ++++++ tests/prom-env-test.c | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-)
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson