Skip to contentSkip to conversation

Qemu Guest Tools

Qemu-devel [email protected] 5 participants 11 messages Mar 1, 2005 – Mar 3, 2005

lore
Share & tools
lore
#0 lore raw

Hello,
to enable copying of text between Qemu host and guest, I've started to write some small apps called QGT (Qemu Guest Tools). A very early version is available at http://www.oliver-gerlich.de/qemu/ . Please have a look at it and tell me your opinion.

Oliver Gerlich

Signature · 2 lines
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl
#1 lore raw

There is a program out there under the GPL called "multi platform clipboard," although it's not fully transparent.

http://www.idata.sk/~robo/mpcb/

I've used this, and it works nicely. The site seems down at the moment, but there is more info here:

http://www.icewalkers.com/Linux/Software/511140/mpcb.html

Might help you along in your project.

Quoted 7 lines · On Tuesday 01 March 2005 14:07, [email protected] wrote:

Hello,
to enable copying of text between Qemu host and guest, I've started to write some small apps called QGT (Qemu Guest Tools). A very early version is available at http://www.oliver-gerlich.de/qemu/ . Please have a look at it and tell me your opinion.

Oliver Gerlich

Signature · 3 lines
Joshua Kugler
CDE System Administrator
http://distance.uaf.edu/
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Wed, Mar 02, 2005 at 12:07:44AM +0100, [email protected] wrote:

Hello,
to enable copying of text between Qemu host and guest, I've started to write some small apps called QGT (Qemu Guest Tools). A very early version is available at http://www.oliver-gerlich.de/qemu/ . Please have a look at it and tell me your opinion.

Quoted 6 lines

Oliver Gerlich

Signature · 2 lines
DSL Komplett von GMX +++ Superg?nstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl

This is promising, but I think it is badly named. This looks likes that it could, in theory, work across actual networks. There is another program which can be used to share clipboards across networks, and it can be used from within qemu. It can support multple workstations at once and it supports more OSes.

Looks good for a first version though. What other features are you planning to add?

The project shouldn't be called Qemu Guest Tools unless it requires qemu, IMHO. (Guest tools have been discussed before, some ideas for communication to qemu itself would be via 'special' qemu specific instructions or alloting an io port to give commands to qemu (this is what VMware does). Some ideas that have been proposed to use this communication for: host-guest clipboard, accelerated graphics support (such as 3d), a sort of two-way user-net (allow the host and other workstations to see the guest w/o going thru tuntap ... not sure how this would work). The list can get quite fancy.)

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
#3 lore raw
Quoted 5 lines

Some ideas that have been proposed to use this communication for:
host-guest clipboard, accelerated graphics support (such as 3d), a sort of two-way user-net (allow the host and other workstations to see the guest w/o going thru tuntap ... not sure how this would work). The list can get quite fancy.)

MS Virtual PC can do drag 'n' drop between the guest and the host. Whilst this is obviously just a "nice to have" feature, it's still pretty cool and is actually useful into the bargain ;-)

Cheers,
Mark

#4 lore raw
In reply to Jim C. Brown
Quoted 16 lines · Jim C. Brown
Quoted 6 lines · On Wed, Mar 02, 2005 at 12:07:44AM +0100, [email protected] wrote:

Hello,
to enable copying of text between Qemu host and guest, I've started to write some small apps called QGT (Qemu Guest Tools). A very early version is available at http://www.oliver-gerlich.de/qemu/ . Please have a look at it and tell me your opinion.

Quoted 6 lines

Oliver Gerlich

Signature · 2 lines
DSL Komplett von GMX +++ Superg?nstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl
Quoted 7 lines

This is promising, but I think it is badly named. This looks likes that it could, in theory, work across actual networks. There is another program which can be used to share clipboards across networks, and it can be used from within qemu. It can support multple workstations at once and it supports more OSes.

Looks good for a first version though. What other features are you planning to add?

Planned features are:
-Notification of guest when it is loaded with loadvm
-Time synchronisation between host and guest (currently guest time is wrong when loadvm is used) -drag and drop (Mark mentioned it, and it was also posted on the forum some days ago) -make mouse grabbing more comfortable

