Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

"Best settings for AMD" does not work on AMD 7xxx #84

Closed
ghost opened this issue Feb 4, 2023 · 22 comments
Closed

"Best settings for AMD" does not work on AMD 7xxx #84

ghost opened this issue Feb 4, 2023 · 22 comments

Comments

@ghost
Copy link

ghost commented Feb 4, 2023

Not sure if I'm doing something wrong, or these settings does not suit latest zens.
My system is: AMD 7950x, Win 11
Long story short, these are working:

cpuid.0.eax = "0000:0000:0000:0000:0000:0000:0000:1011"
cpuid.0.ebx = "0111:0101:0110:1110:0110:0101:0100:0111"
cpuid.0.ecx = "0110:1100:0110:0101:0111:0100:0110:1110"
cpuid.0.edx = "0100:1001:0110:0101:0110:1110:0110:1001"
cpuid.1.eax = "0000:0000:0000:0001:0000:0110:0111:0001"
cpuid.1.ebx = "0000:0010:0000:0001:0000:1000:0000:0000"
cpuid.1.ecx = "1000:0010:1001:1000:0010:0010:0000:0011"
cpuid.1.edx = "0000:0111:1000:1011:1111:1011:1111:1111"

and these are not:

cpuid.0.ebx = "0111:0101:0110:1110:0110:0101:0100:0111"
cpuid.0.ecx = "0110:1100:0110:0101:0111:0100:0110:1110"
cpuid.0.edx = "0100:1001:0110:0101:0110:1110:0110:1001"
featMask.vm.cpuid.FAMILY = "Val:0x6"
featMask.vm.cpuid.MODEL = "Val:0x9e"
featMask.vm.cpuid.STEPPING = "Val:0x0a"
featMask.vm.cpuid.AVX2 = "Min:1"
cpuid.brandstring = "Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz"
cpuid.inhibitDarwinMasks = "TRUE"
board-id.reflectHost = "FALSE"
board-id = "Mac-937A206F2EE63C01"
ethernet0.virtualDev = "vmxnet3"

