[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate devic
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory |
Date: |
Mon, 18 Feb 2019 10:31:55 +0100 |
On Tue, 5 Feb 2019 18:33:02 +0100
Eric Auger <address@hidden> wrote:
> The device memory region is located after the initial RAM.
> its start/size are 1GB aligned.
>
> Signed-off-by: Eric Auger <address@hidden>
> Signed-off-by: Kwangwoo Lee <address@hidden>
>
> ---
> v4 -> v5:
> - device memory set after the initial RAM
>
> v3 -> v4:
> - remove bootinfo.device_memory_start/device_memory_size
> - rename VIRT_HOTPLUG_MEM into VIRT_DEVICE_MEM
> ---
> hw/arm/virt.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 783468ba77..b683902991 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -61,6 +61,7 @@
> #include "hw/arm/smmuv3.h"
> #include "hw/mem/pc-dimm.h"
> #include "hw/mem/nvdimm.h"
> +#include "hw/acpi/acpi.h"
>
> #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
> static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
> @@ -1260,6 +1261,37 @@ static void create_secure_ram(VirtMachineState *vms,
> g_free(nodename);
> }
>
> +static void create_device_memory(VirtMachineState *vms, MemoryRegion *sysmem)
> +{
> + MachineState *ms = MACHINE(vms);
> + uint64_t device_memory_size = ms->maxram_size - ms->ram_size;
should size it with 1Gb alignment per slot from the start (to avoid x86
mistakes),
see enforce_aligned_dimm usage and associated commit for more details
> + uint64_t align = GiB;
> +
> + if (!device_memory_size) {
> + return;
> + }
> +
> + if (ms->ram_slots > ACPI_MAX_RAM_SLOTS) {
> + error_report("unsupported number of memory slots: %"PRIu64,
> + ms->ram_slots);
> + exit(EXIT_FAILURE);
> + }
> +
> + if (QEMU_ALIGN_UP(ms->maxram_size, align) != ms->maxram_size) {
> + error_report("maximum memory size must be aligned to multiple of 0x%"
> + PRIx64, align);
> + exit(EXIT_FAILURE);
> + }
> +
> + ms->device_memory = g_malloc0(sizeof(*ms->device_memory));
> + ms->device_memory->base = QEMU_ALIGN_UP(GiB + ms->ram_size, GiB);
^^^ where does this come from?
> +
> + memory_region_init(&ms->device_memory->mr, OBJECT(vms),
> + "device-memory", device_memory_size);
> + memory_region_add_subregion(sysmem, ms->device_memory->base,
> + &ms->device_memory->mr);
> +}
> +
> static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
> {
> const VirtMachineState *board = container_of(binfo, VirtMachineState,
> @@ -1569,6 +1601,10 @@ static void machvirt_init(MachineState *machine)
> machine->ram_size);
> memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram);
>
> + if (vms->extended_memmap) {
> + create_device_memory(vms, sysmem);
> + }
> +
> create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem);
>
> create_gic(vms, pic);
- [Qemu-arm] [PATCH v6 11/18] hw/arm/virt: Add memory hotplug framework, (continued)
- [Qemu-arm] [PATCH v6 13/18] hw/arm/virt-acpi-build: Add PC-DIMM in SRAT, Eric Auger, 2019/02/05
- [Qemu-arm] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, Eric Auger, 2019/02/05
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory,
Igor Mammedov <=
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, Auger Eric, 2019/02/19
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, David Hildenbrand, 2019/02/19
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, Igor Mammedov, 2019/02/21
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, Auger Eric, 2019/02/21
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, David Hildenbrand, 2019/02/21
- Re: [Qemu-arm] [Qemu-devel] [PATCH v6 14/18] hw/arm/virt: Allocate device_memory, Auger Eric, 2019/02/21
[Qemu-arm] [PATCH v6 15/18] nvdimm: use configurable ACPI IO base and size, Eric Auger, 2019/02/05
[Qemu-arm] [PATCH v6 18/18] hw/arm/virt: Add nvdimm and nvdimm-persistence options, Eric Auger, 2019/02/05
[Qemu-arm] [PATCH v6 17/18] hw/arm/boot: Expose the pmem nodes in the DT, Eric Auger, 2019/02/05