Copy/paste and time sync could be done by external programs (Joshua mentioned mpcb; ntp, ...). But drag and drop requires access to the Qemu window, and loadvm notification requires some kind of integration with Qemu. Currently it's indeed only a bad version of mpcb :) but I hope it will evolve in another direction (copy and paste being just a small part of its features).

Quoted 10 lines

The project shouldn't be called Qemu Guest Tools unless it requires qemu, IMHO. (Guest tools have been discussed before, some ideas for communication to qemu itself would be via 'special' qemu specific instructions or alloting an io port to give commands to qemu (this is what VMware does). Some ideas that have been proposed to use this communication for: host-guest clipboard, accelerated graphics support (such as 3d), a sort of two-way user-net (allow the host and other workstations to see the guest w/o going thru tuntap ... not sure how this would work). The list can get quite fancy.)

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?). TCP/IP drivers are available for many platforms, and I think if an OS doesn't support TCP/IP it doesn't really matter if copy/paste doesn't work.

Accelerated graphics would be nice indeed, but shouldn't that be done in a separate driver? Not sure if such an optional user-space application is the right place for this.

After all, QGT should just be a collection of those features that cannot be integrated into a hardware+driver (which is generally a cleaner way).

Thanks for your input,
Oliver Gerlich

#5 lore raw
Quoted 5 lines

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?). TCP/IP drivers are available for many platforms, and I think if an OS doesn't support TCP/IP it doesn't really matter if copy/paste doesn't work.

The code could always be hacked later to (optionally) use a magic IO port, as long as the base functionality is there, if anyone has an interest in doing so.

Cheers,
Mark

#6 lore raw
In reply to Oliver Gerlich
Quoted 2 lines · Oliver Gerlich

Planned features are:
-Notification of guest when it is loaded with loadvm

Why?

Quoted 2 lines

-Time synchronisation between host and guest (currently guest time is wrong when loadvm is used)

Technically this is a qemu bug and should be fixed in qemu.

Of course, any way to set the time in qemu guest w/o having to patch qemu source is welcome.

Quoted 4 lines

-drag and drop (Mark mentioned it, and it was also posted on the forum some days ago)

-make mouse grabbing more comfortable

I am against mouse grabbing myself. I just use the no-sdl-grab patch and deal with a desyncing guest mouse pointer (sometimes I can work around it by turning mouse acceleration off in the guest).

Quoted 3 lines

Copy/paste and time sync could be done by external programs (Joshua mentioned mpcb; ntp, ...).

I'm not sure if ntp would work for qemu guest. The way qemu works, guest changes to the RTC are overridden by qemu. Of course if the guest kept its own time independent of the hardware clock, that wouldn't be a problem.

Quoted 2 lines

But drag and drop requires access to the Qemu
window, and loadvm notification requires some kind of integration with Qemu.

Both of which can not be done reliably through TCP/IP. (What if the guest has no network support? Or you are running Windows 98 in safe mode?)

Futhermore, how will the guest tools know that they are really running under qemu?

Quoted 4 lines

Currently it's indeed only a bad version of mpcb :) but I hope it will evolve in another direction (copy and paste being just a small part of its features).

Agreed. That would benefit everyone.

Quoted 4 lines

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?).

Unfortuantly, yes. However, the magic instruction set would not. (You would probably need to reimplement a new one for each arch qemu supports/will be ported to though.)

Quoted 4 lines

TCP/IP drivers are available for many
platforms, and I think if an OS doesn't support TCP/IP it doesn't really matter if copy/paste doesn't work.

I disagree here (not about the copy/paste specificly, but for guest tools in general). Drag&drop would have no meaning for an OS that doesn't support a mouse, let alone a GUI, but certain things such as time sync and loadvm notification could be accessed and used universally.

Quoted 3 lines

Accelerated graphics would be nice indeed, but shouldn't that be done in a separate driver? Not sure if such an optional user-space application is the right place for this.

You are probably right about that. I was simply saying that an accelerated graphics driver for a qemu guest would need to talk to qemu directly in the same way the qemu guest tools would (send qemu little messages telling it to open an opengl window and draw this guy here, this other guy there, this gun up there, etc). On the other hand, they probably should not share the same channel, as that would be too slow.

