quickemu-project / quickemu

Quickly create and run optimised Windows, macOS and Linux virtual machines
MIT License
10.63k stars 463 forks source link

bug: macos sonoma hang during startup #1114

Closed ctamietto closed 5 months ago

ctamietto commented 5 months ago

I have installed quickget cloning from github

I downloaded sonoma with quickget with the command quickget macos sonoma see the video https://youtu.be/07JLZCy5zlo

then I installed sonoma with the command quickemu --vm macos-sonoma.conf see the vidoes of the begin of installation end the end start : https://youtu.be/MpbozxjQACw end : https://youtu.be/Z5H0FT6Karo

it seem to me that almost at the end of the installation ( second startup ) the vm rebooted
so probably the installation in not complete ( you can view that in https://youtu.be/Z5H0FT6Karo )

when I try to boot i get a blank screen ( after i have chosen the disk of installation ) and after sometime it restart
see the video https://youtu.be/MpbozxjQACw

my system is fedora 39

immagine

the log is void

immagine

what can i check ? P.S: i have tried do install also big-sur monterey ventura with the same result

only the installation of catalina is working ( but is too old for what i have to do )

thank you for any response

TuxVinyards commented 5 months ago

It will do that. There's a some stuff about it in the qqX wiki. And a link to walk through for Ventura. Pretty much the same ...

ctamietto commented 5 months ago

i have read and applied the suggestions of this thread

https://github.com/quickemu-project/quickemu/issues/937

but nothing changed

in this thread you talk about

"The Ventura VM that I had was built using the new, under-development, version."

is this new version already present in quickemu 4.9.3 ( i'm using that ) o is to be released in the future ?

Anyway thanks for your help

TuxVinyards commented 5 months ago

Ciao Claudio.

I have two installs of Sonoma already. You need patience to install them but my memory is that they were much the same as with Ventura.

I was running a VM of Fedora 40 last night and tried to install Sonoma on that. It threw up complaints about graphics memory, so I just put that down to it being a VM. You can normally 'telescope' VM's though. ie install machines inside other machines. It's normally not a problem.

I have just tried installing Sonoma, again, a third copy, on my main machine. I use Ubuntu Mate on that one. It didn't work as well as I had expected. Didn't get the graphics memory error though. Something to do with virtio on that one probably.

I am starting to question the Mac distro which is getting downloaded. It doesn't have the 'installer' icon like you can see in the screenshots in #937 and as mentioned in the Quickemu instructions. I initially put this down to an Apple renaming exercise, but I am not sure that this is entirely the case.

I also tried starting Sonoma from the command line, by copying quickemu out of the 'freebird' builtins to the VM folder and using ./quickemu -vm macos-sonoma.conf but got the same results. Note the dot at the front ...

At this point in time, FreeBird is identical to the current Quickemu 'master' and it runs my two previously installed Sonama distros without fault.

@lj3954 did 95% of the work on adding in Sonoma. I am wondering if he might have some ideas?

ctamietto commented 5 months ago

Ciao Alex , do you think that changing distro ( for example using ubuntu 22.04 ) the installation of mac os vm can work ? i have found this video on you tube https://www.youtube.com/watch?v=wykyreQxVV8 where you can see a succesfull installation of ventura using a linux mint host ( i think based on ubuntu 22.04 ) using https://github.com/kholia/OSX-KVM ( quickemu use OVMF firmware from that project ) i'm guessing to install ubuntu 22.04 on a host and try to create the mac os vm on that system what do you think about ?

TuxVinyards commented 5 months ago

Might be worth trying an install of Ventura. See what happens there. Might give us some clues.

TuxVinyards commented 5 months ago

I think this is distro. The Ventura front end has changed as well.

ventura-has-changed

This how it used to look:

old-ventura-front-end

lj3954 commented 5 months ago

@lj3954 did 95% of the work on adding in Sonoma. I am wondering if he might have some ideas?

I did very little work inside quickemu. I added sonoma to a couple of switch cases and blocked macOS guests from using some core counts they just won't boot with. Ventura and Sonoma should be identical in nearly every way. Have you been able to install a macOS guest after you modified the CPU argument?

I am starting to question the Mac distro which is getting downloaded.

The image is downloaded in exactly the same way that macrecovery does it, and as far as I can tell, exactly the same way an Apple computer would. Also, the image is verified using a chunklist file which also contains Apple's EFI key. There is no doubt in my mind that the image is legitimate.

I'll check this out tonight. I haven't done much testing with macOS in quickemu since I finished my PR on it.

TuxVinyards commented 5 months ago

I'll check this out tonight. I haven't done much testing with macOS in quickemu since I finished my PR on it.

Appreciated :+1:

lj3954 commented 5 months ago

I can't get the (sonoma) installer to even boot with your new CPU arg, nor can I get my preexisting VM to boot. Ventura kernel panics with it. Whether it works correctly on Intel CPUs or not doesn't matter, silencing a couple of irrelevant errors in the console is not worth whatever regression this has caused.

After reverting the CPU to Haswell, the installation was painless. I just selected the 2nd option "macOS base system" on the first boot, and the 3rd option on reboots. It was quite surprising to me how painless it was.

This doesn't solve the issue, though, since macOS releases prior to Ventura will use the Penryn CPU instead. I'm currently downloading Monterey to test whether this works.

lj3954 commented 5 months ago

@ctamietto Please provide the output of lscpu. It appears to me that macOS guests work very differently depending on the host's CPU, more data points would be helpful.

lj3954 commented 5 months ago

I completed the install of macOS Monterey with no changes to the CPU. Once again, there was no issues. Different systems clearly have very different outcomes, much more data is needed to find a solution.

TuxVinyards commented 5 months ago

After reverting the CPU to Haswell, the installation was painless

I had wondered whether the Haswell line was actually correct when it added sse_4.2 ?

The original code only grepped for 4.1 and the notes in the code said 4.1.

What happens if you change the new CPU line to 4.2 on your Ryzens?

For me, on Intel, Sonoma runs faultlessly.

lj3954 commented 5 months ago

No dice. That emulated broadwell CPU just doesn't work here

cyrileek commented 5 months ago

I tried to install ventura and sonoma en Debian Trixie. It hang or reboot and go back to the "EFI" and "macOS Base System" menu. I used to have the ventura working on this Debian with the quickemu previous version. I agree to the fact that the installation process is not the same as the startup menu is different.

TuxVinyards commented 5 months ago

No dice. That emulated broadwell CPU just doesn't work here

So, I just changed the new CPU instruction to 4.2 and it all works, for me.

And the old one. But it's plain wrong to grep for one thing and to add another.

The question now is how do fix the CPU line so that it works for everyone, Ryzen or Intel.

TuxVinyards commented 5 months ago

@lj3954 Try this hybrid line. The old one with Haswell but tidied up.

CPU="-cpu Haswell-noTSX-IBRS,kvm=on,vendor=GenuineIntel,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc"

lj3954 commented 5 months ago

That works for me.

TuxVinyards commented 5 months ago

Yay. I'll push that to a PR, if that's okay. :partying_face:

ctamietto commented 5 months ago

this is the output requested

I have tried again to install big-sur monterey ventura sonoma but nothing works

something is changed , practically all the images hang on first boot ( after selecting the base system )

immagine

TuxVinyards commented 5 months ago

@ctamietto try qqX 1.8.03 that I have just posted :crossed_fingers:

From the main https://github.com/TuxVinyards/qqX/archive/refs/heads/main.zip

flexiondotorg commented 5 months ago

Fixed via https://github.com/quickemu-project/quickemu/pull/1119

TuxVinyards commented 5 months ago

1.8.04

https://github.com/TuxVinyards/qqX/releases/tag/1.8.04

ctamietto commented 5 months ago

sorry , i have updated quickemu and qqx but nothing changed I tried to install sonoma but the mouse does not worked so I tried to install Ventura At the second boot after the installation I get a blank screen After about 5 minutes it reboots

very sorry it does not work I think that is related to my hardware

ctamietto commented 5 months ago

I've tried to install also monterey and hang on first boot and big-sur that hang on second boot

lj3954 commented 5 months ago

Fixed via #1119

https://github.com/quickemu-project/quickemu/pull/1116#issuecomment-2080411849

This issue is not resolved, that PR solves a separate issue (specifically macOS guests not booting on AMD hosts). Please re-open this.

TuxVinyards commented 5 months ago

sorry , i have updated quickemu and qqx but nothing changed I tried to install sonoma but the mouse does not worked so I tried to install Ventura At the second boot after the installation I get a blank screen After about 5 minutes it reboots

very sorry it does not work I think that is related to my hardware

Try this in the .conf file:

mouse="virtio"
keyboard="usb"

This works better with Ventura and Sonoma.

Run the qqX " [tune] " option which will help advise you.

Some people have said that usb_controller="xhci" it works for them . But as this was added to the code a few weeks ago as #981 via #986 I can't see it doing anything. I did try it, to see what it did. For me, it left me completely without mouse and keyboard ....

TuxVinyards commented 5 months ago

I've tried to install also monterey and hang on first boot and big-sur that hang on second boot

@ctamietto Can you supply a few more details please.

It is normal for installs to hang for several periods of time when doing the the install. You also may find yourself having to re-boot up to 3 or 4 times too. A bit of patience is needed.

https://github.com/TuxVinyards/qqX/wiki/FAQs-and-Help#macos-hangs-when-running-the-setup

TuxVinyards commented 5 months ago

Fixed via #1119

#1116 (comment)

This issue is not resolved, that PR solves a separate issue (specifically macOS guests not booting on AMD hosts). Please re-open this.

@lj3954 these changes were put out for testing for several days before merging. No one found any problems.

You tested these PR's on your Ryzens didn't you? I seem to remember you have an older Ryzen notebook amongst your computer collection as well ...

I would like to see the Quickemu conf generator doing a bit of tuning to the mouse and keyboard. There's room for improvement in that area.

ctamietto commented 5 months ago

i've tried to install sonoma again adding manually

mouse="virtio" keyboard="usb"

to the conf file

then i've tried also qqx tune

so I get this config file

!/usr/bin/qqX --vm

disk_size="128G" cpu_cores="22" ram="10G"

guest_os="macos" disk_img="macos-sonoma/disk.qcow2" img="macos-sonoma/RecoveryImage.img" macos_release="sonoma" mouse="virtio" keyboard="usb"

but nothing changed , the mouse does not work

I've uploaded to you tube a short video to show what I have done

https://youtu.be/pUuZsgVnl94

I've tried also usb_controller="xhci" but nothing changed

TuxVinyards commented 5 months ago

@ctamietto This isn't your .conf. Your video shows you going to dvd player type icons. This is a problem with the CPU line.

There are a few ways to solve this but the recent changes have no major factor that I can see. You are booting off exactly the same formula that was used before. The only change is adding is here. -cpu Haswell-noTSX-IBRS with the addition of -noTSX-IBRS.

Hopefully I can ask you for a little more patience and to try a few things. There are several ways to try to solve this and one of these should work.

Your lscpu output shows you are using an Intel CPU. An i7 1280P.

We can try changing the CPU line to plain -cpu Haswell Take off the noTSX This will probably generate warning errors but at least we will have eliminated this as a factor.

The other thing is to use -cpu host which will mean using all the features that your CPU can offer.

You have tested your set up working with Linux VM's at this point, so this should be okay.

We need to edit the quickemu file, where it says -cpu Haswell-noTSX-IBRS. You can edit this in the qqX downloads folder. Use the current "FreeSpirit" folder, which is currently the same as "FreeBird". Then either run the qqX installer to do a re-install followed by selecting "FreeSpirit" from the settings. Or copy the folder and make a Custom set-up. Instructions for that are at the end of the settings folder. It's easier than it sounds ...

Have a zoom in look at this screenshot which shows Sonoma working on my series 11 intel using the -cpu host formula which I simply copied over from a bit further down, where the Windows CPU line is.

If neither of these two work, return back to the old formula and retry but removing and replacing the instruction set lines, one by one, to see which instruction is causing the problem. Comparing the CPU instruction against your lscpu flags output will shorten this task.

You could also try copying the Penryn formula, the one with *) For that you will need to add in +avx2 and to change the +sse4.1 to +sse4.2.

cpu-host

lj3954 commented 5 months ago

Fixed via #1119

#1116 (comment) This issue is not resolved, that PR solves a separate issue (specifically macOS guests not booting on AMD hosts). Please re-open this.

@lj3954 these changes were put out for testing for several days before merging. No one found any problems.

You tested these PR's on your Ryzens didn't you? I seem to remember you have an older Ryzen notebook amongst your computer collection as well ...

I would like to see the Quickemu conf generator doing a bit of tuning to the mouse and keyboard. There's room for improvement in that area.

I didn't tell you that your PR caused any issue. It just did not fix this one, this is likely an unrelated issue and likely has to do with this specific user's hardware. You seem to consistently misunderstand what I've said regarding this.

ctamietto commented 5 months ago

I made a first attempt

1) git pull of quickemu to get the latest release

2) modified quickemu script as you suggestion @TuxVinyards

see the picture below :

image

3) quickget macos ventura

4) quickemu --vm macos-ventura.conf

nothing changed , at the second boot the system hang on a blank screen for about 5 minutes and then the system crash at this point I get the boot screen again , try again to boot and after 5 minutes the system crash again

I don't know why and I don't know what to check

so next step I'll try to install ventura using qqX

TuxVinyards commented 5 months ago

@ctamietto you may find qqX's [rtv] utility useful.

MacOS seems to record things in the Tiano Core components. This includes when it has decided that it doesn't like the look of the machine that it's meant to be installing on.

The 'rtv' utility Refreshes the Tiano Variables.

TuxVinyards commented 5 months ago

@ctamietto something else that I just spotted was that lscpu is reporting your CPU as vulnerable and missing microcode

This is what I have, for me:

lscpu | grep -i microcode
Vulnerability Gather data sampling: Mitigation; Microcode

Probably should be sorted, even if this is not the cause. Is a firmware update needed?

TuxVinyards commented 5 months ago

@lj3954 @flexiondotorg et al

The CPU line that we are using has +invtsc which is there from time back, as in the original.

If I run lscpu | grep -i inv I get invpcid and invpcid_single the same as @ctamietto does.

Wondering what that is about ....

ctamietto commented 5 months ago

finally i managed to install sonoma and ventura on my pc ( MSI intel i7 ) and os fedora 39

i have modified quickemu as you can see in the image

image

I hope that what I've done is correct and can help other people with the same problem

TuxVinyards commented 5 months ago

I've been testing FULL installs over the last few days. Not just "does the installer boot".

I've been finding delays of over an hour at the 'just a minute' point.

flexiondotorg commented 5 months ago

This issue needs re-titling or something. I can not reproduce this error, I've installed several macOS releases without issue.

I think what is required here is quickemu to detect when the host hardware is not capable of running macOS and fails with a clear indication to the user.

flexiondotorg commented 5 months ago

finally i managed to install sonoma and ventura on my pc ( MSI intel i7 ) and os fedora 39

I'll test your changes on Ryzen a bit later

TuxVinyards commented 5 months ago

This issue needs re-titling or something. I can not reproduce this error, I've installed several macOS releases without issue.

I think what is required here is quickemu to detect when the host hardware is not capable of running macOS and fails with a clear indication to the user.

I have been working on exactly that. I have quite a bit of further research too.

Bear with me and I will PR something before long.

what is required here is quickemu to detect when the host hardware

Does that exactly. But I want to test really thoroughly ....

TuxVinyards commented 5 months ago

Work so far:

    macos)
        # https://www.nicksherlock.com/2020/04/installing-macos-catalina-on-proxmox-with-opencore/
        # https://www.nicksherlock.com/2022/10/installing-macos-13-ventura-on-proxmox/
        # Penryn  https://github.com/search?q=repo%3Akholia%2FOSX-KVM%20%20GenuineIntel&type=code
        # https://en.wikipedia.org/wiki/MacOS_version_history#Releases
        # quickget current list: high-sierra mojave catalina big-sur monterey ventura sonoma
        # A CPU with SSE4.1 support is required for >= macOS Sierra
        # A CPU with SSE4.2 support is required for >= macOS Catalina
        # A CPU with AVX2 support is required for >= macOS Ventura
        case ${macos_release} in
        ventura|sonoma)
            if check_cpu_flag sse4_2 && check_cpu_flag avx2; then
                # noTSX stops cpuid errors https://duckduckgo.com/?t=ffab&q=CPUID.07H%3AEBX.rtm+%5Bbit+11%5D&ia=web also cited by NickSherlock for Ventura install
                #CPU="-cpu Haswell-noTSX-IBRS,kvm=on,vendor=GenuineIntel,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc"
                # https://www.techpowerup.com/cpu-specs/?mfgr=Intel&codename=Haswell&sort=name
                # https://www.techpowerup.com/cpu-specs/core-i7-4790k.c1761
                if [[ $MAC_CPU == "skylake1" ]]; then CPU="-cpu Skylake-Server-v1,kvm=on,vendor=GenuineIntel,+avx,+avx2,+sse,+sse2,+sse3,+sse4.2" 
                elif [[ $MAC_CPU == "skylake5" ]]; then CPU="-cpu Skylake-Server-v5,kvm=on,vendor=GenuineIntel,+avx,+avx2,+sse,+sse2,+sse3,+sse4.2" 
                elif [[ $MAC_CPU == "haswell5" ]]; then CPU="-cpu Haswell-v5,kvm=on,vendor=GenuineIntel,+avx,+avx2,+sse,+sse2,+sse3,+sse4.2" 
                else CPU="-cpu Haswell-v1,kvm=on,vendor=GenuineIntel,+avx,+avx2,+sse,+sse2,+sse3,+sse4.2" 
                fi
                # https://www.techpowerup.com/cpu-specs/xeon-w-2140b.c2953  8 cores 16 threads # skylake server
                # https://en.wikipedia.org/wiki/IMac_Pro#Technical_specifications Orig: High Sierra  Max: Sonoma
                # https://en.wikipedia.org/wiki/MacOS#Hardware_compatibility needs 8GB RAM
                # https://qemu.readthedocs.io/en/v9.0.0/system/qemu-cpu-models.html#important-cpu-features-for-amd-x86-hosts
                # https://www.reddit.com/r/hackintosh/comments/141wnjk/state_of_macos_14_sonoma_on_x86/
                # qemu-system-x86_64 -cpu help | grep pdpe1gb etc
                if check_cpu_flag pdpe1gb ; then CPU+=",+pdpe1gb" ; fi
                if check_cpu_flag amd-ssbd ; then CPU+=",+amd-ssbd" ; fi
                if check_cpu_flag mmx ; then CPU+=",+mmx" ; fi
                if check_cpu_flag eist ; then CPU+=",+eist" ; fi
                if check_cpu_flag aes ; then CPU+=",+aes" ; fi
                if check_cpu_flag vaes ; then CPU+=",+vaes" ; fi
                if check_cpu_flag fma ; then CPU+=",+fma" ; fi
                if check_cpu_flag f16c ; then CPU+=",+f16c" ; fi
                if check_cpu_flag abm ; then CPU+=",+abm" ; fi
                if check_cpu_flag adx ; then CPU+=",+adx" ; fi
                if check_cpu_flag bmi1 ; then CPU+=",+bmi1" ; fi
                if check_cpu_flag bmi2 ; then CPU+=",+bmi2" ; fi
                if check_cpu_flag vbmi2 ; then CPU+=",+vbmi2" ; fi
                if check_cpu_flag vpclmulqdq ; then CPU+=",+vpclmulqdq" ; fi
                if check_cpu_flag mpx ; then CPU+=",+mpx" ; fi
                if check_cpu_flag smep ; then CPU+=",+smep" ; fi
                if check_cpu_flag cx8 ; then CPU+=",+cx8" ; fi
                if check_cpu_flag xsave ; then CPU+=",+xsave" ; fi
                if check_cpu_flag xsaveopt ; then CPU+=",+xsaveopt" ; fi
                if check_cpu_flag xgetbv1 ; then CPU+=",+xgetbv1" ; fi
                if check_cpu_flag movbe ; then CPU+=",+movbe" ; fi
                if check_cpu_flag ept ; then CPU+=",+vmx-ept" ; fi
                if check_cpu_flag invtsc ; then CPU+=",+invtsc" ; fi
            else
                echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 and AVX2 support."
                exit 1
            fi
            ;;
        -usb-controller|--usb-controller)
            USB_CONTROLLER="${2}"
            shift;
            shift;;
        -mac-cpu|--mac-cpu)
            if [[ $2 == "skylake"* || $2 == "haswell"* ]]; then 
                MAC_CPU="${2}" ; shift
            fi
            shift;;
        -extra_args|--extra_args)
            EXTRA_ARGS="${2}"
            shift;
            shift;;

