Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2283577imm; Thu, 20 Sep 2018 10:32:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYq8cZAphhjw8gq0znz9I2i2di82GZW1d1uKApeitPWYya1ZmvzxwvMl2ft5g6za4Jk/pu4 X-Received: by 2002:a63:ea49:: with SMTP id l9-v6mr37817182pgk.427.1537464758120; Thu, 20 Sep 2018 10:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537464758; cv=none; d=google.com; s=arc-20160816; b=gjbluZwGgRONdkC5tMUWM0bWaoaUE1Y5W8+nRWF85nyWLtKWeh3+KA4duOhDCQ9Y3p Zpx5ejmWv48+iI5XOQ8LIFJ/ZDukf9zF/sKIBdZ9uzv1goar5WZjD0gr8N8puWUtmXRu Zl9OnKaI9ejdAarqIXRREycaSOJp4+bWd8XpQ14tXJPgsbLxhaKnWAZF5JVFVW0QzbtU XJqbu+/VRM7nxGKmafXTroWUx2uNGEpHz3Eox6211ffdhAollzULMCiYg1tVTh7K6VwS FS51ToMMJpW+kOrUJFRafkFDc50Ia7O6glLK2CgEPh4yYo1pJnhLRudpXV52T3qBsoJP KBhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Xw+A/ePWLsgAq0hgVDy73WsNPjAzuPhcnWV0f/qY6Yg=; b=nPidjjQZWuqNfBSUd08G6Wxqpe9MdOplaT8tMLtSuZHVT2zOqSgxmShAc1URQTqaYQ xxITxMiG/PRHmhhwbc1cGNxTyw8lxgmuuy04Xf+VrpRPAqGI7igEtgmt5fEGofOP/JY4 f/43YkJCoKmXKuqc9r5PcLIzDk7UokJErEcZAx6MyZo04ntqFalpsBuJ0n+IN4ZSeGqH KTtoznH7Vy8M9v578DH1+uZU38TSoNIpSPuSDFXTrQpuzGdRa9KAtcXu3L1QfzMttekK wLlP1H5vUspwgImfW55860J1aoWro+yrhJJ3uUvrDP9aPDfypgK3QDKHInwBbkZG1cbg ykqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z68-v6si25551248pfz.163.2018.09.20.10.32.22; Thu, 20 Sep 2018 10:32:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388219AbeITXQj (ORCPT + 99 others); Thu, 20 Sep 2018 19:16:39 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:8434 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387939AbeITXQi (ORCPT ); Thu, 20 Sep 2018 19:16:38 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Thu, 20 Sep 2018 10:31:47 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 82B0B40699; Thu, 20 Sep 2018 10:31:48 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman , Arnd Bergmann CC: , Xavier Deguillard , Nadav Amit Subject: [PATCH v2 18/20] vmw_balloon: support 64-bit memory limit Date: Thu, 20 Sep 2018 10:30:24 -0700 Message-ID: <20180920173026.141333-19-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180920173026.141333-1-namit@vmware.com> References: <20180920173026.141333-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xavier Deguillard 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 Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index cace823bc68c..9da8b76342fd 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -59,15 +59,26 @@ enum vmwballoon_capabilities { VMW_BALLOON_BATCHED_CMDS = (1 << 2), VMW_BALLOON_BATCHED_2M_CMDS = (1 << 3), 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_2M_CMDS \ | VMW_BALLOON_SIGNALLED_WAKEUP_CMD) #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 { VMW_BALLOON_4K_PAGE, VMW_BALLOON_2M_PAGE, @@ -563,8 +574,9 @@ static int vmballoon_send_get_target(struct vmballoon *b) limit = totalram_pages; - /* Ensure limit fits in 32-bits */ - if (limit != (u32)limit) + /* Ensure limit fits in 32-bits if 64-bit targets are not supported */ + if (!(b->capabilities & VMW_BALLOON_64_BIT_TARGET) && + limit != (u32)limit) return -EINVAL; status = vmballoon_cmd(b, VMW_BALLOON_CMD_GET_TARGET, limit, 0); -- 2.17.1