From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwbHt-0000IN-Ty for qemu-devel@nongnu.org; Tue, 18 Oct 2016 16:47:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwbHt-0004Rv-Ad for qemu-devel@nongnu.org; Tue, 18 Oct 2016 16:47:05 -0400 From: Thomas Huth Date: Tue, 18 Oct 2016 22:46:42 +0200 Message-Id: <1476823604-15403-4-git-send-email-thuth@redhat.com> In-Reply-To: <1476823604-15403-1-git-send-email-thuth@redhat.com> References: <1476823604-15403-1-git-send-email-thuth@redhat.com> Subject: [Qemu-devel] [PATCH 3/5] spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , Alexander Graf , qemu-ppc@nongnu.org, Mark Cave-Ayland Cc: qemu-devel@nongnu.org, Artyom Tarasenko 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 --- 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