* [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images
@ 2018-02-23 11:29 Mark Cave-Ayland
2018-02-23 18:04 ` Peter Maydell
0 siblings, 1 reply; 5+ messages in thread
From: Mark Cave-Ayland @ 2018-02-23 11:29 UTC (permalink / raw)
To: peter.maydell, qemu-devel, qemu-stable
All memory region ROM images have a base address of 0 which causes the overlapping
address check to fail if more than one memory region ROM image is present, or an
existing ROM image is loaded at address 0.
Make sure that we ignore the overlapping address check in
rom_check_and_register_reset() if this is a memory region ROM image. In particular
this fixes the "rom: requested regions overlap" error on startup when trying to
run qemu-system-sparc with a -kernel image since commit 7497638642: "tcx: switch to
load_image_mr() and remove prom_addr hack".
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/core/loader.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 91669d65aa..c08f130461 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1104,20 +1104,22 @@ int rom_check_and_register_reset(void)
if (rom->fw_file) {
continue;
}
- if ((addr > rom->addr) && (as == rom->as)) {
- fprintf(stderr, "rom: requested regions overlap "
- "(rom %s. free=0x" TARGET_FMT_plx
- ", addr=0x" TARGET_FMT_plx ")\n",
- rom->name, addr, rom->addr);
- return -1;
+ if (!rom->mr) {
+ if ((addr > rom->addr) && (as == rom->as)) {
+ fprintf(stderr, "rom: requested regions overlap "
+ "(rom %s. free=0x" TARGET_FMT_plx
+ ", addr=0x" TARGET_FMT_plx ")\n",
+ rom->name, addr, rom->addr);
+ return -1;
+ }
+ addr = rom->addr;
+ addr += rom->romsize;
+ as = rom->as;
}
- addr = rom->addr;
- addr += rom->romsize;
section = memory_region_find(rom->mr ? rom->mr : get_system_memory(),
rom->addr, 1);
rom->isrom = int128_nz(section.size) && memory_region_is_rom(section.mr);
memory_region_unref(section.mr);
- as = rom->as;
}
qemu_register_reset(rom_reset, NULL);
roms_loaded = 1;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images
2018-02-23 11:29 [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images Mark Cave-Ayland
@ 2018-02-23 18:04 ` Peter Maydell
2018-02-23 18:53 ` Mark Cave-Ayland
0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2018-02-23 18:04 UTC (permalink / raw)
To: Mark Cave-Ayland; +Cc: QEMU Developers, qemu-stable
On 23 February 2018 at 11:29, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> All memory region ROM images have a base address of 0 which causes the overlapping
> address check to fail if more than one memory region ROM image is present, or an
> existing ROM image is loaded at address 0.
>
> Make sure that we ignore the overlapping address check in
> rom_check_and_register_reset() if this is a memory region ROM image. In particular
> this fixes the "rom: requested regions overlap" error on startup when trying to
> run qemu-system-sparc with a -kernel image since commit 7497638642: "tcx: switch to
> load_image_mr() and remove prom_addr hack".
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Do you want to take this via your sparc tree?
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images
2018-02-23 18:04 ` Peter Maydell
@ 2018-02-23 18:53 ` Mark Cave-Ayland
2018-02-23 18:53 ` Peter Maydell
0 siblings, 1 reply; 5+ messages in thread
From: Mark Cave-Ayland @ 2018-02-23 18:53 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, qemu-stable
On 23/02/18 18:04, Peter Maydell wrote:
> On 23 February 2018 at 11:29, Mark Cave-Ayland
> <mark.cave-ayland@ilande.co.uk> wrote:
>> All memory region ROM images have a base address of 0 which causes the overlapping
>> address check to fail if more than one memory region ROM image is present, or an
>> existing ROM image is loaded at address 0.
>>
>> Make sure that we ignore the overlapping address check in
>> rom_check_and_register_reset() if this is a memory region ROM image. In particular
>> this fixes the "rom: requested regions overlap" error on startup when trying to
>> run qemu-system-sparc with a -kernel image since commit 7497638642: "tcx: switch to
>> load_image_mr() and remove prom_addr hack".
>>
>> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> Do you want to take this via your sparc tree?
I can do, although I don't have any outstanding SPARC patches (just PPC
ones for the moment) so it would just be a single commit PR. Is that okay?
ATB,
Mark.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images
2018-02-23 18:53 ` Mark Cave-Ayland
@ 2018-02-23 18:53 ` Peter Maydell
2018-02-27 19:19 ` Mark Cave-Ayland
0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2018-02-23 18:53 UTC (permalink / raw)
To: Mark Cave-Ayland; +Cc: QEMU Developers, qemu-stable
On 23 February 2018 at 18:53, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> On 23/02/18 18:04, Peter Maydell wrote:
>
>> On 23 February 2018 at 11:29, Mark Cave-Ayland
>> <mark.cave-ayland@ilande.co.uk> wrote:
>>>
>>> All memory region ROM images have a base address of 0 which causes the
>>> overlapping
>>> address check to fail if more than one memory region ROM image is
>>> present, or an
>>> existing ROM image is loaded at address 0.
>>>
>>> Make sure that we ignore the overlapping address check in
>>> rom_check_and_register_reset() if this is a memory region ROM image. In
>>> particular
>>> this fixes the "rom: requested regions overlap" error on startup when
>>> trying to
>>> run qemu-system-sparc with a -kernel image since commit 7497638642: "tcx:
>>> switch to
>>> load_image_mr() and remove prom_addr hack".
>>>
>>> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>
>>
>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>>
>> Do you want to take this via your sparc tree?
>
>
> I can do, although I don't have any outstanding SPARC patches (just PPC ones
> for the moment) so it would just be a single commit PR. Is that okay?
Yeah, it's less effort for me to apply a pull than a patch in some
ways...
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images
2018-02-23 18:53 ` Peter Maydell
@ 2018-02-27 19:19 ` Mark Cave-Ayland
0 siblings, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2018-02-27 19:19 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, qemu-stable
On 23/02/18 18:53, Peter Maydell wrote:
>> I can do, although I don't have any outstanding SPARC patches (just PPC ones
>> for the moment) so it would just be a single commit PR. Is that okay?
>
> Yeah, it's less effort for me to apply a pull than a patch in some
> ways...
Done. I've also sent a v2 with your R-B added so your R-B tag should
also appear in the patch when it eventually gets applied to qemu-stable.
ATB,
Mark.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-27 19:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23 11:29 [Qemu-devel] [PATCH] loader: don't perform overlapping address check for memory region ROM images Mark Cave-Ayland
2018-02-23 18:04 ` Peter Maydell
2018-02-23 18:53 ` Mark Cave-Ayland
2018-02-23 18:53 ` Peter Maydell
2018-02-27 19:19 ` Mark Cave-Ayland
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).