I use VMware player 17 and MacOS Catalina as guest.
Maybe Catalina is too old for such configuration? If yes - it would be painful :(


Also, not related to unlocker, and offtopic here, but I'm just stuck, so maybe somebody could give me an advice? The problem is - guest systems (does not matter - MacOS or Windows) do not see host's network folders on my current system. They both see host in "Network" but not it's shared folders (not vmware shared folders!). At the same time host easily sees guest's network folders. Pings are ok in any direction. All possible sharing related features are set to allow anybody to see network folders - no luck. Actually, macos VM is copied from my old system where it worked for years without any issues with network folders. Googled all Internet over, but nothing helped. Then I downloaded Win11 image from MS site in order to investigate the issue, but failed :(

@DrDonk
Copy link
Owner

DrDonk commented Feb 7, 2023

Sorry I don't have any AMD kit to test this, and I am reliant on others who test it. It could possibly be due to the Catalina version but I doubt it. If those settings work for you then stick with them. I would also add these 3 lines as well.

vhv.enable = "FALSE"
vpmc.enable = "FALSE"
vvtd.enable = "FALSE"

Ensures macOS does not try to use Intel VMX extensions on an AMD CPU

@ghost
Copy link
Author

ghost commented Feb 7, 2023

I started experimenting with settings other than I found to be working because I tried to "show" all CPU features to the guest OS, as my tasks are very CPU intensive, and I wanted to allow the app I'm using to use all available features. But I was unable to find how these masks are created, and what should I change to, for example, "show" AVX2 to guest.

@DrDonk
Copy link
Owner

DrDonk commented Feb 7, 2023

I have left the wiki page with the original settings AMD CPUs

@DrDonk
Copy link
Owner

DrDonk commented Feb 7, 2023

You can setup cpuid masks but they are complicated. Also the CPU must support the instruction so whilst you can spoof AVX2 present the real CPU must support it.

AVX2 off:

cpuid.7.ebx = "----:----:----:----:----:----:--0-:----"

AVX2 on:

cpuid.7.ebx = "----:----:----:----:----:----:--1-:----"

@ghost
Copy link
Author

ghost commented Feb 7, 2023

The best result I was able to achieve is

virt: machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH         MMX FXSR SSE SSE2               SSE3 PCLMULQDQ        MON                       SSSE3     CX16          SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES VMM                                       RDRAND
real: machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C


real: machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET SGX BMI1 AVX2 SMEP BMI2 ERMS INVPCID FPU_CSDS MPX RDSEED ADX SMAP CLFSOPT IPT SGXLC MDCLEAR IBRS STIBP L1DF ACAPMSR SSBD

virt - my vm, real - real macbook of my friend, aligned for readability.

So no FMA, AVX, AVX2, AVX512. For some reason leaf7_features is completely absent in vm. Now I'm out of ideas how to get these extensions to be visible inside vm.

Final settings are

cpuid.1.eax = "0000:0000:0000:0001:0000:0110:0111:0001"
cpuid.1.ebx = "0000:0010:0000:0001:0000:1000:0000:0000"
cpuid.1.ecx = "1---:00--:----:----:----:----:----:----"
cpuid.1.edx = "---0:----:----:----:----:----:----:----"
cpuid.brandstring = "Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz"
board-id.reflectHost = "FALSE"
board-id = "Mac-937A206F2EE63C01"
vhv.enable = "FALSE"
vpmc.enable = "FALSE"
vvtd.enable = "FALSE"

@DrDonk
Copy link
Owner

DrDonk commented Feb 7, 2023

Can you attach a vmware.log file from the VM please? Even better if you can set the advanced settings of the VM to "Full" and then run the VM from start to shutdown. https://docs.vmware.com/en/VMware-Workstation-Pro/17/com.vmware.ws.using.doc/GUID-A438B4FE-8499-454C-BBDE-9299FCDFB455.html

@ghost
Copy link
Author

ghost commented Feb 7, 2023

Unfortunately I can't set advanced settings, probably because I only have Player, not Workstation.

Is this log is what you are asking for?
vmware.log

@DrDonk
Copy link
Owner

DrDonk commented Feb 7, 2023

No problem the VMware.log you sent has everything needed. It’s late evening in UK so will look at it tomorrow.

@DrDonk
Copy link
Owner

DrDonk commented Feb 8, 2023

Looking at the vmware.log file, VMware is set that only the following bits are needed for Catalina:

sse3,pclmulqdq,mwait,ssse3,cmpxchg16b,sse41,sse42,movbe,popcnt,aes,rdrand,fsgsbase,bmi1,
smep,bmi2,enfstrg,invpcid,rdseed,adx,smap,clflushopt,clwb,sha,umip,pku,gfni,rdpid,
fast_short_repmov,fcmd,lahf64,extapicspc,cr8avail,abm,sse4a,misaligned_sse,3dnprefetch,
nx,mmxext,ffxsr,pdpe1gb,rdtscp,lm,clzero,wbnoinvd,amd,ibpb

Those are the bits that must be available for Catalina to work, which makes sense based on the CPUs and Apple hardware Catalina was designed to support.

Next question is that Catalina could still use AVX etc. The cpuid bit masks do not stop the guest OS from using instructions unless it queries the cpuid bits first and modifies its code path. Do you know that the software you are using queries and makes use of AVX2, as it could be using AVX2/AVX512 without those bits being set?

Anyways this is the next idea I have for you as it's interesting challenge. Remove some of those other lines and go back to basics ensuring these lines are present:

cpuid.inhibitDarwinMasks = "TRUE"
cpuid.1.eax = "0000:0000:0000:0001:0000:0110:0111:0001"
cpuid.1.ebx = "0000:0010:0000:0001:0000:1000:0000:0000"
cpuid.7.ebx = "----:----:----:----:----:----:--1-:----"
vhv.enable = "FALSE"
vpmc.enable = "FALSE"
vvtd.enable = "FALSE"

and remove:

cpuid.brandstring = "Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz"
board-id.reflectHost = "FALSE"
board-id = "Mac-937A206F2EE63C01"

Check if AVX2 now is present in guest.

(I will be away from computer for a couple of hours from now)

@ghost
Copy link
Author

ghost commented Feb 8, 2023

No, unfortunately I don't know if this software using FMA\AVX or not, and if yes - what version of it. So my idea was to get it from it's processing speed with different cpu features enabled\disabled.
Regarding cpuid, without any line of these I'm getting an error "CPU was disabled":

cpuid.0.ebx = "0111:0101:0110:1110:0110:0101:0100:0111"
cpuid.0.ecx = "0110:1100:0110:0101:0111:0100:0110:1110"
cpuid.0.edx = "0100:1001:0110:0101:0110:1110:0110:1001"

And without these zeroes in these lines it hangs right after showing apple logo.

cpuid.1.ecx = "----:00--:----:----:----:----:----:----"
cpuid.1.edx = "---0:----:----:----:----:----:----:----"

So the only line that can be removed is cpuid.0.eax = "0000:0000:0000:0000:0000:0000:0000:1011", and nothing is changed in cpu features after doing it.

@DrDonk
Copy link
Owner

DrDonk commented Feb 8, 2023

OK well my mistake there with those settings. I assume you have the latest build of unlocker? If so I suggest the following on the host computer.

  1. Look for the \unlocker\cpuid\windows folder in the extracted unlocker files
  2. Open a command prompt in the windows folder
  3. Run this command:

cpuid.exe -d -c 0

  1. Capture the output and add to the issue, preferable as a file.

I can generate a complete VMware cpuid mask from it.

There is also a macOS version in the cpuid folder. You could also run that in terminal on macOS. It would give a dump of all cpuid values.

@ghost
Copy link
Author

ghost commented Feb 8, 2023

Well, it was the latest till yesterday :) Downloaded new version just now.

Output from the windows host is attached, but I was not able to run it in the macos guest :( I have almost no experience in macos, so probably I'm doing something wrong. If I'm trying to launch it from terminal, I'm getting following error:

Last login: Wed Feb  8 15:00:52 on ttys001
admin@Mac-Admin Desktop % ls
Iridient Developer.app		Lumariver HDR.app		Raw Photo Processor 64.app	cpuid
admin@Mac-Admin Desktop % cpuid
zsh: command not found: cpuid
admin@Mac-Admin Desktop % 

And if I'm trying to right mouse click \ Open with Terminal it gives me

Last login: Wed Feb  8 15:01:28 on ttys001
admin@Mac-Admin ~ % /Users/admin/Desktop/cpuid ; exit;
zsh: illegal hardware instruction  /Users/admin/Desktop/cpuid

[Process completed]

cpuid_win.txt

@DrDonk
Copy link
Owner

DrDonk commented Feb 8, 2023

Attached is a cpuid dump in VMware VMX format. Please don't copy it all in as definitely won't work but we can extract bits of the host CPU and paste into VMX file.

Let's try this where I have added all the host leaf 7 bits:

cpuid.inhibitDarwinMasks = "TRUE"
cpuid.0.ebx = "0111:0101:0110:1110:0110:0101:0100:0111"
cpuid.0.ecx = "0110:1100:0110:0101:0111:0100:0110:1110"
cpuid.0.edx = "0100:1001:0110:0101:0110:1110:0110:1001"
cpuid.1.ecx = "----:00--:----:----:----:----:----:----"
cpuid.1.edx = "---0:----:----:----:----:----:----:----"
# Leaf 7 values from host CPU
cpuid.7.0.eax        = "0000:0000:0000:0000:0000:0000:0000:0001"
cpuid.7.0.ebx        = "1111:0001:1011:1111:1001:0111:1010:1001"
cpuid.7.0.ecx        = "0000:0000:0100:0000:0101:1111:1100:1110"
cpuid.7.0.edx        = "0001:0000:0000:0000:0000:0000:0001:0000"
cpuid.7.1.eax        = "0000:0000:0000:0000:0000:0000:0010:0000"
cpuid.7.1.ebx        = "0000:0000:0000:0000:0000:0000:0000:0000"
cpuid.7.1.ecx        = "0000:0000:0000:0000:0000:0000:0000:0000"
cpuid.7.1.edx        = "0000:0000:0000:0000:0000:0000:0000:0000"
vhv.enable = "FALSE"
vpmc.enable = "FALSE"
vvtd.enable = "FALSE"

cpuid on macOS may be failing as we have some Frankenstein's monster of a hybrid CPU. So can use sysctl to get bits as you did previously.

issue_84_cpuid_full_masks.txt

@ghost
Copy link
Author

ghost commented Feb 8, 2023

sysctl reports the same features as it was without leaf 7 in vmx. :(

Attached vmware log of vm launch with leaf 7 added to vmx in case you need it.
vmware.log

@DrDonk
Copy link
Owner

DrDonk commented Feb 8, 2023

Sorry but I’m out of ideas. I can’t think of anything else to try. I have used my real MacBook Pro and Fusion and can mask AVX2 on and off. Guess it’s something in VMware hypervisor on Windows stopping it. There used to be a setting to force cpuid changes but it was removed several releases ago.

@ghost
Copy link
Author

ghost commented Feb 8, 2023

I tried to launch Win 11 vm in the same VMware Player, and cpuid in the guest Windows shows leaf 7 almost identical to the host.
So it seems to me that VMware has some more countermeasures against launching MacOS from non-Apple computers, or just something not implemented. But this is only my speculations.

@DrDonk
Copy link
Owner

DrDonk commented Feb 8, 2023

Pretty sure it’s the second option. It’s probably something that is never tested as not a supported setup. The guest does run just not exposing same features as on real Mac. It’s running on Windows with an AMD CPU, not something that would be on the radar for development and testing.

@DrDonk
Copy link
Owner

DrDonk commented Feb 8, 2023

I’ve got one last thought but I need to go find it. A VMware engineer told me about another VMX setting, but I’ll need to find it. He left VMware and I think the conversation was about 10 years ago, so will need to trawl through my notes to try and find it.

@DrDonk
Copy link
Owner

DrDonk commented Feb 9, 2023

I found the forum thread and tested the settings but it does not work and looks like the code to disable feature compatibility has been removed.

FYI https://communities.vmware.com/t5/VMware-Workstation-Pro/Is-it-possible-to-quot-mask-quot-the-CPUID-in-Workstation/td-p/2167959/page/2

The admin user is the guy who left and his posts were moved to the admin user.

@ghost
Copy link
Author

ghost commented Feb 9, 2023

Well.. At least we tried. It is sad that all AVX and FMA stuff is not available to my guest, but anyway it works fast enough on 16 cores.
Thank you for your willingness to help!

@DrDonk
Copy link
Owner

DrDonk commented Feb 9, 2023

It was interesting to see what was going on, but it's sad we didn't get a good result. Good luck with your VM.

@ghost
Copy link
Author

ghost commented Feb 9, 2023

Thank you! :)

@DrDonk DrDonk closed this as completed Feb 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant