PV-Drivers for SeaBIOS using Upstream Qemu

4,150 views

Published on

As part of the Google Summer of Code, we tried to add support for SeaBIOS in order to allow guest OSes to be booted directly from PV disk devices rather than from the emulated disk device. SeaBIOS is the BIOS implementation that upstream qemu uses. When the virtual machine is created, SeaBIOS upon initialization uses a generic Xenstore client to communicate with the back end and initialize the front-end block device that will connect to the back end. After the connection is established I/O requests are made via the BIOS int 0x13 interface, guest OSes use the int 0x13 without needing to be aware that PV drivers were used.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,150
On SlideShare
0
From Embeds
0
Number of Embeds
2,576
Actions
Shares
0
Downloads
55
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PV-Drivers for SeaBIOS using Upstream Qemu

  1. 1. Prototype PV Drivers in SeaBIOS with upstream qemu Daniel Daniel Castro Velasco POSTECHSponsored by: & &&
  2. 2. What is SeaBIOSComponentsCurrent WorkFuture WorkQuestions
  3. 3. What is SeaBIOS• SeaBIOS is an open-source legacy BIOS implementation which can be used in HVMLoader. It implements the standard BIOS calling interfaces that a typical x86 proprietary BIOS implements.• HVMLoader is a binary blob deployed by the domain builder when a HVM machine is create.• Currently SeaBIOS is the BIOS implementation used in Upstream Qemu.• In this presentation we will use this terminology: term "backend" for the thing which implements the PV device, opposite, the PV driver "frontend". For emulated devices we use "device model" to refer to the thing which implements the device (upstream qemu).
  4. 4. Components Seabios32bit initialization code16bit interrupt handling Xen Headers Arch-x86/xen.h Sced.h Version.h Xs_wire.h Xen.h Memory.h Hvm_op.h Blkif.h hvm/Params.h Grant_table.h Event-channel.h Ring.h
  5. 5. Components CodeHypercall codeXenbus client (borrowed from hvmloader)Shared info pageGrant tableRings for each block deviceSeaBIOS macros
  6. 6. SeaBIOS Help MacrosEach low function modifies the segment pointers, if not specified SeaBIOS uses Code Segment pointer, if size of segment exceeds 256 kbytes, the segment grows. Malloc_low: allocate in CS Segment memalign_high allocate in last segment, maybe above 1MB barrier. SET_GLOBAL - GET_GLOBAL so global variables are usable from 16Bit SET/GET_SEG – GET_PTRFLAT, to specify from which segment create the pointer, the later turns a pointer from segment:offset to full pointer –in 32bit Container_of, return the container struct of drive_s: i.e. xendrive_s
  7. 7. Init Workflow (32 Bit code)Power on Selft Test (POST) Struct xendrive_s { struct drive_s drive; PCI_DEVICE_ID_XEN_BLK struct blkfront_info info: } Do_once Struct blkfront_info { Xenbus_setup int ring_ref; Grant table struct blkif_front_ring * private; Shared info page struct blkif_sring * shared; void * buffer; For each VBD int buf_gref; Struct xendrive_s } drive_s Struct drive_s { blkinfo u8 type; Share VDB with Xenstore u64 sectors; via xen-wire u32 cntl_ids; Once done register drive_s With add_boot_drive u16 blksize; … others … }
  8. 8. On int13 (16bit Code)(roughly) the following path:romlayout.S:entry_13() Struct disk_op_s { u64 lba; //sector disk.c:handle_13() void * buf_fl; //buffer disk.c:disk_13() struct drive_s *drive_g; //drive disk.c:disk_1302() u16 count //sector count u8 command; block.c:send_disk_op() } block.c:__send_disk_op() block.c:process_op() Xen-blk-op.c:xen_process_op.
  9. 9. Xen_process_op READ Request Specific Sector (lba) Build RING_GET_REQUEST -> PUSH_REQUEST RING_GET_RESPONSE -> OK memcpy from private buffer to buf_fl WRITE: memcpy from buf_fl to private Build RING_GET_REQUEST -> PUSH_REQUEST RING_GET_RESPONSE -> OK clean private buffer.Limitation: Per 8 sectors on a single write, read no more that buffer size. Max Buffer size of 4096 bytes
  10. 10. Future WorkXen_process_op can avoid using the privatebuffer, but has to manage (many more) grefs inthe shared buffer insteadNo shutdown sequence (free memory, channels,rings… etc.)Net PV Drivers - Possibly PXE SupportBenchmarks on performance
  11. 11. A patch exampleThese are used as part of the Xen hypercall interfaces.Signed-off-by: Daniel Castro <evil.dani@gmail.com>---src/xen.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---1 files changed, 58 insertions(+), 3 deletions(-)diff --git a/src/xen.h b/src/xen.hindex 0ed1e9f..f65078a 100644--- a/src/xen.h+++ b/src/xen.h@@ -17,6 +17,8 @@ static inline int usingXen(void) {}unsigned long xen_hypercall_page;+typedef unsigned long xen_ulong_t;+typedef unsigned long xen_pfn_t;
  12. 12. QuestionsQuestions
  13. 13. Special ThanksThis work was sponsored by Google Summer of code Ian Campbell
  14. 14. Thank you.

×