I'm trying to get Windows 7 (64-bit) to run under KVM. The installation was successful, and it even booted successfully off the hard drive to finish the installation, but when I attempt to boot now, I get the following error:

Code:

KVM: entry failed, hardware error 0x80000021

If you're running a guest on an Intel machine without unrestricted mode
support, the failure can be most likely due to the guest entering an invalid
state for Intel VT. For example, the guest maybe running in big real mode
which is not supported on less recent Intel processors.

So it would seem that Windows is trying to enable protected mode (apparently we're 32-bit at this point), and for some reason KVM doesn't like it? That doesn't make a great deal of sense.

Is it the case that qemu-kvm doesn't support 64-bit guests? That would be ridiculous, so I'm assuming that isn't true... I've tried passing several different -machine and -cpu options to qemu-kvm, and none seem to make it happy.

I'd also be curious to see what parameters you're using to start this machine

I have a Win7Ultimate x64 guest that, while I rarely use it, it does work - a bit sluggish, but it works, so I can confirm that at least. The only real hiccup I hit was having to initially boot with IDE HDD emulation, install the virtio drivers for the HDD, add a disk, etc etc - PITA but it eventually worked._________________Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash

I'd also be curious to see what parameters you're using to start this machine

I've just been running "qemu-kvm -hda win7.img -m 2048". I've tried different "-cpu" and "-machine" options to no avail.
I found a suggestion on linux-kvm.org to do a "system recovery" with the windows installation CD. I'm trying that right now.

I've tried reinstalling a couple times with different "-cpu" options, but it seems to make no difference. The recovery mode on the Windows installation CD says "The version of Windows installed is unsupported", and refuses to do anything. I used ms-sys to write new bootsectors, but that also made no difference.

I'm starting to think this is a problem with the way my hardware interacts with KVM. I used to run WIn7-64bit in VirtualBox on this same machine, so I know its capable of doing it. I just wanted to use the in-tree solution instead, plus I don't want to use modules in my kernels.

I'm going to try this on another machine and see if it works. Maybe it's a bug in KVM?

I tried it on the desktop, and it works: Windows 7 64-bit using the same installation CD. (My desktop is an AMD 8-core Bulldozer, also running Gentoo; the laptop I'm having the issues on is a Core2 duo).

(substituting "-cpu core2duo" on the laptop. The image is "raw", created with qemu-img.)

I would believe the error message's suggestion about the CPU being too old to support VT-d for some weird mode Windows is going into, but from the assembly it looks like it's just entering 32-bit protected mode without paging (0xfe in cr0), which seems completely normal for an OS during its boot process... Plus, I used to run Windows 7 64-bit in virtualbox on this same machine.

If you're running a guest on an Intel machine without unrestricted mode
support, the failure can be most likely due to the guest entering an invalid
state for Intel VT. For example, the guest maybe running in big real mode
which is not supported on less recent Intel processors.

It bails at 0x14, and that really looks like we're screwed. What the instruction before does is setting the bit 0 (value 1) of %cr0 to 0. This is the PE bit (protection enable) and it tells you if the system is running in real or protected mode. From the registers (ESI=0025da4a) it looks like the system was in protected more (PE=1) before execution of the mov %eax, %cr0 (because %esi > 0xffff). The move then tries to switch back to real mode (possibly in an attempt to enter big real mode briefly before firing up the operating system properly in protected mode).

So it really may be that our CPUs are too old and Intel-VT at that time did not support switching back to real mode yet :-( I'll try on my laptop later today (Intel I5), which should definitely support it and see if it works there. If so, we're screwed and need to buy new PCs. Damnit.

OK, I'm now pretty certain that we're screwed and cannot use kvm to emulate Windows 7. Here's the timelime of what I've done to come to this conclusion:

1. First I was looking at my BIOS and found it curious that there was no mention of VT. Looked at the net, found an update. Updated the BIOS -- aha -- now there's a VT option. Enabled by default. Tried it again, same error.

I tried it on the desktop, and it works: Windows 7 64-bit using the same installation CD. (My desktop is an AMD 8-core Bulldozer, also running Gentoo; the laptop I'm having the issues on is a Core2 duo).

I am using kvm-qemu 1.0 with a core i5; I got windows 7 to work almost straight away, with some messing with drivers for the 'hard disks'; it required the latest from redhat virtio.
Glad you got some help from Avi and the guys, they just seem to have no time for most problems.

I am using 7 x64 embedded actually, but I would be grateful for any experience you have of using audio on a virtual 7 x64 through your i5 setup.

We actually have DQ67OW boards from intel, and I am not at all sure that the hda support works with 64 bit; messages range from hardware not detected to drivers missing or corrupted(Error code 39 in microsoft money). Incidentally, for what it's worth, we use a 2.38.8 host kernel. Host sound works perfectly.

The problem was solved by Avi Kivity on the qemu-kvm mailing list. There were some kernel bugfixes that he did and the resulting kernel commit cf3d9372065470403e0780599ca612553211a10b on

Code:

git://git.kernel.org/pub/scm/virt/kvm/kvm.git big-real-mode

Works for me perfectly! Awesome

Hi~ I have recently running into the same problem with my C2D Q6600 with exactly the same error message during the system boot up. I have read the post which Avi mentioned there would be a patch on this. May I ask if this means a newer version of kvm in Gentoo? As the stable version which I used still having this problem.

Could anyone share with me the instruction that I can get my Q6600 to boot successfully into Win7?

Sorry if the qemu-kvm mailing list mentioned it already, as I am very new to this kvm and may not able to pick it up even it had been mentioned.