From: "Jan Beulich" Subject: [PATCH] fix MTRR dom0 interface Date: Wed, 04 Jan 2006 18:06:27 +0100 Message-ID: <43BC0EA3.76F0.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1436E683.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1436E683.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline The dom0_ops implementation wasn't matching the interface definition, leading to ill messages when X starts up (and potentially to other problems). The attached patch fixes that. However, it also points out that there is a potential disagreement between the dom0_ops interface and the internal MTRR interface - the former expects an unsigned register number from the domain, the latter wants a signed one and does a lookup when it's negative. I would think that the lookup code should just be ripped out of xen/arch/x86/mtrr/main.c. Jan --=__Part1436E683.0__= Content-Type: text/plain; name="xen-mtrr.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="xen-mtrr.patch" --- /home/jbeulich/src/xen/unstable/2005-12-20/xen/arch/x86/dom0_ops.c 2005-12-05 10:24:02.000000000 +0100 +++ 2005-12-20/xen/arch/x86/dom0_ops.c 2006-01-04 17:38:11.000000000 +0100 @@ -102,12 +102,27 @@ long arch_do_dom0_op(dom0_op_t *op, dom0 op->u.add_memtype.nr_pfns, op->u.add_memtype.type, 1); + if (ret > 0) + { + (void)__put_user(0, &u_dom0_op->u.add_memtype.handle); + (void)__put_user(ret, &u_dom0_op->u.add_memtype.reg); + ret = 0; + } } break; case DOM0_DEL_MEMTYPE: { - ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0); + if (op->u.del_memtype.handle == 0 + /* mtrr/main.c otherwise does a lookup */ + && (int)op->u.del_memtype.reg >= 0) + { + ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0); + if (ret > 0) + ret = 0; + } + else + ret = -EINVAL; } break; --=__Part1436E683.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part1436E683.0__=--