Quoted 4 lines

After all, QGT should just be a collection of those features that cannot be integrated into a hardware+driver (which is generally a cleaner way).

Agreed.

Quoted 11 lines

Thanks for your input,
Oliver Gerlich

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
#7 lore raw
Quoted 5 lines · Oliver Gerlich
Quoted 2 lines

Planned features are:
-Notification of guest when it is loaded with loadvm

Why?

Mainly for time synchronisation, I must admit.

Quoted 5 lines
Quoted 3 lines

-Time synchronisation between host and guest (currently guest time is wrong when loadvm is used)

Technically this is a qemu bug and should be fixed in qemu.

Is it? I thought the problem was that most OSes query RTC time on startup and then keep time internally, so if they are loaded, they don't know that RTC time changed.

Quoted 15 lines

Of course, any way to set the time in qemu guest w/o having to patch qemu source is welcome.

Quoted 4 lines

-drag and drop (Mark mentioned it, and it was also posted on the forum some days ago)

-make mouse grabbing more comfortable

I am against mouse grabbing myself. I just use the no-sdl-grab patch and deal
with a desyncing guest mouse pointer (sometimes I can work around it by turning mouse acceleration off in the guest).

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

Copy/paste and time sync could be done by external programs (Joshua mentioned mpcb; ntp, ...).

I'm not sure if ntp would work for qemu guest. The way qemu works, guest changes
to the RTC are overridden by qemu. Of course if the guest kept its own time
independent of the hardware clock, that wouldn't be a problem.

Admittedly I don't know how different OSes handle this; I only know from Linux that it keeps time internally (sync between RTC and internal time can be done with hwclock), and I thought other OSes use the same technique. Of course, I silently assumed that Qemu's RTC is working correctly :) only that it doesn't help with today's OSes.

Quoted 8 lines
Quoted 3 lines

But drag and drop requires access to the Qemu
window, and loadvm notification requires some kind of integration with

Qemu.

Both of which can not be done reliably through TCP/IP. (What if the guest has no network support? Or you are running Windows 98 in safe mode?)

It can be done reliably only in the meaning that you have QGT loaded and then QGT detects that the host closed the connection and tries to reconnect five seconds later (this is already partially implemented, only the host part of course doesn't know about loadvm commands yet :)
It doesn't work out-of-the-box for all systems, that's right.

Quoted 3 lines

Futhermore, how will the guest tools know that they are really running under
qemu?

They know if they can connect to a specific port on the host. I'm more concerned about hostile (redmondian) OSes which don't like being started in Qemu and which can detect this by connecting to the host...

Quoted 9 lines
Quoted 5 lines

Currently it's indeed only a bad version of mpcb :) but I hope it will evolve in another direction (copy and paste being just a small part of its features).

Agreed. That would benefit everyone.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?).

Unfortuantly, yes. However, the magic instruction set would not. (You would
probably need to reimplement a new one for each arch qemu supports/will be ported to though.)

Yes, the issue of writing a driver for each new OS made me see TCP/IP as a quite good solution; the communication part should run on every OS which supports BSD sockets (in worked nearly unmodified in Windows), so porting is reduced to a simple userland application, without connection to external protocols etc.

Quoted 11 lines
Quoted 5 lines

TCP/IP drivers are available for many
platforms, and I think if an OS doesn't support TCP/IP it doesn't really matter if copy/paste doesn't work.

I disagree here (not about the copy/paste specificly, but for guest tools in general). Drag&drop would have no meaning for an OS that doesn't support
a mouse, let alone a GUI, but certain things such as time sync and loadvm notification could be accessed and used universally.

Yes, you're right here. I mainly concentrated on copy/paste during QGT development (which I thought would be useful for copying URLs from Linux to IE and such things), but time sync etc. could be useful also on simpler OSes like DOS.
I'll have a look at the current QGT networking API and see if it can be generalized a bit more, so that it can be replaced with another way of communication later.

Quoted 5 lines
Quoted 4 lines

Accelerated graphics would be nice indeed, but shouldn't that be done in a separate driver? Not sure if such an optional user-space application is the right place for this.

Quoted 9 lines

You are probably right about that. I was simply saying that an accelerated graphics driver for a qemu guest would need to talk to qemu directly in the
same way the qemu guest tools would (send qemu little messages telling it to
open an opengl window and draw this guy here, this other guy there, this gun
up there, etc). On the other hand, they probably should not share the same channel, as that would be too slow.

I agree, hardware accelerated games in Qemu would be really nice :) But using TCP/IP for that will probably really be too slow... Maybe if one could write a graphics driver which (as a first start) would tell the guest it supports OpenGL, and which then simply passes all OpenGL calls to the host (and the guest OpenGL window is then just some other window on top of Qemu's SDL window)... But I'll better leave working wonders to Fabrice and concentrate on the tasks I've already started :)

Quoted 14 lines
Quoted 5 lines

After all, QGT should just be a collection of those features that cannot be integrated into a hardware+driver (which is generally a cleaner way).

Agreed.

Quoted 6 lines

Thanks for your input,
Oliver Gerlich

Quoted 16 lines
Quoted 5 lines

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 8 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.


_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

It's good to hear some other ideas and opinions about what's important.

Oliver Gerlich

PS: nearly forgot to mention that there were "technical problems" with my webspace... I've moved QGT to http://wolfpackally.wo.funpic.de/qemu/qgt/ , if you couldn't download it before, it should work now.

Signature · 2 lines
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl
#8 lore raw
Quoted 11 lines · On Wed, Mar 02, 2005 at 10:08:54PM +0100, [email protected] wrote:
Quoted 5 lines

I'm not sure if ntp would work for qemu guest. The way qemu works, guest changes
to the RTC are overridden by qemu. Of course if the guest kept its own time
independent of the hardware clock, that wouldn't be a problem.

Admittedly I don't know how different OSes handle this; I only know from Linux that it keeps time internally (sync between RTC and internal time can be done with hwclock), and I thought other OSes use the same technique. Of course, I silently assumed that Qemu's RTC is working correctly :) only that it doesn't help with today's OSes.

I must eat my own words.

Last I checked, it was not possible to set the time in the guest (this was with Windows 98SE). The clock would switch back immediately. Testing with linux guest and modern qemu, this seems to have changed. Using hwclock, one can change the time of the RTC.

So you can use ntp as a time keeper for the guest after all.

Quoted 10 lines
Quoted 5 lines
Quoted 3 lines

-Time synchronisation between host and guest (currently guest time is wrong when loadvm is used)

Technically this is a qemu bug and should be fixed in qemu.

Is it? I thought the problem was that most OSes query RTC time on startup and then keep time internally, so if they are loaded, they don't know that RTC time changed.

The bug being that qemu didn't update the RTC properly on a loadvm. Since there was no way for the guest OS to change the time, qemu had to get it right unconditionally.

However, if you can set it directly, then this would be a good use. You'd want this as a continuous background process (daemon in Unix/Linux, TSR in DOS) to make this update automatic.

Quoted 8 lines
Quoted 3 lines

Futhermore, how will the guest tools know that they are really running under
qemu?

They know if they can connect to a specific port on the host. I'm more concerned about hostile (redmondian) OSes which don't like being started in Qemu and which can detect this by connecting to the host...

How do you know that port is being used by qemu, and not by e.g. some custom http server?

One interesting side effect is that one could install the guest tools on a real workstation and set up a fake server that responds to qemu guest commands. I'm not sure if you want to allow this to be possible. (I also don't see why anyone would bother with it ... but since the guest tools interact with the guest on such a low level, who knows what they could be used for?)

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?).

Unfortuantly, yes. However, the magic instruction set would not. (You would
probably need to reimplement a new one for each arch qemu supports/will be ported to though.)

Quoted 5 lines

Yes, the issue of writing a driver for each new OS made me see TCP/IP as a quite good solution; the communication part should run on every OS which supports BSD sockets (in worked nearly unmodified in Windows), so porting is reduced to a simple userland application, without connection to external protocols etc.

The magic instruction set has the same advantages, plus it doesn't require TCP/IP. Of course it can always be added later.

The real issue I have with using TCP/IP is that one can trick a qemu guest into thinking its host is this other computer, or even trick the guest tools when they are running on actual hardware.

Quoted 6 lines
Quoted 5 lines

I disagree here (not about the copy/paste specificly, but for guest tools in general). Drag&drop would have no meaning for an OS that doesn't support
a mouse, let alone a GUI, but certain things such as time sync and loadvm notification could be accessed and used universally.

Quoted 8 lines

Yes, you're right here. I mainly concentrated on copy/paste during QGT development (which I thought would be useful for copying URLs from Linux to IE and such things), but time sync etc. could be useful also on simpler OSes like DOS.
I'll have a look at the current QGT networking API and see if it can be generalized a bit more, so that it can be replaced with another way of communication later.

Now that I think of it, using TCP/IP to flesh out a suitable API/list of guest commands (i.e. the qemu<->guest communication protocol semantics) and then moving it over to use a more precise/reliable method of communication (such as a qemu-specific io port) is probably a good idea. Might make development go significantly faster.

A combination of methods may be best.

Quoted 2 lines

I agree, hardware accelerated games in Qemu would be really nice :) But using TCP/IP for that will probably really be too slow...

I didn't suggest that! Honest!

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
#9 lore raw
In reply to Jim C. Brown
Quoted 9 lines · Jim C. Brown
Quoted 2 lines · Oliver Gerlich

Planned features are:
-Notification of guest when it is loaded with loadvm

Why?

Quoted 8 lines
Quoted 2 lines

-Time synchronisation between host and guest (currently guest time is wrong when loadvm is used)

Technically this is a qemu bug and should be fixed in qemu.

Of course, any way to set the time in qemu guest w/o having to patch qemu source is welcome.

I run an ntp client inside windows.

Quoted 4 lines

I am against mouse grabbing myself. I just use the no-sdl-grab patch and deal with a desyncing guest mouse pointer (sometimes I can work around it by turning mouse acceleration off in the guest).

I was thinking about a little guest app to keep them in sync. This is how win4lin does it and it works very well. It is dead easy to do under windows as mouse manipulation from userspace is a doddle, don't know about linux though.

Quoted 6 lines
Quoted 1 line

Copy/paste and time sync could be done by external programs (Joshua mentioned mpcb; ntp, ...).

I'm not sure if ntp would work for qemu guest. The way qemu works, guest changes to the RTC are overridden by qemu. Of course if the guest kept its own time independent of the hardware clock, that wouldn't be a problem.

It does. I use anachron for windows.

Quoted 8 lines
Quoted 2 lines

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?).

Unfortuantly, yes. However, the magic instruction set would not. (You would probably need to reimplement a new one for each arch qemu supports/will be ported to though.)

This was my thought. Networking is not always available. A couple of IO ports would always be there.

Regards,
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#10 lore raw
Quoted 7 lines · Brad Campbell
Quoted 5 lines · Jim C. Brown

I am against mouse grabbing myself. I just use the no-sdl-grab patch and deal
with a desyncing guest mouse pointer (sometimes I can work around it by turning mouse acceleration off in the guest).

Quoted 5 lines

I was thinking about a little guest app to keep them in sync. This is how win4lin does it and it works very well. It is dead easy to do under windows as mouse manipulation from userspace is a doddle, don't know about linux though.

Does it move the guest pointer back to the spot where the host pointer is (in which case disabling mouse accerleration would be better) or does it let win4lin know where the guest pointer is so the host pointer can be moved to that position?

The latter would be ideal, but short of guest-to-host communication there is no way to be completely sure where the mouse pointer is (tho you can be pretty sure most of the time).

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

I've decided against some special i/o port or such because I don't know anything about these things :) and because it would require a driver on the guest side (is that correct?).

Quoted 7 lines
Quoted 4 lines

Unfortuantly, yes. However, the magic instruction set would not. (You would probably need to reimplement a new one for each arch qemu supports/will be ported to though.)

This was my thought. Networking is not always available. A couple of IO ports would always be there.

Actually, I think that magic instructions might be better. It doesn't require a special guest driver and thus it would be easier to develop the tools. IO ports would be easier to standardize however.

Detecting whether or not they're running in qemu is also a cinch: if they aren't they get an "illegal instruction" error.

Quoted 14 lines

Regards,
Brad

Signature · 9 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams


_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.