aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/vmw_balloon.c
diff options
context:
space:
mode:
authorXavier Deguillard <xdeguillard@vmware.com>2019-02-06 18:57:02 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-08 06:13:41 -0500
commit5539830278fa96b9e78030ad80f9f4cfc3dc29e1 (patch)
tree2c9a66dcc19636912e24c8f77d437e9d50675733 /drivers/misc/vmw_balloon.c
parent47f8d9957d5080d03b70a9af481151e0953f844c (diff)
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: Xavier Deguillard <xdeguillard@vmware.com> Signed-off-by: Nadav Amit <namit@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/vmw_balloon.c')
-rw-r--r--drivers/misc/vmw_balloon.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index c4371ec132d3..f96dc3690ade 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -72,15 +72,26 @@ enum vmwballoon_capabilities {
72 VMW_BALLOON_BATCHED_CMDS = (1 << 2), 72 VMW_BALLOON_BATCHED_CMDS = (1 << 2),
73 VMW_BALLOON_BATCHED_2M_CMDS = (1 << 3), 73 VMW_BALLOON_BATCHED_2M_CMDS = (1 << 3),
74 VMW_BALLOON_SIGNALLED_WAKEUP_CMD = (1 << 4), 74 VMW_BALLOON_SIGNALLED_WAKEUP_CMD = (1 << 4),
75 VMW_BALLOON_64_BIT_TARGET = (1 << 5)
75}; 76};
76 77
77#define VMW_BALLOON_CAPABILITIES (VMW_BALLOON_BASIC_CMDS \ 78#define VMW_BALLOON_CAPABILITIES_COMMON (VMW_BALLOON_BASIC_CMDS \
78 | VMW_BALLOON_BATCHED_CMDS \ 79 | VMW_BALLOON_BATCHED_CMDS \
79 | VMW_BALLOON_BATCHED_2M_CMDS \ 80 | VMW_BALLOON_BATCHED_2M_CMDS \
80 | VMW_BALLOON_SIGNALLED_WAKEUP_CMD) 81 | VMW_BALLOON_SIGNALLED_WAKEUP_CMD)
81 82
82#define VMW_BALLOON_2M_ORDER (PMD_SHIFT - PAGE_SHIFT) 83#define VMW_BALLOON_2M_ORDER (PMD_SHIFT - PAGE_SHIFT)
83 84
85/*
86 * 64-bit targets are only supported in 64-bit
87 */
88#ifdef CONFIG_64BIT
89#define VMW_BALLOON_CAPABILITIES (VMW_BALLOON_CAPABILITIES_COMMON \
90 | VMW_BALLOON_64_BIT_TARGET)
91#else
92#define VMW_BALLOON_CAPABILITIES VMW_BALLOON_CAPABILITIES_COMMON
93#endif
94
84enum vmballoon_page_size_type { 95enum vmballoon_page_size_type {
85 VMW_BALLOON_4K_PAGE, 96 VMW_BALLOON_4K_PAGE,
86 VMW_BALLOON_2M_PAGE, 97 VMW_BALLOON_2M_PAGE,
@@ -571,8 +582,9 @@ static int vmballoon_send_get_target(struct vmballoon *b)
571 582
572 limit = totalram_pages(); 583 limit = totalram_pages();
573 584
574 /* Ensure limit fits in 32-bits */ 585 /* Ensure limit fits in 32-bits if 64-bit targets are not supported */
575 if (limit != (u32)limit) 586 if (!(b->capabilities & VMW_BALLOON_64_BIT_TARGET) &&
587 limit != (u32)limit)
576 return -EINVAL; 588 return -EINVAL;
577 589
578 status = vmballoon_cmd(b, VMW_BALLOON_CMD_GET_TARGET, limit, 0); 590 status = vmballoon_cmd(b, VMW_BALLOON_CMD_GET_TARGET, limit, 0);