From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-ppc@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH 1/5] hw/sparc64/niagara: Pass available memory region size to add_rom_or_fail
Date: Mon, 9 Mar 2020 15:43:49 +0100 [thread overview]
Message-ID: <20200309144353.26457-2-philmd@redhat.com> (raw)
In-Reply-To: <20200309144353.26457-1-philmd@redhat.com>
In few commits we'll let rom_add_file_fixed() take a 'size'
argument holding the maximum file length that can be loaded
as ROM. In preparation, modify the Niagara machine, so the
generic change will be easier to review.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/sparc64/niagara.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
index ab5ef8c5b3..f58d008d3d 100644
--- a/hw/sparc64/niagara.c
+++ b/hw/sparc64/niagara.c
@@ -85,7 +85,8 @@ typedef struct NiagaraBoardState {
#define NIAGARA_OBP_OFFSET 0x80000ULL
#define PROM_SIZE_MAX (4 * MiB)
-static void add_rom_or_fail(const char *file, const hwaddr addr)
+static void add_rom_or_fail(const char *file, const hwaddr addr,
+ uint64_t region_size)
{
/* XXX remove qtest_enabled() check once firmware files are
* in the qemu tree
@@ -126,13 +127,15 @@ static void niagara_init(MachineState *machine)
&error_fatal);
memory_region_add_subregion(sysmem, NIAGARA_PROM_BASE, &s->prom);
- add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE);
- add_rom_or_fail("1up-md.bin", NIAGARA_MD_ROM_BASE);
- add_rom_or_fail("1up-hv.bin", NIAGARA_HV_ROM_BASE);
+ add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE, NIAGARA_NVRAM_SIZE);
+ add_rom_or_fail("1up-md.bin", NIAGARA_MD_ROM_BASE, NIAGARA_MD_ROM_SIZE);
+ add_rom_or_fail("1up-hv.bin", NIAGARA_HV_ROM_BASE, NIAGARA_HV_ROM_SIZE);
- add_rom_or_fail("reset.bin", NIAGARA_PROM_BASE);
- add_rom_or_fail("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET);
- add_rom_or_fail("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET);
+ add_rom_or_fail("reset.bin", NIAGARA_PROM_BASE, NIAGARA_Q_OFFSET);
+ add_rom_or_fail("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET,
+ NIAGARA_OBP_OFFSET);
+ add_rom_or_fail("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET,
+ PROM_SIZE_MAX - NIAGARA_OBP_OFFSET);
/* the virtual ramdisk is kind of initrd, but it resides
outside of the partition RAM */
--
2.21.1
next prev parent reply other threads:[~2020-03-09 14:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 14:43 [PATCH 0/5] hw/core/loader: Prohibit loading ROMs bigger than memory region Philippe Mathieu-Daudé
2020-03-09 14:43 ` Philippe Mathieu-Daudé [this message]
2020-03-09 14:43 ` [PATCH 2/5] " Philippe Mathieu-Daudé
2020-03-09 14:48 ` Peter Maydell
2020-03-09 15:41 ` Philippe Mathieu-Daudé
2020-03-09 14:43 ` [PATCH 3/5] hw/core/loader: Provide rom_add_file() a 'max_size' argument Philippe Mathieu-Daudé
2020-03-09 17:44 ` Taylor Simpson
2020-03-09 14:43 ` [PATCH 4/5] hw/core/loader: Restrict rom_add_file_mr() to available region size Philippe Mathieu-Daudé
2020-03-09 14:43 ` [PATCH 5/5] hw/core/loader: Provide rom_add_file_fixed() a 'max_size' argument Philippe Mathieu-Daudé
2020-03-10 0:43 ` David Gibson
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=20200309144353.26457-2-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=alistair@alistair23.me \
--cc=atar4qemu@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=ehabkost@redhat.com \
--cc=kraxel@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
/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 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).