From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933007AbbLNWbu (ORCPT ); Mon, 14 Dec 2015 17:31:50 -0500 Received: from p3plsmtps2ded03.prod.phx3.secureserver.net ([208.109.80.60]:55410 "EHLO p3plsmtps2ded03.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753643AbbLNW2X (ORCPT ); Mon, 14 Dec 2015 17:28:23 -0500 x-originating-ip: 72.167.245.219 From: "K. Y. Srinivasan" To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com Cc: Jake Oshins , "K. Y. Srinivasan" Subject: [PATCH RESEND 21/27] drivers:hv: Allow for MMIO claims that span ACPI _CRS records Date: Mon, 14 Dec 2015 16:01:52 -0800 Message-Id: <1450137718-26366-21-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1450137718-26366-1-git-send-email-kys@microsoft.com> References: <1450137698-26327-1-git-send-email-kys@microsoft.com> <1450137718-26366-1-git-send-email-kys@microsoft.com> X-CMAE-Envelope: MS4wfKWS+k/TzIRqqUgOZajQz4GeoVM+oEN+UwL+BfVsGJqlcf6laA94VDr/XsqfuzCgAnOuqec7lTWXJBtHSgka4oDlLbaabkXAiuFYG42TdfFawgPdHkfF Wt0ZjYGBxnWrj21KOeBXlH8IXo6C67QQszwxI7nl1lVtnIiJ4C0UAx5XFj/ElBV4XZDx3vdWq0GKOJ2B6ITviDTcaQs99A7aYbDcr8yc+dLGiDXj+llOQOBY vJqlTPt9fFviOlQm9+2trPu7eMEjDRuePU7H7Ns1h26VfXZt+tfdsUtZbBL/RaFPjEGL7gwkul6UxKYF2nxvVmkI3kOjLJwHjr7B8s+UFQ77wW+kmTWA0SdV 8ZJDVFZ/Rhs4eVjQfK5c6qo/9AZ5RpExAtJoGO0c6zGsi/o/vN6MHwvfDmQ452i8p8PBPX2lGRh60nadzth18lxf1pUcYg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jake Oshins This patch makes 16GB GPUs work in Hyper-V VMs, since, for compatibility reasons, the Hyper-V BIOS lists MMIO ranges in 2GB chunks in its root bus's _CRS object. Signed-off-by: Jake Oshins Signed-off-by: K. Y. Srinivasan --- drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index f123bca..328e4c3 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1063,12 +1063,28 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) new_res->start = start; new_res->end = end; + /* + * Stick ranges from higher in address space at the front of the list. + * If two ranges are adjacent, merge them. + */ do { if (!*old_res) { *old_res = new_res; break; } + if (((*old_res)->end + 1) == new_res->start) { + (*old_res)->end = new_res->end; + kfree(new_res); + break; + } + + if ((*old_res)->start == new_res->end + 1) { + (*old_res)->start = new_res->start; + kfree(new_res); + break; + } + if ((*old_res)->end < new_res->start) { new_res->sibling = *old_res; if (prev_res) -- 1.7.4.1