[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/23] xen-hvm: Handle machine opt max-ram-below-4g
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 23/23] xen-hvm: Handle machine opt max-ram-below-4g |
Date: |
Mon, 23 Jun 2014 18:54:25 +0300 |
From: Don Slutz <address@hidden>
This is the xen part of "pc & q35: Add new machine opt max-ram-below-4g"
Note: this machine option cannot be used to increase the amount
of ram below 4G.
Signed-off-by: Don Slutz <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
xen-hvm.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/xen-hvm.c b/xen-hvm.c
index 5bcebdd..bafdf12 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -161,25 +161,36 @@ static void xen_ram_init(ram_addr_t *below_4g_mem_size,
{
MemoryRegion *sysmem = get_system_memory();
ram_addr_t block_len;
+ uint64_t user_lowmem = object_property_get_int(qdev_get_machine(),
+ PC_MACHINE_MAX_RAM_BELOW_4G,
+ &error_abort);
- block_len = ram_size;
- if (ram_size >= HVM_BELOW_4G_RAM_END) {
- /* Xen does not allocate the memory continuously, and keep a hole at
- * HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH
- */
- block_len += HVM_BELOW_4G_MMIO_LENGTH;
+ /* Handle the machine opt max-ram-below-4g. It is basicly doing
+ * min(xen limit, user limit).
+ */
+ if (HVM_BELOW_4G_RAM_END <= user_lowmem) {
+ user_lowmem = HVM_BELOW_4G_RAM_END;
}
- memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len);
- *ram_memory_p = &ram_memory;
- vmstate_register_ram_global(&ram_memory);
- if (ram_size >= HVM_BELOW_4G_RAM_END) {
- *above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
- *below_4g_mem_size = HVM_BELOW_4G_RAM_END;
+ if (ram_size >= user_lowmem) {
+ *above_4g_mem_size = ram_size - user_lowmem;
+ *below_4g_mem_size = user_lowmem;
} else {
*above_4g_mem_size = 0;
*below_4g_mem_size = ram_size;
}
+ if (!*above_4g_mem_size) {
+ block_len = ram_size;
+ } else {
+ /*
+ * Xen does not allocate the memory continuously, it keeps a
+ * hole of the size computed above or passed in.
+ */
+ block_len = (1ULL << 32) + *above_4g_mem_size;
+ }
+ memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len);
+ *ram_memory_p = &ram_memory;
+ vmstate_register_ram_global(&ram_memory);
memory_region_init_alias(&ram_640k, NULL, "xen.ram.640k",
&ram_memory, 0, 0xa0000);
--
MST
- [Qemu-devel] [PULL 12/23] qapi/string-output-visitor: fix human output, (continued)
- [Qemu-devel] [PULL 12/23] qapi/string-output-visitor: fix human output, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 14/23] qemu-char: avoid leaking unused fds in tcp_get_msgfds(), Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 15/23] virtio-pci: Report an error when msix vectors init fails, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 16/23] q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 17/23] hw/pcie: correct debug message, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 18/23] hw/pcie: implement power controller functionality, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 19/23] hw/pcie: better hotplug/hotunplug support, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 20/23] pcie: coding style tweak, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 22/23] pc & q35: Add new machine opt max-ram-below-4g, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 21/23] xen-hvm: Fix xen_hvm_init() to adjust pc memory layout, Michael S. Tsirkin, 2014/06/23
- [Qemu-devel] [PULL 23/23] xen-hvm: Handle machine opt max-ram-below-4g,
Michael S. Tsirkin <=
- Re: [Qemu-devel] [PULL 00/23] pc,pci,vhost,net fixes, enhancements, Peter Maydell, 2014/06/24