I am going to be to be away for a couple of days, so posting work so far here.

I built Sonoma today using haswell1 but then launched and set it up as skylake5.

I think waiting the time at 'finished in a minute' is the key. I still want to test as skylake5 but wait longer.

Have a play.

flexiondotorg commented 5 months ago

@TuxVinyards Thanks! I'll submit (and likely merge) a pull request that incorporates a some of what you've shared here.

Although this particular issue will be closed by that PR, I do appreciate your work in this area and welcome any improvements you might propose in the future.

flexiondotorg commented 5 months ago

Prior to the commit above, I could reproduce the very long "just a minute" during the install, but following the change above I've successfully installed Mojave, Catalina, Big Sur, Monterey, Ventura and Sonoma without any undue delays.

I've removed High Sierra because the recovery servers are no longer available for that release and therefore it can't be installed.

TuxVinyards commented 5 months ago

SUCCESS :partying_face:

            case ${macos_release} in
                ventura|sonoma)
                    if check_cpu_flag sse4_2 && check_cpu_flag avx2; then
                        CPU="-cpu Haswell-v2,kvm=on,vendor=GenuineIntel,+avx,+avx2,+sse,+sse2,+ssse3,+sse4.1,+sse4.2,+rdtscp"
                        #CPU="-cpu Skylake-Server-v3,kvm=on,vendor=GenuineIntel,+avx,+avx2,+sse,+sse2,+ssse3,+sse4.1,+sse4.2,+rdtscp"
                        #if check_cpu_flag pdpe1gb ; then CPU+=",+pdpe1gb" ; fi
                        #if check_cpu_flag smap ; then CPU+=",+smap" ; fi
                        #if check_cpu_flag clwb ; then CPU+=",+clwb" ; fi
                        #if check_cpu_flag adx ; then CPU+=",+adx" ; fi
                    else
                        echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 and AVX2 support."
                        exit 1
                    fi ;;
                catalina|big-sur|monterey)
                    if check_cpu_flag sse4_2; then
                        CPU="-cpu Haswell-v2,kvm=on,vendor=GenuineIntel,+avx,+sse,+sse2,+ssse3,+sse4.1,+sse4.2,+rdtscp"
                    else
                        echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 support."
                        exit 1
                    fi ;;
                *)
                    if check_cpu_flag sse4_1; then
                        CPU="-cpu Penryn,kvm=on,vendor=GenuineIntel,+sse,+sse2,+ssse3,+sse4.1"
                    else
                        echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.1 support."
                        exit 1
                    fi ;;
            esac

            local FLAG=""

            if [[ $CPU == *'Penryn'* ]]; then
                for FLAG in tsc vme fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 \
                            mce pae msr pse de fp87 cx16 lm nx syscall ; do
                    if check_cpu_flag "${FLAG}"; then CPU+=",+${FLAG}" ; fi
                done
                if check_cpu_flag lahf_lm ; then CPU+=",+lahf-lm" ; fi
            else
                if ! check_cpu_flag fma || ! check_cpu_flag rdtscp; then
                    echo "ERROR! macOS requires a CPU with FMA and TSC support."
                    exit 1
                fi
                for FLAG in vmx abm aes bmi1 bmi2 cx8 eist f16c fma \
                            mmx movbe mpx popcnt smep vaes vbmi2 vpclmulqdq \
                            fxsr clflush pse36 pat cmov mca pge mtrr sep apic cx8 \
                            mce pae msr tsc pse de fp87 x2apic cx16 \
                            pcid f16c rdrand lm nx syscall fsgsbase erms invpcid arat \
                            xgetbv1 xsave xsaveopt ; do
                    if check_cpu_flag "${FLAG}"; then CPU+=",+${FLAG}" ; fi
                done
                if check_cpu_flag tsc_adjust ; then CPU+=",+tsc-adjust" ; fi
                if check_cpu_flag lahf_lm ; then CPU+=",+lahf-lm" ; fi
                if check_cpu_flag amd_ssbd ; then CPU+=",+amd-ssbd" ; fi
            fi

