Subject: Re: NetBSD/amd64 domU on openSUSE 10.3 dom0 crashes
To: None <jakllsch@kollasch.net>
From: Christoph Egger <Christoph_Egger@gmx.de>
List: port-xen
Date: 01/21/2008 10:39:21
--Boundary-00=_JhGlH8p7AeF8FUi
Content-Type: text/plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Sunday 20 January 2008 19:38:15 jakllsch@kollasch.net wrote:
> Hi,
>
> As the subject may or may not imply, I'm trying to run
> a NetBSD/amd64 domU on a openSUSE amd64 10.3 dom0.

SuSE uses a patched Xen version based on Xen 3.1.x.
It is actually somewhere between Xen 3.1 and Xen 3.2.

> It's not really working.  When launching INSTALL_XEN3_DOMU
> it always says the domU crashed.  Sometimes I get:
>
> panic: HYPERVISOR_set_trap_table() failed

If that happens at boot time, then attached patch
will fix this.

@Manuel: Attached patch is required anyway for
Xen 3.2 and newer. Without it, the hypercall
fails which sets up the IDT.

> Anyway, my ultimate goal is to have a dom0 that
> can access a domU's paravirtual framebuffer.
>
> As I usually use NetBSD, I'd be happy to
> hear I could do this on a NetBSD dom0.
>
> Recommendations on a different Linux
> dom0 would be accepted too.

--Boundary-00=_JhGlH8p7AeF8FUi
Content-Type: text/x-diff;
  charset="iso-8859-15";
  name="netbsd_if.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="netbsd_if.diff"

Index: i386/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.624
diff -u -p -r1.624 machdep.c
--- i386/machdep.c	15 Jan 2008 14:50:08 -0000	1.624
+++ i386/machdep.c	21 Jan 2008 09:34:31 -0000
@@ -1922,8 +1922,19 @@ init386(paddr_t first_avail)
 	for (x = 0; x < 32; x++) {
 		KASSERT(xen_idt_idx < MAX_XEN_IDT);
 		xen_idt[xen_idt_idx].vector = x;
-		xen_idt[xen_idt_idx].flags =
-			(x == 3 || x == 4) ? SEL_UPL : SEL_XEN;
+		switch (x) {
+		case 2:
+		case 18:
+			TI_SET_IF(&(xen_idt[xen_idt_idx]), 2);
+			break;
+		case 3:
+		case 4:
+			xen_idt[xen_idt_idx].flags = SEL_UPL;
+			break;
+		default:
+			xen_idt[xen_idt_idx].flags = SEL_XEN;
+			break;
+		}
 		xen_idt[xen_idt_idx].cs = GSEL(GCODE_SEL, SEL_KPL);
 		xen_idt[xen_idt_idx].address =
 			(uint32_t)IDTVEC(exceptions)[x];

--Boundary-00=_JhGlH8p7AeF8FUi--