mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 14:24:02 +08:00
s390: unify allocation of initial memory
Now that the calculation of the initial memory is hidden in the sclp device, we can unify the allocation of the initial memory. The remaining ugly part is the reserved memory for the virtio queues, but that can be cleaned up later. Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
1cf065fb87
commit
80d23275e3
@ -100,15 +100,28 @@ static void virtio_ccw_register_hcalls(void)
|
||||
virtio_ccw_hcall_early_printk);
|
||||
}
|
||||
|
||||
static void ccw_init(MachineState *machine)
|
||||
void s390_memory_init(ram_addr_t mem_size)
|
||||
{
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
|
||||
/* allocate RAM for core */
|
||||
memory_region_init_ram(ram, NULL, "s390.ram", mem_size, &error_abort);
|
||||
vmstate_register_ram_global(ram);
|
||||
memory_region_add_subregion(sysmem, 0, ram);
|
||||
|
||||
/* Initialize storage key device */
|
||||
s390_skeys_init();
|
||||
}
|
||||
|
||||
static void ccw_init(MachineState *machine)
|
||||
{
|
||||
int ret;
|
||||
VirtualCssBus *css_bus;
|
||||
DeviceState *dev;
|
||||
|
||||
s390_sclp_init();
|
||||
s390_memory_init(machine->ram_size);
|
||||
|
||||
/* get a BUS */
|
||||
css_bus = virtual_css_bus_init();
|
||||
@ -124,15 +137,6 @@ static void ccw_init(MachineState *machine)
|
||||
/* register hypercalls */
|
||||
virtio_ccw_register_hcalls();
|
||||
|
||||
/* allocate RAM for core */
|
||||
memory_region_init_ram(ram, NULL, "s390.ram", machine->ram_size,
|
||||
&error_abort);
|
||||
vmstate_register_ram_global(ram);
|
||||
memory_region_add_subregion(sysmem, 0, ram);
|
||||
|
||||
/* Initialize storage key device */
|
||||
s390_skeys_init();
|
||||
|
||||
/* init CPUs */
|
||||
s390_init_cpus(machine->cpu_model);
|
||||
|
||||
|
@ -262,8 +262,6 @@ int gtod_load(QEMUFile *f, void *opaque, int version_id)
|
||||
static void s390_init(MachineState *machine)
|
||||
{
|
||||
ram_addr_t my_ram_size;
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
void *virtio_region;
|
||||
hwaddr virtio_region_len;
|
||||
hwaddr virtio_region_start;
|
||||
@ -285,9 +283,7 @@ static void s390_init(MachineState *machine)
|
||||
s390_virtio_register_hcalls();
|
||||
|
||||
/* allocate RAM */
|
||||
memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size, &error_abort);
|
||||
vmstate_register_ram_global(ram);
|
||||
memory_region_add_subregion(sysmem, 0, ram);
|
||||
s390_memory_init(my_ram_size);
|
||||
|
||||
/* clear virtio region */
|
||||
virtio_region_len = my_ram_size - ram_size;
|
||||
@ -298,9 +294,6 @@ static void s390_init(MachineState *machine)
|
||||
cpu_physical_memory_unmap(virtio_region, virtio_region_len, 1,
|
||||
virtio_region_len);
|
||||
|
||||
/* Initialize storage key device */
|
||||
s390_skeys_init();
|
||||
|
||||
/* init CPUs */
|
||||
s390_init_cpus(machine->cpu_model);
|
||||
|
||||
|
@ -27,4 +27,5 @@ void s390_init_ipl_dev(const char *kernel_filename,
|
||||
bool enforce_bios);
|
||||
void s390_create_virtio_net(BusState *bus, const char *name);
|
||||
void s390_nmi(NMIState *n, int cpu_index, Error **errp);
|
||||
void s390_memory_init(ram_addr_t mem_size);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user