All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>,
	Alexander Graf <agraf@suse.de>,
	qemu-ppc@nongnu.org,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org, Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [Qemu-devel] [PATCH 3/5] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter
Date: Tue, 18 Oct 2016 22:46:42 +0200	[thread overview]
Message-ID: <1476823604-15403-4-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1476823604-15403-1-git-send-email-thuth@redhat.com>

In case we do not load the NVRAM contents from a file, use the new
CHRP NVRAM helper functions to pre-initialize the NVRAM partitions.
This way we can support the "-prom-env" parameter of QEMU on the
pseries machine, 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..36a9188 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 {
+        /* 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

  parent reply	other threads:[~2016-10-18 20:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 20:46 [Qemu-devel] [PATCH 0/5] nvram: Refactor OpenBIOS NVRAM code to support -prom-env on pseries, too Thomas Huth
2016-10-18 20:46 ` [Qemu-devel] [PATCH 1/5] nvram: Introduce helper functions for CHRP "system" and "free space" partitions Thomas Huth
2016-10-18 20:46 ` [Qemu-devel] [PATCH 2/5] sparc: Use the new common NVRAM functions for system and free space partition Thomas Huth
2016-10-18 20:46 ` Thomas Huth [this message]
2016-10-18 20:46 ` [Qemu-devel] [PATCH 4/5] nvram: Move the remaining CHRP NVRAM related code to chrp_nvram.[ch] Thomas Huth
2016-10-18 20:46 ` [Qemu-devel] [PATCH 5/5] nvram: Rename openbios_firmware_abi.h into sun_nvram.h Thomas Huth
2016-10-19  2:16 ` [Qemu-devel] [PATCH 0/5] nvram: Refactor OpenBIOS NVRAM code to support -prom-env on pseries, too David Gibson
2016-10-24 10:22   ` Bharata B Rao
2016-10-24 10:36     ` Thomas Huth
2016-10-24 12:04       ` David Gibson
2016-10-25 12:22         ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2016-10-26  0:03           ` David Gibson
2016-10-26  6:35             ` Thomas Huth
2016-10-23 15:19 ` [Qemu-devel] " Mark Cave-Ayland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476823604-15403-4-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=atar4qemu@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.