mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
spapr: Initialize hotplug memory address space
Initialize a hotplug memory region under which all the hotplugged memory is accommodated. Also enable memory hotplug by setting CONFIG_MEM_HOTPLUG. Modelled on i386 memory hotplug. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
9d1852ce11
commit
4a1c9cf007
|
@ -52,3 +52,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM))
|
||||||
# For PReP
|
# For PReP
|
||||||
CONFIG_MC146818RTC=y
|
CONFIG_MC146818RTC=y
|
||||||
CONFIG_ISA_TESTDEV=y
|
CONFIG_ISA_TESTDEV=y
|
||||||
|
CONFIG_MEM_HOTPLUG=y
|
||||||
|
|
|
@ -1562,6 +1562,24 @@ static void ppc_spapr_init(MachineState *machine)
|
||||||
memory_region_add_subregion(sysmem, 0, rma_region);
|
memory_region_add_subregion(sysmem, 0, rma_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize hotplug memory address space */
|
||||||
|
if (machine->ram_size < machine->maxram_size) {
|
||||||
|
ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
|
||||||
|
|
||||||
|
if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) {
|
||||||
|
error_report("unsupported amount of memory slots: %"PRIu64,
|
||||||
|
machine->ram_slots);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
spapr->hotplug_memory.base = ROUND_UP(machine->ram_size,
|
||||||
|
SPAPR_HOTPLUG_MEM_ALIGN);
|
||||||
|
memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr),
|
||||||
|
"hotplug-memory", hotplug_mem_size);
|
||||||
|
memory_region_add_subregion(sysmem, spapr->hotplug_memory.base,
|
||||||
|
&spapr->hotplug_memory.mr);
|
||||||
|
}
|
||||||
|
|
||||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
|
error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/ppc/xics.h"
|
#include "hw/ppc/xics.h"
|
||||||
#include "hw/ppc/spapr_drc.h"
|
#include "hw/ppc/spapr_drc.h"
|
||||||
|
#include "hw/mem/pc-dimm.h"
|
||||||
|
|
||||||
struct VIOsPAPRBus;
|
struct VIOsPAPRBus;
|
||||||
struct sPAPRPHBState;
|
struct sPAPRPHBState;
|
||||||
|
@ -76,6 +77,7 @@ struct sPAPRMachineState {
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
char *kvm_type;
|
char *kvm_type;
|
||||||
|
MemoryHotplugState hotplug_memory;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define H_SUCCESS 0
|
#define H_SUCCESS 0
|
||||||
|
@ -610,4 +612,14 @@ int spapr_rtc_import_offset(DeviceState *dev, int64_t legacy_offset);
|
||||||
|
|
||||||
#define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */
|
#define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This defines the maximum number of DIMM slots we can have for sPAPR
|
||||||
|
* guest. This is not defined by sPAPR but we are defining it to 32 slots
|
||||||
|
* based on default number of slots provided by PowerPC kernel.
|
||||||
|
*/
|
||||||
|
#define SPAPR_MAX_RAM_SLOTS 32
|
||||||
|
|
||||||
|
/* 1GB alignment for hotplug memory region */
|
||||||
|
#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30)
|
||||||
|
|
||||||
#endif /* !defined (__HW_SPAPR_H__) */
|
#endif /* !defined (__HW_SPAPR_H__) */
|
||||||
|
|
Loading…
Reference in a new issue