Manuel Bouyer | 18 Jan 17:17 2005
Picon

xen2 status

Hi,
I just commited to the bouyer-xen2 branch what I have so far.
First I fixed the xbd driver, to not require the printf in if_xennet to
properly attach. Turn out it was a race condition between the kernel
registering interrupt handlers, and xen sending control messages.
If the clock interrupt was registered too soon, we would deadlock in
xbd.c waiting for an interrupt that can't happen because we're already in
interrupt context. I fixed this by using a kernel thread instead (which will
also help when we'll support dynamic creation/removal of block devices).

Second, it's possible to run NetBSD as domain0. It supports the xen console,
PCI devices probing and I/O mapped registers on PCI devices, as well as
hardware interrupts. memory-mapped registers on PCI devices may work,
but this has not been tested yet. DMA don't work yet, some more work
is needed. Creating other domains isn't supported yet.

For now, we can boot the kernel, it will detect PCI devices, pciide will
work in PIO mode, and we have console access though xencons.
It's a start, but there are still some work do do, both in the kernel
side (bus_dma, ISA bus, domain0 ioctls and block/network drivers backends),
and userland (port the xen domain0 tools to NetBSD).

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer <at> lip6.fr
     NetBSD: 26 ans d'experience feront toujours la difference
--

Jason Thorpe | 20 Jan 15:56 2005

Xen and bounce buffers


On Jan 20, 2005, at 4:31 AM, Manuel Bouyer wrote:

> Log Message:
> bus_dma(9) for xen. Derived from arch/x86/x86/bus_dma.c.
> bounce buffers not supported yet, because xen doesn't have an interface
> to request memory in a specific range (this means that DMA on ISA won't
> be supported), but I've left the code commented out because xen will
> likely provide an appropriate hypercall in the future.

This is important for more than just ISA DMA.  PCI DMA needs them on 
systems with more than 4G of RAM, if the device doesn't support dual 
address cycle.

         -- Jason R. Thorpe <thorpej <at> shagadelic.org>

Manuel Bouyer | 20 Jan 16:05 2005
Picon

Re: Xen and bounce buffers

On Thu, Jan 20, 2005 at 06:56:56AM -0800, Jason Thorpe wrote:
> 
> On Jan 20, 2005, at 4:31 AM, Manuel Bouyer wrote:
> 
> >Log Message:
> >bus_dma(9) for xen. Derived from arch/x86/x86/bus_dma.c.
> >bounce buffers not supported yet, because xen doesn't have an interface
> >to request memory in a specific range (this means that DMA on ISA won't
> >be supported), but I've left the code commented out because xen will
> >likely provide an appropriate hypercall in the future.
> 
> This is important for more than just ISA DMA.  PCI DMA needs them on 
> systems with more than 4G of RAM, if the device doesn't support dual 
> address cycle.

Sure. This is why the xen folk will probably add an hypercall to
allocate DMA-safe memory. Otherwise 32bit PCI won't work on x86_64.
I talked with Christian about this, he said that this would most likely
be something similar to what is currently done to get contigous memory
(we give some pages to the hypervisor, which returns us the same amount
of memory, but contiguous).

--

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

Manuel Bouyer | 20 Jan 20:52 2005
Picon

help with assembly (2)

Hi,
Again I'm stuck with some assembly code (I don't know much about i386 assembly,
and I've never mixed assembly and C). I have this code in xen/i386/vector.S:
#define hypervisor_asm_unmask(num)                      \
        movl    irq_to_evtchn + (num) * 4,%ecx          ;\
	movl    HYPERVISOR_shared_info,%eax             ;\
	lock                                            ;\
	btrl    %ecx,EVENTS_MASK(%eax)
(BTW, what does the "lock" instruction ?)
I need to add a call to this C function at the end of this asm
statement:
	pirq_notify(num)
num being a constant. The prototype for the function is:
void pirq_notify(int irq);

I tried
	        pushl   $(num)                                  ;\
		call    _C_LABEL(pirq_notify) 
but I get a page fault trap at the first call, with something that doesn't
make much sense on the stack. So I guess I missed something, but I don't
know what ... I assume registers are callee-saved, but maybe I'm wrong
on this.

--

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

Manuel Bouyer | 21 Jan 12:04 2005
Picon

Re: help with assembly (2)

On Thu, Jan 20, 2005 at 08:52:00PM +0100, Manuel Bouyer wrote:
> Hi,
> Again I'm stuck with some assembly code (I don't know much about i386 assembly,
> and I've never mixed assembly and C). I have this code in xen/i386/vector.S:
> #define hypervisor_asm_unmask(num)                      \
>         movl    irq_to_evtchn + (num) * 4,%ecx          ;\
> 	movl    HYPERVISOR_shared_info,%eax             ;\
> 	lock                                            ;\
> 	btrl    %ecx,EVENTS_MASK(%eax)
> (BTW, what does the "lock" instruction ?)
> I need to add a call to this C function at the end of this asm
> statement:
> 	pirq_notify(num)
> num being a constant. The prototype for the function is:
> void pirq_notify(int irq);
> 
> I tried
> 	        pushl   $(num)                                  ;\
> 		call    _C_LABEL(pirq_notify) 
> but I get a page fault trap at the first call, with something that doesn't
> make much sense on the stack. So I guess I missed something, but I don't
> know what ... I assume registers are callee-saved, but maybe I'm wrong
> on this.

I've not been able to figure out how to call pirq_notify, however I've
been able to inline the needed hypercall here. Now I need to figure out
how to test a bit in a int32_t array, and avoid the hypercall when not
needed ...

--

-- 
(Continue reading)

Manuel Bouyer | 21 Jan 12:08 2005
Picon

xen2 status update

Hi,
with the last bits I just commited, we now have a usable domain0 OS
with physical devices: pciide, PCI SCSI and network adapter works.
Still no support for ISA busses, which mean that we're stuck with
xencons for now, as pckbc won't attach. I'll look at this later
(for now, serial console is much more convenient anyway :)

Now I'll start working on domain management bits, to be able to start
a guest domain from NetBSD and load a kernel. The last bit will be to write
the block and network driver backend.

--

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


Gmane