Commit 0c9269a5 authored by David Hildenbrand's avatar David Hildenbrand Committed by Eduardo Habkost
Browse files

spapr: rename "hotplug memory" terminology to "device memory"



Let's make it clear at relevant places that we are dealing with device
memory. That it can be used for memory hotplug is just a special case.

Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Message-Id: <20180423165126.15441-11-david@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
[ehabkost: rebased series, solved conflicts at spapr.c]
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent f2ffbe2b
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -791,7 +791,7 @@ static int spapr_populate_drmem_v1(sPAPRMachineState *spapr, void *fdt,
    MachineState *machine = MACHINE(spapr);
    int i, ret;
    uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE;
    uint32_t hotplug_lmb_start = machine->device_memory->base / lmb_size;
    uint32_t device_lmb_start = machine->device_memory->base / lmb_size;
    uint32_t nr_lmbs = (machine->device_memory->base +
                       memory_region_size(&machine->device_memory->mr)) /
                       lmb_size;
@@ -808,7 +808,7 @@ static int spapr_populate_drmem_v1(sPAPRMachineState *spapr, void *fdt,
        uint64_t addr = i * lmb_size;
        uint32_t *dynamic_memory = cur_index;

        if (i >= hotplug_lmb_start) {
        if (i >= device_lmb_start) {
            sPAPRDRConnector *drc;

            drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, i);
@@ -827,7 +827,7 @@ static int spapr_populate_drmem_v1(sPAPRMachineState *spapr, void *fdt,
        } else {
            /*
             * LMB information for RMA, boot time RAM and gap b/n RAM and
             * hotplug memory region -- all these are marked as reserved
             * device memory region -- all these are marked as reserved
             * and as having no valid DRC.
             */
            dynamic_memory[0] = cpu_to_be32(addr >> 32);
@@ -865,7 +865,7 @@ static int spapr_populate_drconf_memory(sPAPRMachineState *spapr, void *fdt)
    MemoryDeviceInfoList *dimms = NULL;

    /*
     * Don't create the node if there is no hotpluggable memory
     * Don't create the node if there is no device memory
     */
    if (machine->ram_size == machine->maxram_size) {
        return 0;
@@ -1036,11 +1036,11 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt)
    GString *hypertas = g_string_sized_new(256);
    GString *qemu_hypertas = g_string_sized_new(256);
    uint32_t refpoints[] = { cpu_to_be32(0x4), cpu_to_be32(0x4) };
    uint64_t max_hotplug_addr = MACHINE(spapr)->device_memory->base +
    uint64_t max_device_addr = MACHINE(spapr)->device_memory->base +
        memory_region_size(&MACHINE(spapr)->device_memory->mr);
    uint32_t lrdr_capacity[] = {
        cpu_to_be32(max_hotplug_addr >> 32),
        cpu_to_be32(max_hotplug_addr & 0xffffffff),
        cpu_to_be32(max_device_addr >> 32),
        cpu_to_be32(max_device_addr & 0xffffffff),
        0, cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE),
        cpu_to_be32(max_cpus / smp_threads),
    };
@@ -2641,7 +2641,7 @@ static void spapr_machine_init(MachineState *machine)

    /* initialize hotplug memory address space */
    if (machine->ram_size < machine->maxram_size) {
        ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
        ram_addr_t device_mem_size = machine->maxram_size - machine->ram_size;
        /*
         * Limit the number of hotpluggable memory slots to half the number
         * slots that KVM supports, leaving the other half for PCI and other
@@ -2661,9 +2661,9 @@ static void spapr_machine_init(MachineState *machine)
        }

        machine->device_memory->base = ROUND_UP(machine->ram_size,
                                              SPAPR_HOTPLUG_MEM_ALIGN);
                                                SPAPR_DEVICE_MEM_ALIGN);
        memory_region_init(&machine->device_memory->mr, OBJECT(spapr),
                           "hotplug-memory", hotplug_mem_size);
                           "device-memory", device_mem_size);
        memory_region_add_subregion(sysmem, machine->device_memory->base,
                                    &machine->device_memory->mr);
    }
@@ -4262,11 +4262,11 @@ static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index,
    hwaddr phb0_base, phb_base;
    int i;

    /* Do we have hotpluggable memory? */
    /* Do we have device memory? */
    if (MACHINE(spapr)->maxram_size > ram_top) {
        /* Can't just use maxram_size, because there may be an
         * alignment gap between normal and hotpluggable memory
         * regions */
         * alignment gap between normal and device memory regions
         */
        ram_top = MACHINE(spapr)->device_memory->base +
            memory_region_size(&MACHINE(spapr)->device_memory->mr);
    }
+2 −2
Original line number Diff line number Diff line
@@ -747,8 +747,8 @@ int spapr_rng_populate_dt(void *fdt);
 */
#define SPAPR_MAX_RAM_SLOTS     32

/* 1GB alignment for hotplug memory region */
#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30)
/* 1GB alignment for device memory region */
#define SPAPR_DEVICE_MEM_ALIGN (1ULL << 30)

/*
 * Number of 32 bit words in each LMB list entry in ibm,dynamic-memory