Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4851999imm; Mon, 17 Sep 2018 23:42:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdajNpJ/0t1PeeTsQts/kdJ4yGgusgiT4R6rHbfQElv7vBZykgAEtOuiUc1/+UQjKT9SlR5f X-Received: by 2002:a62:8186:: with SMTP id t128-v6mr28844303pfd.192.1537252928930; Mon, 17 Sep 2018 23:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537252928; cv=none; d=google.com; s=arc-20160816; b=c6jL5J2PXwszfbmkmPZRoe9Vy6z25dvirYgDxSVi66lDEJDzYqPCXiVHJHjSD+M6lZ 3eTqjJwJ23zBRGQ+9g0eenQu0lIojibwOVSyI5mcZ4xldAQyWCMrd3ViKfZ9fjJ66UNz oyhtGkxWN8izblQuBefugusNL8XY42XiZFzUIfOPUNNMBpgu6KSv0PUqgkoaJ8TGh9k0 Duu1D35ZIXU/olv/CNM53havzQO7rBGzhVCle+8S1VmAMmX0C1Fkm7hFzpTvqefT2Vzk ck5yIqwILhWjb/kTv5QVKi8lW5i16nWU8twtVo27fO9OY57in6U4jMf03TEP+O+kSkE6 L4VQ== 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=FC2IcPZACM9G1HoLds4Yh/NIYf/V9fCnKTDUIA7bZmc=; b=tRfYl1910b88BNhKGAFzuPClUAfTbb+o0iK3qi2ku3MKhdcwIq33IIAi1+iX3vvjlc r/YpsIViLH6uUA0fpRi08emb/l+UUP8Yu/KwNvA1wYPC902UFOhh2hIdBqAuxDzE9EKG y3OwIDPLd2Z9pi26QAWr4GupiM0a55x+fn0EhogdvZYoT1tuukgBNngf5XRzXydEWDrg /qcMAKTQtzVOwweXGU5YACqLnRXJLXGqlhkD1jb+7/GL78BojZpMWE39OL9ej+S0Ap7V F8ShJ0ceRdfB2/xCsvrmNUWh0Ca0XBZhdUV9lY4D+eh3uK95Ojlun25D9y9Znv+Ejqlp AJUA== 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 x7-v6si17461265pgi.465.2018.09.17.23.41.54; Mon, 17 Sep 2018 23:42:08 -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 S1729250AbeIRMLd (ORCPT + 99 others); Tue, 18 Sep 2018 08:11:33 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:30384 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbeIRMLd (ORCPT ); Tue, 18 Sep 2018 08:11:33 -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; Mon, 17 Sep 2018 23:40:17 -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 76D7B40857; Mon, 17 Sep 2018 23:40:20 -0700 (PDT) From: Nadav Amit To: Arnd Bergmann , Greg Kroah-Hartman CC: , Xavier Deguillard , Nadav Amit Subject: [PATCH 17/19] vmw_balloon: support 64-bit memory limit Date: Mon, 17 Sep 2018 23:38:51 -0700 Message-ID: <20180918063853.198332-18-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918063853.198332-1-namit@vmware.com> References: <20180918063853.198332-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 27cac1f98e1e..372282de649e 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -59,13 +59,24 @@ 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) +/* + * 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, @@ -549,8 +560,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