All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers:hv: Allow for MMIO claims that span ACPI _CRS records
@ 2015-11-09 21:30 jakeo
  0 siblings, 0 replies; only message in thread
From: jakeo @ 2015-11-09 21:30 UTC (permalink / raw)
  To: gregkh, kys, linux-kernel, devel, olaf, apw, vkuznets; +Cc: Jake Oshins

From: Jake Oshins <jakeo@microsoft.com>

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 <jakeo@microsoft.com>
---
 drivers/hv/vmbus_drv.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index c89d0e5..aef5fae 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1075,12 +1075,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.9.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-09 21:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 21:30 [PATCH 1/1] drivers:hv: Allow for MMIO claims that span ACPI _CRS records jakeo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.