Tested with FULL complete installs of Sonoma, Catalina and Mojave. Full setup with login and preferences set. Shutdown and re-login as working.

Much faster than previously with 4.9.2 through 4.9.4 etc. Fully working, no hangs, no stalls.

Of new, now requires the installer icon to be pressed on the restarts. This now happens a couple of times. But this all flows smoothly.

CAVEAT: not yet tested on Ryzen. Volunteers please ...

Additionally note the Skylake version is also working. This is commented out but has been tested on Sonoma. cpu_cores="8" should be placed in the .conf before running.

A conf selector for skylake should be considered, or at least noted and archived in case of future problems.

Also see notes and comments in #1214

lj3954 commented 4 months ago

A couple of CPU flags are named differently in QEMU, beware. vbmi2, for example, is avx512vbmi2

lj3954 commented 4 months ago

Note that PCID appears to be enabled by default with this cpu arg. CPUs which don't support this legacy flag, including the latest Ryzen CPUs, will get warnings. I've included disabling PCID on CPUs which don't support it in my rust quickemu.

TuxVinyards commented 4 months ago

Note that PCID appears to be enabled by default with this cpu arg. CPUs which don't support this legacy flag, including the latest Ryzen CPUs, will get warnings. I've included disabling PCID on CPUs which don't support it in my rust quickemu.

@lj3954 Thank you for that.

I wasn't fully sure about the inclusion of if check_cpu_flag amd_ssbd ; then CPU+=",+amd-ssbd" ; fi but Qemu docs say this makes things run faster and it follows along in the line of removal of IBRS via haswell-v2, which was key to getting things working for me.

@flexiondotorg you are missing the point of the one-liners. As @lj3954 has also pointed out, some of the flags are need special treatment. This is why I hesitated to write a loop in my initial work. I hadn't determined what was required at that stage. lscpu output sse4_1 needs translating to sse4.1 for Qemu, for example. But also

                if check_cpu_flag tsc_adjust ; then CPU+=",+tsc-adjust" ; fi
                if check_cpu_flag lahf_lm ; then CPU+=",+lahf-lm" ; fi

need the the underscores translating to hyphens.

Edit: also needed for the underscore in the amd_ssbd flag, so this flag won't have worked when it was:

" Tested full installs of Mojave, Catalina, Big Sur, Monterey, Ventura and Sonoma on AMD Ryzen 5950X. "

unfortunately.

TuxVinyards commented 4 months ago

The following flags are not found in Haswell

                        #if check_cpu_flag pdpe1gb ; then CPU+=",+pdpe1gb" ; fi
                        #if check_cpu_flag smap ; then CPU+=",+smap" ; fi
                        #if check_cpu_flag clwb ; then CPU+=",+clwb" ; fi
                        #if check_cpu_flag adx ; then CPU+=",+adx" ; fi

Which is why they were treated separately.

Edit: The commit has `pdpe1gb' with a minus but probably could just be omitted, to avoid confusion

smap and clwb are not present but adx is.

TuxVinyards commented 4 months ago

CPU="-cpu ${CPU_MODEL},vendor=GenuineIntel,-pdpe1gb,+avx,+sse,+sse2,+sse3,vmware-cpuid-freq=on"

Again sse3 is not a valid qemu parameter:

 qemu-system-x86_64 -cpu help | grep -A 100 flags | tr ' ' '\n' | grep sse | cat -s 
misalignsse
sse
sse2
sse4.1
sse4.2
sse4a
ssse3
lj3954 commented 4 months ago

Again sse3 is not a valid qemu parameter:

QEMU appears to refer to sse3 as pni. For many of these flags, though, I think it's likely they're enabled by default when you specify Haswell or whatever other architecture. SSE3, for example, was introduced in 2004. Surely anything expecting a Haswell CPU would require it.