* [Qemu-devel] [PATCH] memory: Fix assertion for flash devices
@ 2012-01-07 11:13 Stefan Weil
2012-01-07 20:29 ` Aurelien Jarno
2012-01-08 11:07 ` Avi Kivity
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2012-01-07 11:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Weil, Avi Kivity
There is a regression since commit c5705a7728b4a6bc9e4f2d35911adbaf28042b25
or some other recent change.
System emulation with a flash device raises an assertion in function
qemu_ram_set_idstr because no new_block is found at the requested addr.
The address of the memory region (mr->ram_addr) is set by
memory_region_init_rom_device:
mr->ram_addr = qemu_ram_alloc(size, mr);
mr->ram_addr |= cpu_register_io_memory(mr);
The 2nd line adds a small offset to mr->ram_addr, and this offset
makes ram_set_idstr fail with an assertion.
Masking mr->ram_addr with the target's page mask removes the small
offset and makes flash devices work again.
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
memory.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/memory.c b/memory.c
index 394cbab..1b2f9e8 100644
--- a/memory.c
+++ b/memory.c
@@ -1386,7 +1386,7 @@ void memory_region_set_alias_offset(MemoryRegion *mr, target_phys_addr_t offset)
ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr)
{
- return mr->ram_addr;
+ return mr->ram_addr & TARGET_PAGE_MASK;
}
static int cmp_flatrange_addr(const void *addr_, const void *fr_)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] memory: Fix assertion for flash devices
2012-01-07 11:13 [Qemu-devel] [PATCH] memory: Fix assertion for flash devices Stefan Weil
@ 2012-01-07 20:29 ` Aurelien Jarno
2012-01-08 11:07 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2012-01-07 20:29 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel, Avi Kivity
On Sat, Jan 07, 2012 at 12:13:46PM +0100, Stefan Weil wrote:
> There is a regression since commit c5705a7728b4a6bc9e4f2d35911adbaf28042b25
> or some other recent change.
>
> System emulation with a flash device raises an assertion in function
> qemu_ram_set_idstr because no new_block is found at the requested addr.
>
> The address of the memory region (mr->ram_addr) is set by
> memory_region_init_rom_device:
>
> mr->ram_addr = qemu_ram_alloc(size, mr);
> mr->ram_addr |= cpu_register_io_memory(mr);
>
> The 2nd line adds a small offset to mr->ram_addr, and this offset
> makes ram_set_idstr fail with an assertion.
>
> Masking mr->ram_addr with the target's page mask removes the small
> offset and makes flash devices work again.
>
> Cc: Avi Kivity <avi@redhat.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> memory.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
I can't confirm the patch is correct, but at least I can confirm it fix
the breakage.
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] memory: Fix assertion for flash devices
2012-01-07 11:13 [Qemu-devel] [PATCH] memory: Fix assertion for flash devices Stefan Weil
2012-01-07 20:29 ` Aurelien Jarno
@ 2012-01-08 11:07 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2012-01-08 11:07 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel
On 01/07/2012 01:13 PM, Stefan Weil wrote:
> There is a regression since commit c5705a7728b4a6bc9e4f2d35911adbaf28042b25
> or some other recent change.
>
> System emulation with a flash device raises an assertion in function
> qemu_ram_set_idstr because no new_block is found at the requested addr.
>
> The address of the memory region (mr->ram_addr) is set by
> memory_region_init_rom_device:
>
> mr->ram_addr = qemu_ram_alloc(size, mr);
> mr->ram_addr |= cpu_register_io_memory(mr);
>
> The 2nd line adds a small offset to mr->ram_addr, and this offset
> makes ram_set_idstr fail with an assertion.
>
> Masking mr->ram_addr with the target's page mask removes the small
> offset and makes flash devices work again.
>
>
> diff --git a/memory.c b/memory.c
> index 394cbab..1b2f9e8 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1386,7 +1386,7 @@ void memory_region_set_alias_offset(MemoryRegion *mr, target_phys_addr_t offset)
>
> ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr)
> {
> - return mr->ram_addr;
> + return mr->ram_addr & TARGET_PAGE_MASK;
> }
>
This makes get_ram_addr() lie about the return value - it's no longer
the ram_addr. Doesn't matter much since it's temporary, but I patched
vmstate_register_ram() instead.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-08 11:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-07 11:13 [Qemu-devel] [PATCH] memory: Fix assertion for flash devices Stefan Weil
2012-01-07 20:29 ` Aurelien Jarno
2012-01-08 11:07 ` Avi Kivity
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.