numa: introduce memory_region_allocate_system_memory
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> MST: resolve conflicts
This commit is contained in:
		
							parent
							
								
									d116946424
								
							
						
					
					
						commit
						dfabb8b916
					
				| 
						 | 
					@ -1215,8 +1215,7 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,
 | 
				
			||||||
     * with older qemus that used qemu_ram_alloc().
 | 
					     * with older qemus that used qemu_ram_alloc().
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ram = g_malloc(sizeof(*ram));
 | 
					    ram = g_malloc(sizeof(*ram));
 | 
				
			||||||
    memory_region_init_ram(ram, NULL, "pc.ram", ram_size);
 | 
					    memory_region_allocate_system_memory(ram, NULL, "pc.ram", ram_size);
 | 
				
			||||||
    vmstate_register_ram_global(ram);
 | 
					 | 
				
			||||||
    *ram_memory = ram;
 | 
					    *ram_memory = ram;
 | 
				
			||||||
    ram_below_4g = g_malloc(sizeof(*ram_below_4g));
 | 
					    ram_below_4g = g_malloc(sizeof(*ram_below_4g));
 | 
				
			||||||
    memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram,
 | 
					    memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,9 +43,13 @@ struct QEMUMachine {
 | 
				
			||||||
    const char *hw_version;
 | 
					    const char *hw_version;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TYPE_MACHINE_SUFFIX "-machine"
 | 
					void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
 | 
				
			||||||
 | 
					                                          const char *name,
 | 
				
			||||||
 | 
					                                          uint64_t ram_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int qemu_register_machine(QEMUMachine *m);
 | 
					int qemu_register_machine(QEMUMachine *m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define TYPE_MACHINE_SUFFIX "-machine"
 | 
				
			||||||
#define TYPE_MACHINE "machine"
 | 
					#define TYPE_MACHINE "machine"
 | 
				
			||||||
#undef MACHINE  /* BSD defines it and QEMU does not use it */
 | 
					#undef MACHINE  /* BSD defines it and QEMU does not use it */
 | 
				
			||||||
#define MACHINE(obj) \
 | 
					#define MACHINE(obj) \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@
 | 
				
			||||||
#include "qemu/notify.h"
 | 
					#include "qemu/notify.h"
 | 
				
			||||||
#include "qemu/main-loop.h"
 | 
					#include "qemu/main-loop.h"
 | 
				
			||||||
#include "qemu/bitmap.h"
 | 
					#include "qemu/bitmap.h"
 | 
				
			||||||
 | 
					#include "qom/object.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* vl.c */
 | 
					/* vl.c */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										9
									
								
								numa.c
								
								
								
								
							
							
						
						
									
										9
									
								
								numa.c
								
								
								
								
							| 
						 | 
					@ -32,6 +32,7 @@
 | 
				
			||||||
#include "qapi/opts-visitor.h"
 | 
					#include "qapi/opts-visitor.h"
 | 
				
			||||||
#include "qapi/dealloc-visitor.h"
 | 
					#include "qapi/dealloc-visitor.h"
 | 
				
			||||||
#include "qapi/qmp/qerror.h"
 | 
					#include "qapi/qmp/qerror.h"
 | 
				
			||||||
 | 
					#include "hw/boards.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QemuOptsList qemu_numa_opts = {
 | 
					QemuOptsList qemu_numa_opts = {
 | 
				
			||||||
    .name = "numa",
 | 
					    .name = "numa",
 | 
				
			||||||
| 
						 | 
					@ -193,3 +194,11 @@ void set_numa_modes(void)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
 | 
				
			||||||
 | 
					                                          const char *name,
 | 
				
			||||||
 | 
					                                          uint64_t ram_size)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    memory_region_init_ram(mr, owner, name, ram_size);
 | 
				
			||||||
 | 
					    vmstate_register_ram_global(mr);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue