Showing posts with label Xen. Show all posts
Showing posts with label Xen. Show all posts

Sunday, September 30, 2012

DABT/PABT handling.

Figured out why at least kernel panic handling of DABT/PABT cases was yielding garbage. Going to rewrite the handlers to use the existing SAVE_CONTEXT and RESTORE_CONTEXT. Jury still out on whether the VM trap handling really has to happen the way it is currently, but the code can surely be simplified.

In an unrelated project, investigating lost event upcalls in an x64 PV OS. It's very aggravating that the PV interface is not documented in a fashion that doesn't necessitate combing through sources to find out the call stack layout and the contract between the hypervisor and PV OS. For x86-32 at least there was a book. I shouldn't need to spend a week studying the x64 hypervisor to figure out how to write a PV OS for it.

Here's hoping I do a better job with xen3-arm-tegra.

A


Thursday, September 27, 2012

Not such a long way.

Framebuffer support is in, which means that finally, I can almost ditch the serial cable for a lot of work. It also means you don't need a special Xoom (or potentially - some other Tegra2 device) with a serial port. Retail Xoom owners can now proudly do...ummm...something. Not a whole lot, yet ;-(.

Found a page fault abort within __divdi3, but couldn't really debug it since the DABT handler (or should I say - the CPU context save code) is woefully broken. So before I can figure out what's wrong with __divdi3, I need to fix the trap handlers.

But wait, Andrei, how could you have the timer working then??? The IRQ path is completely different (as is the CPU context structure manipulated). Why? No clue... Won't be when I'm done with it ;-).

Btw, ARMv8 will support a division instruction. Until then, I'll have an excuse to read Knuth.

https://plus.google.com/114030412547992895028/posts/Y1MsnBwKCMX

A

Wednesday, September 26, 2012

On my long way to a framebuffer console...

Here I was hoping to have the framebuffer console done so I can finally move to working on more interesting aspects of my ARMv7 Xen3 rewrite, but alas before getting there I had to make the console layer more generic.

For an extra bonus I've simplified and cleaned up the serial layer. The whole L/H muxing to handle gdb and dom0/xen console traffic was a little insane :-). I'd rather use "O" gdb packets out (btw is this extension officially documented anywhere?)

Can't wait to move on...but having visible things to show people is cool too ;-).

Tuesday, September 25, 2012

I'm back


So I've decided I should continue to write here. After all, I work on relatively interesting, exciting to me things I feel I need to share with the world :-).

Anyway.

It's been an interesting summer. After attending the Linux Symposium in Ottawa with three papers [0] and being again a Tiano Core mentor for Google Summer of Code, I'm back to hacking things filesystem and virtualization related.

My Xen port to Tegra2 has been seeing a lot of attention from me. It's hard to call it a port, as I'm mostly approaching it from rewrite-everything angle, especially given the research prototype status of the initial Samsung ARMv5 tree I forked over two years ago. Of course, EmbeddedXen and ARM PV efforts haven't been sitting still in the meantime, but I'm treating the project as a personal "let's write a hypervisor" effort. There's no explicit desire to be compatible to any other ARM Xen effort.

My branch is targetting ARMv7, initially since that's what I've got around the house, but after digging through ARM ARM both for v6 and v7 I'm glad I'm not targeting anything older. The current differences from the original Samsung tree -
* ARMv7-only support.
* Tegra2 platform, targeting the Motorola Xoom
* Dom0/U configuration is not hardcoded.
* Boot through ATAG-compatible bootloader, with all images passed through a "boot volume".
* Kernel threads ("xen domains"), which are currently cooperative, but full preemption is a design goal.
* No ACM, given likely hypercall changes.
* A FIQ-based extensible serial kernel debugger with useful commands to help debugging and bring-up.
* In progress work on a framebuffer debug console.
* Reworked VMM and PT support with AFE and XN.

I'm concentrating on fleshing out crash debugging and framebuffer debug console support at the moment. After that it's (in no particular order) -
* L2 cache integration.
* Synchronization.
* Switching to VM and back.
* Full preemption for xen domains.
* Hypercall definitions.

I'll leave you with a short video demonstration of what I've got at the moment. It's not too amazing, the most interesting stuff is well ahead.

[0] http://labs.vmware.com/publications/2012-linux-symposium-publications
[1] https://github.com/andreiw/xen3-arm-tegra

Friday, March 2, 2012

Blowing the dust off of my Xoom.

ATAG    (P): 0x00000100
Linked  (V): 0xff008000
Actual  (P): 0x00a00800
Desired (P): 0x00108000

Handing off to C...
[XEN]  __  __            _____  ___   ____    ____  
[XEN]  \ \/ /___ _ __   |___ / / _ \ |___ \  |___ \ 
[XEN]   \  // _ \ '_ \    |_ \| | | |  __) |__ __) |
[XEN]   /  \  __/ | | |  ___) | |_| | / __/|__/ __/ 
[XEN]  /_/\_\___|_| |_| |____(_)___(_)_____| |_____|
[XEN]                                               
[XEN] Xen/ARMv7 virtual machine monitor for ARM architecture
[XEN] Copyright (C) 2012 Andrei Warkentin <andreiw@msalumni.com>
[XEN] Copyright (C) 2007 Samsung Electronics Co, Ltd. All Rights Reserved.
[XEN]  http://www.cl.cam.ac.uk/netos/xen
[XEN]  University of Cambridge Computer Laboratory
[XEN] 
[XEN]  Xen version 3.0.2-2 (andreiw@(none)) (gcc version 4.4.3 (GCC) ) Fri Mar  2 01:59:34 EST 2012
[XEN]  Platform: arm-tegra
[XEN]  GIT SHA: ffd558debcf08dcf59a0c38115906030bf6f261c
[XEN] 
[XEN] TTB PA 0x104000
[XEN] idle_pgd VA 0xff004000
[XEN] xen_pstart 0x0
[XEN] xen_pend 0x40000000
[XEN] _end 0xff03e708
[XEN] _end VA 0x13E708
[XEN] nr_pages needed for all page_infos = 0x500
[XEN] frame table is at 0xff03f000-0xff53f000
[XEN] xenheap_phys_start = 0x648000 (VA 0xff548000)
[XEN] xenheap_phys_end = 0x848000 (VA 0xff748000)
[XEN] looking at bank 0
[XEN]         base - 0x0
[XEN]         end  - 0x40000000
[XEN] calling init_boot_pages on 0x648000-0x40000000
[XEN] Using scheduler: Simple EDF Scheduler (sedf)
[XEN] Initializing ARM FCSE Unit
[XEN] *** LOADING DOMAIN : 0 ***
[XEN] DOM0 image is not a Xen-compatible Elf image.
[XEN] Could not set up DOM0 guest OS
[XEN] 
[XEN] VMM Panic at xensetup.c:357
https://github.com/andreiw/xen3-arm-tegra

Hopefully the next time I work on this won't be in another half a year.

Monday, May 16, 2011

GSoC

Here is the latest from Xen UEFI land:
  • We can boot to UEFI Shell, finally. The hurdles were -
    • Different PCI I/O range compared to Qemu, this resulted in a domain crash when an emulated I/O device tried to register for already registered ports. Boo.
    • ACPI timer block hardcoded by Xen at I/O 0xB000. Yes, modifying the "special BAR" has no effect, so UEFI TimerLib code needs to be careful in configuring the timer... if the PCI registers already look configured - use selected values. They are now set once in hvmloader.
    • 8259 PIC ExtInt routing needed to be enabled in APIC inside hvmloader, because TianoCore has no APIC support.
  • Started making OvmfPkg Xen aware. This was necessarily for at least registering the right I/O ranges. Now, the hypercall pages are populated and a GUIDed HOB containing Xen hypervisor info is published. This will be consumed by the hypervisor DXE.
I see the overall layering as being something like -
  • Hypervisor driver - consumes HOB, publishes the EFI_XEN_HYPERCALL_PROTOCOL.
  • XenTables driver - exposes Xen ACPI and SMBIOS tables, which were built into hvmloader.
  • XenBus driver - consumes Hypervisor driver, creates child nodes for virtual I/O devices, publishes EFI_XEN_BUS_PROTOCOL.
  • XenStore driver - exercises XenBus interface, allows SIMPLE_FILE_IO_PROTOCOL access to XenStore nodes.
  • Blockfront, Netfront, Fbfront drivers for block, network and video, respectively.
Latest patches as usual at https://github.com/andreiw/andreiw-wip/tree/master/xen/ovmf-support.

Friday, May 6, 2011

UEFI OVMF/Xen

For anyone interested in the GSoC project status:
- We can boot the 32-bit and the 64-bit OVMF image now inside an HVM domain instead of BIOS
- We end up crashing the HVM domain during PCI bus enumeration (qemu-dm crash?), which is what the student is now investigating...

Xen changes so far included refactoring changes inside hvmloader, adding a new bios_config structure for OVMF images, ensuring that guest physical memory under 4GB is backed with pages, as well as moving out Xen structures from below 4GB where they would collide with the firmware. The hvmloader/bios xenstore key was exposed to xend/xm (hvmbios parameter, values can be rombios, ovmf32 and ovmf64), to faciliate easier testing. Some thought still needs to be put into libxl (xend replacement) changes.
In general OVMF/Xen patches for Xen and TianoCore will be at https://github.com/andreiw/andreiw-wip/tree/master/xen/ovmf-support

Wednesday, April 27, 2011

GSoC

Today Jordan Justen of the EDK2 TianoCore project announced that four students will be working on UEFI EDK2 projects. I am very excited to be mentoring the OVMF on Xen project, which will enable UEFI firmware for HVM Xen virtual machines.

With luck and lots and lots of work, by the end of this mentorship we will be able to boot into Linux using Xen PV devices (blkback...).

This presents a wonderful opportunity to share my Xen and EDK experiences and help out two projects I love :-).