Skip to contentSkip to conversation

fix MTRR handling

PATCH New Jan Beulich 1 participant 1 message Jan 4, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix MTRR handling

After fixing the respective problems in the hypervisor it became apparent that there also was a problem in the guest. Attached patch fixes
- an obvious cut-and-paste error
- return value range issues
Clearly this patch should, in an appropriately modified form if necessary, also be applied to trees other than the merge one.

Jan

arch/i386/kernel/cpu/mtrr/main-xen.c +9 -3
Index: 2005-12-16/arch/i386/kernel/cpu/mtrr/main-xen.c
===================================================================
@@ -67,8 +67,10 @@ int mtrr_add_page(unsigned long base, un
 	op.u.add_memtype.pfn     = base;
 	op.u.add_memtype.nr_pfns = size;
 	op.u.add_memtype.type    = type;
-	if ((error = HYPERVISOR_dom0_op(&op)))
+	if ((error = HYPERVISOR_dom0_op(&op))) {
+		BUG_ON(error > 0);
 		return error;
+	}
 
 	if (increment)
 		++usage_table[op.u.add_memtype.reg];
@@ -131,8 +133,12 @@ int mtrr_del_page(int reg, unsigned long
 	if (--usage_table[reg] < 1) {
 		op.cmd = DOM0_DEL_MEMTYPE;
 		op.u.del_memtype.handle = 0;
-		op.u.add_memtype.reg    = reg;
-		(void)HYPERVISOR_dom0_op(&op);
+		op.u.del_memtype.reg    = reg;
+		error = HYPERVISOR_dom0_op(&op);
+		if (error) {
+			BUG_ON(error > 0);
+			goto out;
+		}
 	}
 	error = reg;
  out:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel