* [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too
@ 2016-10-26 7:35 Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 1/2] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter Thomas Huth
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Huth @ 2016-10-26 7:35 UTC (permalink / raw)
To: David Gibson, Alexander Graf, qemu-ppc; +Cc: qemu-devel
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(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1/2] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter
2016-10-26 7:35 [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too Thomas Huth
@ 2016-10-26 7:35 ` Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 2/2] tests: Add pseries machine to the prom-env-test, too Thomas Huth
2016-10-27 3:13 ` [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too David Gibson
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2016-10-26 7:35 UTC (permalink / raw)
To: David Gibson, Alexander Graf, qemu-ppc; +Cc: qemu-devel
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.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/nvram/spapr_nvram.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
index 4de5f70..eb42ea3 100644
--- a/hw/nvram/spapr_nvram.c
+++ b/hw/nvram/spapr_nvram.c
@@ -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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] tests: Add pseries machine to the prom-env-test, too
2016-10-26 7:35 [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 1/2] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter Thomas Huth
@ 2016-10-26 7:35 ` Thomas Huth
2016-10-27 3:13 ` [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too David Gibson
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2016-10-26 7:35 UTC (permalink / raw)
To: David Gibson, Alexander Graf, qemu-ppc; +Cc: qemu-devel
Now 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.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/prom-env-test.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c
index 7a62857..6f70fe2 100644
--- a/tests/prom-env-test.c
+++ b/tests/prom-env-test.c
@@ -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")) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too
2016-10-26 7:35 [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 1/2] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 2/2] tests: Add pseries machine to the prom-env-test, too Thomas Huth
@ 2016-10-27 3:13 ` David Gibson
2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2016-10-27 3:13 UTC (permalink / raw)
To: Thomas Huth; +Cc: Alexander Graf, qemu-ppc, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]
On Wed, Oct 26, 2016 at 09:35:39AM +0200, Thomas Huth wrote:
> 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.
Applied to ppc-for-2.8, replacing earlier versions.
>
> 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(-)
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-27 4:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-26 7:35 [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 1/2] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter Thomas Huth
2016-10-26 7:35 ` [Qemu-devel] [PATCH 2/2] tests: Add pseries machine to the prom-env-test, too Thomas Huth
2016-10-27 3:13 ` [Qemu-devel] [PATCH 0/2] ppc: Allow "-prom-env" parameter for the pseries machine, too David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).