summaryrefslogtreecommitdiff
path: root/hw/ppc/ppc405_uc.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2014-07-21 17:30:17 +0800
committerAlexander Graf <agraf@suse.de>2014-07-22 17:37:25 +0200
commite206ad48333c50373663945746828fc893b50700 (patch)
tree02544a6198eeb521c5732887f5bc382ab1d46600 /hw/ppc/ppc405_uc.c
parent35858955e6c6f9ef41c199d15457c13426ac6434 (diff)
downloadqemu-e206ad48333c50373663945746828fc893b50700.tar.gz
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc boards. The problems are: 1. it fails when allocating memory for rom, sram whose sizes are less than huge page size: ./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \ -kernel /home/hutao/Downloads/vmlinux-ppc -initrd \ /home/hutao/Downloads/initrd-ppc.gz qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed. 2. if there is a numa node backed by memory backend object, qemu fails with message: ./ppc-softmmu/qemu-system-ppc -m 512 \ -object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \ -numa node,nodeid=0,memdev=f0 \ -kernel /home/hutao/Downloads/vmlinux-ppc \ -initrd /home/hutao/Downloads/initrd-ppc.gz qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value. This patch does following: 1. replaces memory_region_allocate_system_memory() with memory_region_init_ram() for rom, sram. Then only system memory is backed by hugepages when specifying mem-path. 2. for memory banks, allocates all ram with one memory_region_allocate_system_memory(), and use memory_region_init_alias() to initialize memory banks. Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep. Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/ppc/ppc405_uc.c')
-rw-r--r--hw/ppc/ppc405_uc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index fcd5f2d917..a73e918a14 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -974,8 +974,8 @@ static void ppc405_ocm_init(CPUPPCState *env)
ocm = g_malloc0(sizeof(ppc405_ocm_t));
/* XXX: Size is 4096 or 0x04000000 */
- memory_region_allocate_system_memory(&ocm->isarc_ram, NULL, "ppc405.ocm",
- 4096);
+ memory_region_init_ram(&ocm->isarc_ram, NULL, "ppc405.ocm", 4096);
+ vmstate_register_ram_global(&ocm->isarc_ram);
memory_region_init_alias(&ocm->dsarc_ram, NULL, "ppc405.dsarc", &ocm->isarc_ram,
0, 4096);
qemu_register_reset(&ocm_reset, ocm);