On 05/12/14 22:27, Mike Maslenkin wrote: > I just wanted to point that since it is documented behavior may be a > strict requirement for CSM is enough to run W7, W2K8R2, instead of > having a bunch of code requiring a special compilation with NASM. But > anyway, idea with shim is great.
Ah, OK, I understand your intent now! Well, first, thank you so much more then. But, second, we've known for quite some time that windows server 2008 r2 works well with the SeaBIOS CSM and a few edk2 patches (thanks again to David Woodhouse and Kevin O'Connor). There are two problems with the CSM, one specific (and possibly accidental/fixable), and one generic (and inherent). - The specific (possibly accidental, fixable) problem is that using the SeaBIOS CSM plus the CSM infrastructure in edk2 breaks OVMF's S3 resume. I had not set out to track this down because of the other problem (see below). - The generic / inherent problem with the current SeaBIOS CSM + the edk2 CSM infrastructure is that the combination is a nightmare to trace, debug, and modify, for mere mortals. It switches from long mode to real mode and vice versa, and it's impossible to follow unless you know the relevant magic from the Intel SDM from memory. We did have qemu and KVM emulation problems related to those parts (emulation of PAM registers, mode switches, execution/emulation of real mode code). Again, they were a nightmare; some of them were even host hardware dependent. Only a handful of people can analyze such problems. I don't count myself among those people. (It really devolves into black box programming; even the simplest instrumentation fails you if you are naive, and I am.) In short, for my purposes, the CSM is counterproductive from a support perspective. Given that - only one wide-spread UEFI OS needs it (and only for video bios support), - that one OS emulates the code internally (rather than executing it directly on the VCPU), - and we can please that one OS (which is basically frozen code) with some very naive assembly (no mode switches etc), it's a net benefit for me to add this shim, rather than to commit to the black magic of the CSM. Developing the shim was horribly exhausting, but in the long term it promises to be much easier on me. (Without enabling the CSM in an OVMF build, the option to legacy-boot is lost of course as well, but I expressly don't desire that option. Just boot legacy OSes with pure SeaBIOS; it's easy to choose your firmware in a virtual machine.) The NASM assembly is not really meant to be recompiled, except for exceptional reasons. The output is a C header file and it is checked into source control, so you can build the tree without nasm as an end-user. (There are other nasm examples too, see eg. ResetVectorCode.asm and Build.py in OvmfPkg/ResetVector.) > >>> >>>> 2.a. "boot services code" vs. "reserved" makes no difference before >>>> ExitBootServices() -- both types protect the IVT from other boot-time >>>> allocations. >>>> >>> Here is my second note. I vote for EfiACPIMemoryNVS. >>> It is not clear and violates ACPI spec, but it is true. >>> >>> Have you tried to run W7 or W2K8 R2 in SMP mode? >> >> Sure. (Windows Server 2008 R2 SP1.) >> - Task Manager | Performance | CPU Usage History displays one chart for >> each VCPU I configure (retested now with 2 and 4 VCPUs). >> - In addition, in Computer | Properties, System | Processor is listed as >> "QEMU Virtual CPU ... (4 processors)". >> >> I'm not sure though how it is relevant. >> >>> >>>> 2.b. Windows 2008 R2 accesses the IVT regardless of the type of the >>>> memory allocation that we cover it with. It will certainly not free and >>>> then *overwrite* the page at zero (after we've covered it with "boot >>>> services code"), because then it couldn't fetch the Int10h entry from it >>>> (for emulation). >>>> >>>> IOW, OSes different from Windows 2008 R2 don't care at all, hence they >>>> shouldn't be penalized; and Windows 2008 R2 doesn't overwrite the IVT >>>> anyway (at runtime either) before fetching the Int10h entry, so we don't >>>> need to protect Win2k8r2 "from itself". >>> We need to protect Windows from itself... >>> There is a some Microsoft Hyper-V specific, that causes page 0 releasing >>> in case of SMP kernel and Hyper-V feature enabled. Windows 6.1 SMP >>> kernels do not work even in CSM mode. >> >> Ah. I see. I haven't experienced this. >> - In order to trigger it, I should probably enable some Hyper-V specific >> CPU feature on the qemu command line. I don't know what exactly (and how >> to) enable. >> - I installed the guest from >> "en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso". Maybe a >> non-debug build behaves differently. >> >> In any case: if the "SMP plus HyperV" guest configuration doesn't work >> even with the CSM enabled, then we absolutely shouldn't try to fix that >> config in our VBE shim. > Yes. But it would be the next patch. I'm not sure if QEMU support nested > Hyper-V. > > It is very interesting to hear IBVs' comments on this. There are some Hyper-V related CPU flags in qemu; "hv-relaxed", "hv-vapic", "hv-time"... Laszlo ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel