Subject: Re: What has changed in order to bring Dom0 support for NetBSD
To: Wojciech A. Koszek <dunstan@freebsd.czest.pl>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-xen
Date: 08/03/2005 12:50:04
On Tue, Jul 26, 2005 at 01:16:24AM +0000, Wojciech A. Koszek wrote:
> Hello,
> Could someone write very short summary of tasks,
> which had to be done in order to get NetBSD/Xen 
> working in Domain 0? 
> 
> I've looked at commit information from the time of
> Manuel Bouyer's branch integration, but this change
> brought not only Dom0 and is hard to analyze.
> 
> PS: I know PCI code needs to be replaced so that it
> calls HYPERVISOR_* instead of directly calling
> priviledged instruction.

Hi,
sorry for not replying sooner, I was on vacation.
From what I remember, we needed (all this relative to the plain i386 port):
- change the pci_conf_* methods for PCI registers to go though hypervisor
  calls instead of direct registers access (xen/pci_machdep.c)
- change the PCI bus detection method to use the informations provided by
  the hypervisor (xen/hypervisor.c)
- change the interrupt register routine for PCI and ISA devices to use
  the appropriate hypervisor event (xen/pci_machdep.c and xen/isa_machdep.c)
- change the bus_dma(9) methods for deal with physical vs machine addresses
  (include/bus_private.h + tweaks to arch/x86/x86/bus_dma.c)

With this, a domain0 kernel should be able to probe and use the hardware.
Next, you have to write the xbd and network backends. In NetBSD the code is
in xen/xbdback.c and xen/xennetback.c. You also need to write kernel support
for domain0 operations though 2 special files:
/kern/xen/privcmd (xen/privcmd.c)
/dev/xenevt (xen/xenevt.c)
then you need to port the xentools to FreeBSD.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--