Commit 55398302 authored by Xavier Deguillard's avatar Xavier Deguillard Committed by Greg Kroah-Hartman

vmw_balloon: support 64-bit memory limit

Currently, the balloon driver would fail to run if memory is greater
than 16TB of vRAM. Previous patches have already converted the balloon
target and size to 64-bit, so all that is left to do add is to avoid
asserting memory is smaller than 16TB if the hypervisor supports 64-bits
target.

The driver advertises a new capability VMW_BALLOON_64_BITS_TARGET.
Hypervisors that support 16TB of memory or more will report that this
capability is enabled.
Signed-off-by: default avatarXavier Deguillard <xdeguillard@vmware.com>
Signed-off-by: default avatarNadav Amit <namit@vmware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47f8d995
...@@ -72,15 +72,26 @@ enum vmwballoon_capabilities { ...@@ -72,15 +72,26 @@ enum vmwballoon_capabilities {
VMW_BALLOON_BATCHED_CMDS = (1 << 2), VMW_BALLOON_BATCHED_CMDS = (1 << 2),
VMW_BALLOON_BATCHED_2M_CMDS = (1 << 3), VMW_BALLOON_BATCHED_2M_CMDS = (1 << 3),
VMW_BALLOON_SIGNALLED_WAKEUP_CMD = (1 << 4), VMW_BALLOON_SIGNALLED_WAKEUP_CMD = (1 << 4),
VMW_BALLOON_64_BIT_TARGET = (1 << 5)
}; };
#define VMW_BALLOON_CAPABILITIES (VMW_BALLOON_BASIC_CMDS \ #define VMW_BALLOON_CAPABILITIES_COMMON (VMW_BALLOON_BASIC_CMDS \
| VMW_BALLOON_BATCHED_CMDS \ | VMW_BALLOON_BATCHED_CMDS \
| VMW_BALLOON_BATCHED_2M_CMDS \ | VMW_BALLOON_BATCHED_2M_CMDS \
| VMW_BALLOON_SIGNALLED_WAKEUP_CMD) | VMW_BALLOON_SIGNALLED_WAKEUP_CMD)
#define VMW_BALLOON_2M_ORDER (PMD_SHIFT - PAGE_SHIFT) #define VMW_BALLOON_2M_ORDER (PMD_SHIFT - PAGE_SHIFT)
/*
* 64-bit targets are only supported in 64-bit
*/
#ifdef CONFIG_64BIT
#define VMW_BALLOON_CAPABILITIES (VMW_BALLOON_CAPABILITIES_COMMON \
| VMW_BALLOON_64_BIT_TARGET)
#else
#define VMW_BALLOON_CAPABILITIES VMW_BALLOON_CAPABILITIES_COMMON
#endif
enum vmballoon_page_size_type { enum vmballoon_page_size_type {
VMW_BALLOON_4K_PAGE, VMW_BALLOON_4K_PAGE,
VMW_BALLOON_2M_PAGE, VMW_BALLOON_2M_PAGE,
...@@ -571,8 +582,9 @@ static int vmballoon_send_get_target(struct vmballoon *b) ...@@ -571,8 +582,9 @@ static int vmballoon_send_get_target(struct vmballoon *b)
limit = totalram_pages(); limit = totalram_pages();
/* Ensure limit fits in 32-bits */ /* Ensure limit fits in 32-bits if 64-bit targets are not supported */
if (limit != (u32)limit) if (!(b->capabilities & VMW_BALLOON_64_BIT_TARGET) &&
limit != (u32)limit)
return -EINVAL; return -EINVAL;
status = vmballoon_cmd(b, VMW_BALLOON_CMD_GET_TARGET, limit, 0); status = vmballoon_cmd(b, VMW_BALLOON_CMD_GET_TARGET, limit, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment