Skip to contentSkip to conversation

Prototype to use QEMU for PV guest framebuffer

PATCH Daniel P. Berrange 3 participants 5 messages Jul 27, 2007 – Aug 2, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

As many of us are all too painfully aware we have completely different VNC server implementations for paravirt vs fullyvirt Xen guests. The former based on libvncserver, the latter integrated into QEMU. There are many new and interesting ideas being tried out in the VNC server space in particular wrt to virtualization and having to implement them all twice is not very desirable. Also libvncserver code is terrible - many bad thread race conditions that are near impossible to diagnose, let alone solve :-(

At the summit there were a couple of suggestions, either taking the VNC server code from QEMU and splicing it into the xenfb daemon. Another was to take the QEMU VNC code and put it into a library that can be used by both QEMU & xenfb. Neither of those is a particularly appealing prospect.

Then Anthony Liguori suggested a 3rd approach, which was to add a new QEMU machine type to the x86 target, and simply disable all the emulated hardwre and just make use of QEMU infrastructure for the VNC server, select() event loop and display state.

This sounded very intriguing so I did a little experimentation today doing exactly that. First of all I've copied tools/xenfb/xenfb.c into the qemu/hw/xenfb.c file. Next I added a qemu/hw/xen.c file to provide the implementation of the QEMU machine type - called 'xenpv'.

All the interesting code (all 100 lines of it) is in hw/xen.c in the xen_init_pv method - which is called when using the '-M xenpv' command line arg.

The first thing this does is get the domain ID - to avoid touching QEMU's command line args, I just use an environ variable XEN_DOMID to pass this in.

The main_loop() in qemu/vl.c assumes there is always one CPU created in the VM, but for our purposes we're not doing any CPU emulation merely using the event loop/display state. So to workaround this assumption I create a single CPUState * instance, and permanently disable it by setting 'cpu->hflags = HF_HALTED_MASK'. Seems to do the job.

Next, up we attach to the guest PVFB frontend - just using the existing code for this - qemu/hw/xenfb.c (formerly xen-unstable/tools/xenfb/xenfb.c).

Now we register a QEMU graphical console, a mouse event receiver, a keyboard event receiver, and register the xenstored and event channel file handles with QEMU's event loop.

Finally, initialize QEMU's display state to match the PVFB framebuffer config (ie 800x600x32).

Pushing mouse & keyboard events through from QEMU to PVFB frontend is trivial. The only bit I'm unhappy about is that QEMU can't access the guest framebuffer directly. The DisplayState * struct has its own copy of the framebuffer - allocated by the VNC or SDL impls in QEMU - and so whenever the guest framebuffer changes, we have to memcpy() the data from the guest into the QEMU framebuffer. Still, this is no worse than what the HVM guests already do. Its probably not too hard to change the QEMU impl of VNC / SDL to use the guest framebuffer directly if we did a little re-factoring. I wanted to keep it simple for now & not change any of the upstream QEMU code.

This attached patch is against the current upstream QEMU CVS code, not Xen's ioemu, since I wanted to work against pristine QEMU codebase & avoid any potential wierd iteractions with HVM stuff added to ioemu. The diff is

$ diffstat ~/xen-qemu-pvfb-machine.patch
 Makefile.target |    3 
 b/hw/xen.c      |  113 +++++++
 b/hw/xenfb.c    |  822 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 b/hw/xenfb.h    |   35 ++
 vl.c            |    1 
 vl.h            |    3 
 6 files changed, 976 insertions(+), 1 deletion(-)

So, you can see a mere 113 lines of new code to make this work - xenfb.c is the existnig tools/xenfb/xenfb.c file with minor tweaks. And we get to delete 20,000 lines of terrible libvncserver code !

Apply the patch to QEMU CVS checkout, configure to build an x86 target, and once done you can run with

# XEN_DOMID=31 ./i386-softmmu/qemu -M xenpv -hda /dev/null -vnc :0

The -hda flag is just to keep QEMU's command line parse quiet - it wants at least one disk.

You can also run in SDL mode

# XEN_DOMID=31 ./i386-softmmu/qemu -M xenpv -hda /dev/null

Thoughts... ? If there's positive feedback on this approach I'll develop the patch further & properly integrate with XenD & domain create/teardown.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
Makefile.target +2 -1
diff -r 37f6e57ef2c2 Makefile.target
@@ -423,10 +423,11 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 ifeq ($(TARGET_BASE_ARCH), i386)
 # Hardware support
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
-VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
+VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o xen.o xenfb.o
 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmware_vga.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
+LIBS += -lxenctrl -lxenstore
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
hw/xen.c new file +113 -0

113 lines not on this page · raw message

hw/xenfb.c new file +822 -0

822 lines not on this page · raw message

hw/xenfb.h new file +35 -0
diff -r 37f6e57ef2c2 hw/xenfb.h
@@ -0,0 +1,35 @@
+#ifndef _XENFB_H_
+#define _XENFB_H_
+
+#include <stdbool.h>
+#include <sys/types.h>
+
+struct xenfb
+{
+	void *pixels;
+
+	int row_stride;
+	int depth;
+	int width;
+	int height;
+	int abs_pointer_wanted;
+
+	void *user_data;
+
+	void (*update)(struct xenfb *xenfb, int x, int y, int width, int height);
+};
+
+struct xenfb *xenfb_new(void);
+void xenfb_delete(struct xenfb *xenfb);
+void xenfb_teardown(struct xenfb *xenfb);
+
+int xenfb_attach_dom(struct xenfb *xenfb, int domid);
+
+int xenfb_register_events(struct xenfb *xenfb_pub);
+
+int xenfb_send_key(struct xenfb *xenfb, bool down, int keycode);
+int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y);
+int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y);
+int xenfb_send_buttons(struct xenfb *xenfb_pub, int state);
+
+#endif
vl.c +1 -0
diff -r 37f6e57ef2c2 vl.c
@@ -6966,6 +6966,7 @@ void register_machines(void)
 #if defined(TARGET_I386)
     qemu_register_machine(&pc_machine);
     qemu_register_machine(&isapc_machine);
+    qemu_register_machine(&xenpv_machine);
 #elif defined(TARGET_PPC)
     qemu_register_machine(&heathrow_machine);
     qemu_register_machine(&core99_machine);
vl.h +3 -0
diff -r 37f6e57ef2c2 vl.h
@@ -1150,6 +1150,9 @@ extern QEMUMachine isapc_machine;
 extern QEMUMachine isapc_machine;
 extern int fd_bootchk;
 
+/* xen.c */
+extern QEMUMachine xenpv_machine;
+
 void ioport_set_a20(int enable);
 int ioport_get_a20(void);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 39 lines · Daniel P. Berrange

As many of us are all too painfully aware we have completely different VNC server implementations for paravirt vs fullyvirt Xen guests. The former based on libvncserver, the latter integrated into QEMU. There are many new and interesting ideas being tried out in the VNC server space in particular
wrt to virtualization and having to implement them all twice is not very
desirable. Also libvncserver code is terrible - many bad thread race conditions that are near impossible to diagnose, let alone solve :-(

At the summit there were a couple of suggestions, either taking the VNC server code from QEMU and splicing it into the xenfb daemon. Another was to take the QEMU VNC code and put it into a library that can be used by both QEMU & xenfb. Neither of those is a particularly appealing prospect.

Then Anthony Liguori suggested a 3rd approach, which was to add a new QEMU
machine type to the x86 target, and simply disable all the emulated hardwre
and just make use of QEMU infrastructure for the VNC server, select() event loop and display state.

This sounded very intriguing so I did a little experimentation today doing
exactly that. First of all I've copied tools/xenfb/xenfb.c into the qemu/hw/xenfb.c file. Next I added a qemu/hw/xen.c file to provide the implementation of the QEMU machine type - called 'xenpv'.

All the interesting code (all 100 lines of it) is in hw/xen.c in the xen_init_pv method - which is called when using the '-M xenpv' command line arg.

The first thing this does is get the domain ID - to avoid touching QEMU's command line args, I just use an environ variable XEN_DOMID to pass this in.

The main_loop() in qemu/vl.c assumes there is always one CPU created in
the VM, but for our purposes we're not doing any CPU emulation merely using the event loop/display state. So to workaround this assumption I create a single CPUState * instance, and permanently disable it by setting 'cpu->hflags = HF_HALTED_MASK'. Seems to do the job.

Next, up we attach to the guest PVFB frontend - just using the existing code for this - qemu/hw/xenfb.c (formerly xen-unstable/tools/xenfb/xenfb.c).

Now we register a QEMU graphical console, a mouse event receiver, a keyboard event receiver, and register the xenstored and event channel file handles with QEMU's event loop.

Finally, initialize QEMU's display state to match the PVFB framebuffer config (ie 800x600x32).

Quoted 6 lines

Pushing mouse & keyboard events through from QEMU to PVFB frontend is trivial. The only bit I'm unhappy about is that QEMU can't access the guest framebuffer directly. The DisplayState * struct has its own copy of the framebuffer - allocated by the VNC or SDL impls in QEMU - and so whenever the guest framebuffer changes, we have to memcpy() the data from the guest into the QEMU framebuffer.

The DisplayState driver (VNC or SDL) chooses what the depth and format of this ds->data buffer should be. The PVFB expects a certain format so you would have to do more than just a memcpy(). You'll have to be able to translate between the xenfb format and the ds->data format.

This is very cool stuff though! Since QEMU already supports VNC and SDL, we don't need to maintain any additional pvfb backends.

Regards,

Anthony Liguori

Quoted 8 lines

Still, this is no worse than
what the HVM guests already do. Its probably not too hard to change the QEMU impl of VNC / SDL to use the guest framebuffer directly if we did a little re-factoring. I wanted to keep it simple for now & not change any of the upstream QEMU code.

This attached patch is against the current upstream QEMU CVS code, not Xen's ioemu, since I wanted to work against pristine QEMU codebase & avoid any potential wierd iteractions with HVM stuff added to ioemu. The diff is

#2 lore raw
In reply to Daniel P. Berrange
Quoted 5 lines

Pushing mouse & keyboard events through from QEMU to PVFB frontend is trivial. The only bit I'm unhappy about is that QEMU can't access the guest framebuffer directly. The DisplayState * struct has its own copy of the framebuffer - allocated by the VNC or SDL impls in QEMU - and so whenever the guest framebuffer changes, we have to memcpy() the

data

Quoted 2 lines

from the guest into the QEMU framebuffer. Still, this is no worse than what the HVM guests already do. Its probably not too hard to change

the

Quoted 5 lines

QEMU impl of VNC / SDL to use the guest framebuffer directly if we did a little re-factoring. I wanted to keep it simple for now & not change any of the upstream QEMU code.

This attached patch is against the current upstream QEMU CVS code,

not

Quoted 1 line

Xen's ioemu, since I wanted to work against pristine QEMU codebase &

avoid

Quoted 1 line

any potential wierd iteractions with HVM stuff added to ioemu. The

diff is

It'll certainly be good to see the back of libvncserver.

Could you investigate whether this patch applies to qemu-dm easily enough?

Thanks,
Ian

#3 lore raw
Quoted 16 lines · Ian Pratt
Quoted 5 lines

Pushing mouse & keyboard events through from QEMU to PVFB frontend is trivial. The only bit I'm unhappy about is that QEMU can't access the guest framebuffer directly. The DisplayState * struct has its own copy of the framebuffer - allocated by the VNC or SDL impls in QEMU - and so whenever the guest framebuffer changes, we have to memcpy() the

data

Quoted 2 lines

from the guest into the QEMU framebuffer. Still, this is no worse than what the HVM guests already do. Its probably not too hard to change

the

Quoted 5 lines

QEMU impl of VNC / SDL to use the guest framebuffer directly if we did a little re-factoring. I wanted to keep it simple for now & not change any of the upstream QEMU code.

This attached patch is against the current upstream QEMU CVS code,

not

Quoted 1 line

Xen's ioemu, since I wanted to work against pristine QEMU codebase &

Quoted 8 lines

avoid

Quoted 1 line

any potential wierd iteractions with HVM stuff added to ioemu. The

diff is

It'll certainly be good to see the back of libvncserver.

Could you investigate whether this patch applies to qemu-dm easily enough?

The answer was yes & no :-) Although we've got a separate target for QEMU, there's still a bunch of stuff in the main vl.c that is specific to HVM guests - the memory map initialization basically.

The way I've approached this problem is to define two QEMU machines

  $ ./ioemu/i386-dm/qemu-dm -M ?
  Supported machines are:
  xenfv      Xen Fullyvirtualized PC (default)
  xenpv      Xen Paravirtualized PC

The little bit of HVM specific stuff from vl.c I've moved into the machine specific init function in hw/xenfv.c

As with my first prototype the hw/xenpv.c file provides a machine for Xen paravirt guests which merely talks the PVFB protocol. The only change from my previous patch is that it now does pixel swizzling if the guest display depth is not the same as the QEMU display depth.

So, in summary this does look like it'll work fairly well for PVFB. The patch attached is my latest work-in-progress

 b/tools/ioemu/hw/xenfb.c             |  822 +++++++++++++++++++++++++++++++++++
 b/tools/ioemu/hw/xenfb.h             |   35 +
 b/tools/ioemu/hw/xenfv.c             |  258 ++++++++++
 b/tools/ioemu/hw/xenpv.c             |  157 ++++++
 tools/ioemu/Makefile.target          |    6 
 tools/ioemu/target-i386-dm/helper2.c |    3 
 tools/ioemu/vl.c                     |  242 ----------
 tools/ioemu/vl.h                     |    4 
 12 files changed, 1287 insertions(+), 240 deletions(-)

Taking this idea of using QEMU for PV services a little further it occured to me that if we could figure out a way to get the bootloaders to be run from QEMU instead of XenD then we would be able to interact with pygrub remotely over the graphical VNC console - currently you can only use it over the text serial console on the local host. It might also require that we have QEMU handling the guest console directly instead of xenconsoled. ie so that QEMU could make the bootloader (pygrub) available on both VNC & a PTY at the same time. This would also mean the serial console could take advantage of QEMU's support for accessing it via UDP, or TCP, or TCP+telnet, as well as local PTYs.

Finally, I notice that ioemu/patches/qemu-dm disables the QEMU code which lets you boot a linux kernel+initrd directly, instead of using the MBR to run a bootloader. Is there any particular reason why this can't be made to work for Xen HVM guests ? The ability to boot a kenrel+initrd directly is very handy for some deployment & installation scenarios - eg to automate an anaconda installer, passing in command line args to kickstart, without needing to modify a CDROM iso, or use PXE.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
tools/ioemu/Makefile.target +3 -3
diff -r 9261686d840c tools/ioemu/Makefile.target
@@ -391,9 +391,9 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 # Hardware support
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 ifeq ($(ARCH),ia64)
-VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
-else
-VL_OBJS+= fdc.o serial.o pc.o
+VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o xenpv.o xenfv.o xenfb.o
+else
+VL_OBJS+= fdc.o serial.o pc.o xenpv.o xenfv.o xenfb.o
 endif
 VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o
 VL_OBJS+= usb-uhci.o smbus_eeprom.o
tools/ioemu/hw/xenfb.c new file +822 -0

822 lines not on this page · raw message

tools/ioemu/hw/xenfb.h new file +35 -0
diff -r 9261686d840c tools/ioemu/hw/xenfb.h
@@ -0,0 +1,35 @@
+#ifndef _XENFB_H_
+#define _XENFB_H_
+
+#include <stdbool.h>
+#include <sys/types.h>
+
+struct xenfb
+{
+	void *pixels;
+
+	int row_stride;
+	int depth;
+	int width;
+	int height;
+	int abs_pointer_wanted;
+
+	void *user_data;
+
+	void (*update)(struct xenfb *xenfb, int x, int y, int width, int height);
+};
+
+struct xenfb *xenfb_new(void);
+void xenfb_delete(struct xenfb *xenfb);
+void xenfb_teardown(struct xenfb *xenfb);
+
+int xenfb_attach_dom(struct xenfb *xenfb, int domid);
+
+int xenfb_register_events(struct xenfb *xenfb_pub);
+
+int xenfb_send_key(struct xenfb *xenfb, bool down, int keycode);
+int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y);
+int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y);
+int xenfb_send_buttons(struct xenfb *xenfb_pub, int state);
+
+#endif
tools/ioemu/hw/xenfv.c new file +258 -0

258 lines not on this page · raw message

tools/ioemu/hw/xenpv.c new file +157 -0

157 lines not on this page · raw message

tools/ioemu/target-i386-dm/helper2.c +2 -1
diff -r 9261686d840c tools/ioemu/target-i386-dm/helper2.c
@@ -622,7 +622,8 @@ int main_loop(void)
 				       cpu_single_env);
     qemu_mod_timer(buffered_io_timer, qemu_get_clock(rt_clock));
 
-    qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, env);
+    if (evtchn_fd != -1)
+      qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, env);
 
     while (!(vm_running && suspend_requested))
         /* Wait up to 10 msec. */
tools/ioemu/vl.c +6 -236

274 lines not on this page · raw message

tools/ioemu/vl.h +4 -0
diff -r 9261686d840c tools/ioemu/vl.h
@@ -1118,6 +1118,10 @@ extern void pci_piix4_acpi_init(PCIBus *
 /* pc.c */
 extern QEMUMachine pc_machine;
 extern QEMUMachine isapc_machine;
+#ifdef CONFIG_DM
+extern QEMUMachine xenfv_machine;
+extern QEMUMachine xenpv_machine;
+#endif
 extern int fd_bootchk;
 
 void ioport_set_a20(int enable);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
Quoted 41 lines · Daniel P. Berrange
Quoted 5 lines · Ian Pratt

It'll certainly be good to see the back of libvncserver.

Could you investigate whether this patch applies to qemu-dm easily enough?

The answer was yes & no :-) Although we've got a separate target for QEMU, there's still a bunch of stuff in the main vl.c that is specific to HVM guests - the memory map initialization basically.

The way I've approached this problem is to define two QEMU machines

  $ ./ioemu/i386-dm/qemu-dm -M ?
  Supported machines are:
  xenfv      Xen Fullyvirtualized PC (default)
  xenpv      Xen Paravirtualized PC

The little bit of HVM specific stuff from vl.c I've moved into the machine specific init function in hw/xenfv.c

As with my first prototype the hw/xenpv.c file provides a machine for Xen paravirt guests which merely talks the PVFB protocol. The only change from my previous patch is that it now does pixel swizzling if the guest display depth is not the same as the QEMU display depth.

So, in summary this does look like it'll work fairly well for PVFB. The patch attached is my latest work-in-progress

 b/tools/ioemu/hw/xenfb.c             |  822 +++++++++++++++++++++++++++++++++++
 b/tools/ioemu/hw/xenfb.h             |   35 +
 b/tools/ioemu/hw/xenfv.c             |  258 ++++++++++
 b/tools/ioemu/hw/xenpv.c             |  157 ++++++
 tools/ioemu/Makefile.target          |    6 
 tools/ioemu/target-i386-dm/helper2.c |    3 
 tools/ioemu/vl.c                     |  242 ----------
 tools/ioemu/vl.h                     |    4 
 12 files changed, 1287 insertions(+), 240 deletions(-)
Quoted 10 lines

Taking this idea of using QEMU for PV services a little further it occured to me that if we could figure out a way to get the bootloaders to be run from QEMU instead of XenD then we would be able to interact with pygrub remotely over the graphical VNC console - currently you can only use it over the text serial console on the local host. It might also require that we have QEMU handling the guest console directly instead of xenconsoled. ie so that QEMU could make the bootloader (pygrub) available on both VNC & a PTY at the same time. This would also mean the serial console could take advantage of QEMU's support for accessing it via UDP, or TCP, or TCP+telnet, as well as local PTYs.

Here's a further iteration of the patch which demonstrates how QEMU can provide the guest console too. I launch it with this:

qemu-dm -M xenpv -d 6 -vnc :0 -serial pty

A couple of open issues

- QEMU doesn't let us poll() on write event for its character device sinks, so in theory we could be loosing data if the pty were to give EAGAIN. I think it should be possible to address this fairly easily.

- The xenconsoled has persistent logging of guest & HV. For the latter we could just strip xenconsoled to merely provide HV logging, or even move that into XenD since its such a tiny amount of code. For guest logging QEMU can use '-serial file:/path' but then you can't use it via the pty Probably could extend QEMU command line syntax '-serial pty;file:/path' to open and PTY & log at the same time.

Those minor details aside though, this seems to work quite well - the code is only 400 lines, compared to about 1200 lines in xenconsoled.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
tools/ioemu/Makefile.target +3 -3
diff -r 9261686d840c tools/ioemu/Makefile.target
@@ -391,9 +391,9 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 # Hardware support
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 ifeq ($(ARCH),ia64)
-VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
-else
-VL_OBJS+= fdc.o serial.o pc.o
+VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o xenpv.o xenfv.o xenfb.o xencons.o
+else
+VL_OBJS+= fdc.o serial.o pc.o xenpv.o xenfv.o xenfb.o xencons.o
 endif
 VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o
 VL_OBJS+= usb-uhci.o smbus_eeprom.o
tools/ioemu/hw/xencons.c new file +409 -0

409 lines not on this page · raw message

tools/ioemu/hw/xencons.h new file +24 -0
diff -r 9261686d840c tools/ioemu/hw/xencons.h
@@ -0,0 +1,24 @@
+/*
+ *  Copyright (C) International Business Machines  Corp., 2005
+ *  Author(s): Anthony Liguori <[email protected]>
+ *
+ *  Copyright (C) Red Hat 2007
+ *
+ *  Xen Console
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ * 
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ * 
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+extern int xencons_init(int domid, CharDriverState *chr);
tools/ioemu/hw/xenfb.c new file +822 -0

822 lines not on this page · raw message

tools/ioemu/hw/xenfb.h new file +35 -0
diff -r 9261686d840c tools/ioemu/hw/xenfb.h
@@ -0,0 +1,35 @@
+#ifndef _XENFB_H_
+#define _XENFB_H_
+
+#include <stdbool.h>
+#include <sys/types.h>
+
+struct xenfb
+{
+	void *pixels;
+
+	int row_stride;
+	int depth;
+	int width;
+	int height;
+	int abs_pointer_wanted;
+
+	void *user_data;
+
+	void (*update)(struct xenfb *xenfb, int x, int y, int width, int height);
+};
+
+struct xenfb *xenfb_new(void);
+void xenfb_delete(struct xenfb *xenfb);
+void xenfb_teardown(struct xenfb *xenfb);
+
+int xenfb_attach_dom(struct xenfb *xenfb, int domid);
+
+int xenfb_register_events(struct xenfb *xenfb_pub);
+
+int xenfb_send_key(struct xenfb *xenfb, bool down, int keycode);
+int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y);
+int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y);
+int xenfb_send_buttons(struct xenfb *xenfb_pub, int state);
+
+#endif
tools/ioemu/hw/xenfv.c new file +256 -0

256 lines not on this page · raw message

tools/ioemu/hw/xenpv.c new file +184 -0

184 lines not on this page · raw message

tools/ioemu/target-i386-dm/helper2.c +2 -1
diff -r 9261686d840c tools/ioemu/target-i386-dm/helper2.c
@@ -622,7 +622,8 @@ int main_loop(void)
 				       cpu_single_env);
     qemu_mod_timer(buffered_io_timer, qemu_get_clock(rt_clock));
 
-    qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, env);
+    if (evtchn_fd != -1)
+      qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, env);
 
     while (!(vm_running && suspend_requested))
         /* Wait up to 10 msec. */
tools/ioemu/vl.c +9 -237

284 lines not on this page · raw message

tools/ioemu/vl.h +4 -0
diff -r 9261686d840c tools/ioemu/vl.h
@@ -1118,6 +1118,10 @@ extern void pci_piix4_acpi_init(PCIBus *
 /* pc.c */
 extern QEMUMachine pc_machine;
 extern QEMUMachine isapc_machine;
+#ifdef CONFIG_DM
+extern QEMUMachine xenfv_machine;
+extern QEMUMachine xenpv_machine;
+#endif
 extern int fd_bootchk;
 
 void ioport_set_a20(int enable);
tools/ioemu/xenstore.c +1 -1
diff -r 9261686d840c tools/ioemu/xenstore.c
@@ -17,7 +17,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-static struct xs_handle *xsh = NULL;
+struct xs_handle *xsh = NULL;
 static char *media_filename[MAX_DISKS + MAX_SCSI_DISKS];
 static QEMUTimer *insert_timer = NULL;
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel