Ryzen 7000 Testing

As I said in the past, testing the not loved bootloader should have only a goal
To use an old version (if I remember well R5143) which was cloned bad from opencore
In this version no ProvideCPUCurrentInfo quirk so we need to use some patches that that quirk has in it
Why r5143? Because if you see also in not loved bootloader GitHub issue something weird happened with tsc and maybe some other useful data is possible to gain from that bug
Then, as side note, in not loved boot menu is possible to block kext, ssdt and to change bootarg option on the fly
And this togheter to a different debug.txt could help to speed trial and errors process to solve latest problem zen4 has
Only my 2 cents on this subject😂

Edit:
Useful link
see patches to add (for the miss of ProvideCurrentCPUInfo quirk) and also a thought about GPU performance

Edit 2:
Many of AMD users does no need of algrey - cpu_topology_sort -disable _x86_validate_topology
with modern boot loaders this patch is inserted on ProvideCPUCurrentInfo quirk
My personal goal was always to have a more "Vanilla" system and for this I have always tried to reduce kernel patches for my own (on mine and other systems)


Then luckily a big patches revision is happened and now we have less patches for OSX kernel to use


and from here an OT question:
Is it possible to build an opencore version without forcing the use of topology patch?
Or, as unexperienced user, in quirk there is programming code as this
/enable very low programming skill on/
"if you do not need of topology patch, quirk does not apply it" :)
/disable very low programming skill off/
 
Last edited:
Interim Update #15:
  • Our attention has turned to investigating the audio stuttering problem
  • Running SpeedKeeper makes a significant improvement, but does not yield perfect results
  • Things we've tried:
    • Disabling iGPU in BIOS or via SSDT does not help
    • Using various TSC Sync kexts does not help (AmdTSCSync; VoodooTSCSyncAMD; CpuTSCSync)
    • We observed that OpenCore and Clover calculate different values for FSB and TSC, but neither bootloader helps in this regard
    • Disabling C-States in BIOS does not help
    • Setting all PCI lanes to PCI 3.0 does not help
  • Because SpeedKeeper is currently the only known partial remedy, it makes sense to read its description carefully (highlights added by me):
How does this application help?

Well, the issue seems to be a relation of clock speed of the CPU and the clock of the OS. When the processor is not busy enough, the clock speed drops, and that makes the OS de-sync with the CPU, sound is very much dependent on timing, and even the clock in the status bar knows to lag behind.

So this app is just meant to keep the CPU busy enough to make general usage much more bearable. I used the logic that is inside this application for more than a year using this, and I've had a lot of work done successfully, whilst listening to music all the time.

This application is pretty much doing "1 + 1" calculation all the time in the background. That action is quite enough to keep the CPU busy, and it does not interact with IO to block anything. It is placed in the foreground, as all my experiments to run this application in the background get stumped by macOS, where it just slows the process down a lot when it is not in the foreground (so for me, it ran all the time in an open terminal window). Now I've made it into a user-friendly small application that anyone can copy into /Applications, add to the list of Login Items, and start and stop.

This really is not a full solution - this is a much deeper issue that I don't have too much time to explore. This does not sync up the clocks by any standard means, it just makes the CPU & OS more likely to be in-sync, and the experience of using the OS more smooth and sound less garbled.
  • At this time, therefore, the most plausible culprit -- based on real evidence provided by running the SpeedKeeper application -- is a de-synchronization of the Time Stamp Counter or TSC.
  • Wikipedia has a very good explanation of the Time Stamp Counter, and it's easy to see why this might be the culprit
So where do we go from here?
  • One option is to examine the Linux source code for details of configuring TSC and FSB for the latest AMD processors, so this is my current plan
 
Last edited:
One option is to examine the Linux source code for details of configuring TSC and FSB for the latest AMD processors, so this is my current plan
Somehow this seems a logical next step after having first set up serial debugging on a motherboard without serial ports and then set up the software environment to compile the OS kernel and customised versions of its extensions in order to investigate PCIe issues on AM5…

But let me express a more considerate reaction to the plan: "WOW!"
 
According to my research, the latest kernel is most compatible with the AM5 system, not the LTS kernel
 
Quick Update:
  • Setting boot argument cpus=1 causes macOS to use a single CPU
  • Activity Monitor looks really amazing. Which century is this from? :)
Screenshot 2022-11-18 at 3.20.49 PM.png
  • But the best part: There is no audio stutter.
  • Now let me try twoCPUs and update this post.
    • Update:
      • No stutter with 2 CPUs, but audio can stop momentarily when CPU load increases and we switch tabs in Firefox (this would happen on any platform)
      • However, this may simply be because both CPUs are constantly loaded
      • TSC de-synchronizes when one or more cores begins to idle, but if all cores are fully active, they tend to remain in sync
Screenshot 2022-11-18 at 3.35.28 PM.png

No stutter with CPU usage as shown:
Screenshot 2022-11-18 at 3.39.49 PM.png
 
Last edited:
@CaseySJ Give this a go when you get a chance. There's no quirk added or anything. I've simply altered the tsc calculations in an attempt to smooth out the audio. If it actually does anything it'll need majorly cleaned up and possibly set to AMD only when the stepping or ext model matches that of Ryzen with iGPU. I'm not expecting it to work but if there's a difference at least we know we are on the correct track. Check your TSC and BUS frequencies in the log and within macOS and compare to vanilla OC,
 

Attachments

@CaseySJ Give this a go when you get a chance. There's no quirk added or anything. I've simply altered the tsc calculations in an attempt to smooth out the audio. If it actually does anything it'll need majorly cleaned up and possibly set to AMD only when the stepping or ext model matches that of Ryzen with iGPU. I'm not expecting it to work but if there's a difference at least we know we are on the correct track. Check your TSC and BUS frequencies in the log and within macOS and compare to vanilla OC,

** STOP THE PRESSES: Audio is Fixed **

OMG!!
Audio stuttering appears to have been fixed!!

Listening to Heart's performance of Stairway to Heaven on YouTube with all cores and threads enabled, and SpeedKeeper is not running. No audio stutter at all. Bloody wonderful!
Screenshot 2022-11-18 at 3.52.44 PM.png
Here's a wonderful early rendition by Led Zeppelin.
@Shaneee,

I don't know what you did, but as we say in America, it's bloody working. :) Below is the OpenCore log, but nothing jumps out at me. Can you explain what you did?
Here is the OpenCore log:
Bash:
00:079 00:013 OCCPU: MP services threads 16 (enabled 16) - Success
00:092 00:013 OCCPU: MP services Pkg 1 Cores 8 Threads 2 - Success
00:119 00:027 OCCPU: Found AMD Ryzen 7 7700X 8-Core Processor         
00:140 00:020 OCCPU: Signature A60F12 Stepping 2 Model 61 Family F Type 0 ExtModel 6 ExtFamily A uCode 0 CPUID MAX (10/80000028)
00:254 00:113 OCCPU: FID 180 DID 8 Divisor 0 MaxBR 44
00:267 00:013 OCCPU: CPUFrequencyFromTSC  4499993292Hz  4499MHz
00:280 00:012 OCCPU: CPUFrequency  4499993292Hz  4499MHz
00:293 00:012 OCCPU: FSBFrequency   102272574Hz   102MHz
00:307 00:014 OCCPU: Pkg 1 Cores 8 Threads 16
 
Last edited:
Holy crap it actually worked :eek::cool:

File -> OpenCorePkg -> Library -> OcAppleKernelLib -> CpuidPatches

Code:
  //
  // Perform TSC and FSB calculations. This is traditionally done in tsc.c in XNU.
  //
  busFreqValue    = CpuInfo->FSBFrequency;
  busFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), busFreqValue, NULL);
  busFCvtn2tValue = DivU64x64Remainder(((1 * Giga) << 32), busFCvtt2nValue, NULL);

  tscFreqValue    = CpuInfo->CPUFrequency;
  tscFCvtt2nValue = DivU64x64Remainder ((1000000000ULL << 32), tscFreqValue, NULL);
  tscFCvtn2tValue = DivU64x64Remainder(((1 * Giga)  << 32), tscFCvtt2nValue, NULL);

Thanks to Clover actually ;) Now if this doesn't disrupt anything on Intel systems I don't see why acidanthera wouldn't accept this unless of course it's too messy/hacky.
Check original file to see changes.
 
P.S. I'm just gonna sit here and listen for hours! So pleased with the way we've come together in this thread! :) "We can do great things when we work together."
 
...

Thanks to Clover actually ;) Now if this doesn't disrupt anything on Intel systems I don't see why acidanthera wouldn't accept this unless of course it's too messy/hacky.
Check original file to see changes.
Can this code change be made in a platform-specific manner such that it applies only to AM5 and/or Ryzen APUs?
 
Can this code change be made in a platform-specific manner such that it applies only to AM5 and/or Ryzen APUs?

I don't see why not. I'll just need to work out how. What does machdep.cpu.stepping show on your system? Could it's 0 on mine. If it's different on APUs could possible add something like If CPUFAMILY_AMD && Cpu->Stepping=1 etc etc
 
Comparison of TSC and FSB values:

Screenshot 2022-11-18 at 4.31.53 PM.png

Thanks to @mariettosun for having us look into Clover for guidance.
 
Last edited:
I don't see why not. I'll just need to work out how. What does machdep.cpu.stepping show on your system? Could it's 0 on mine. If it's different on APUs could possible add something like If CPUFAMILY_AMD && Cpu->Stepping=1 etc etc
On my Ryzen 7 7700X system, the value is 2.
Bash:
% sysctl -a | grep stepping
machdep.cpu.stepping: 2
 
On my Ryzen 7 7700X system, the value is 2.
Bash:
% sysctl -a | grep stepping
machdep.cpu.stepping: 2

I’ll see what I can come up with tomorrow after work. It’s late now and I’ve been awake almost 22 hours lol
 
  • Wow
Reactions: CaseySJ
One small step for Hackintosh, one large step for personal computers
 
  • Love
Reactions: Galve2000
Interim Update #16:
  • I have the distinct pleasure of penning this 16th update...
  • This thread began on September 30 with @PoMpIs who took a bold step in purchasing the new unproven AM5 platform
  • Today, about six and a half weeks later, we arrived at Golden Build status :)
  • The challenges with AM5 were significant and perplexing, but with great teamwork and perseverance we managed to find a way
  • We should all raise a toast to teamwork :)
Golden Build Status Means:
  • All on-board devices work
  • All cores are properly time-stamp synchronized
  • Sleep, Wake, Reboot and Shutdown work properly
  • Big Sur, Monterey and Ventura are fully operational
  • System is stable, lightning fast in response, and eminently usable as a primary system
 
Last edited:
F5A19E33-A0CF-4EBD-B8BA-7480169EA5EB.jpegMeanwhile with Aquantia— screenshot of IOReg for now since my system keeps KP
 
I haven’t had a chance yet to install my Gigabyte GC-AQC113C so please post your IOReg file from IORegistryExplprer —> File —> Save As… This may be a tough problem.
Mine is built-in AQC107 on Gigabyte X570 Aorus Xtreme Rev1.0, but posting up IOReg file anyway.
 

Attachments

  AdBlock Detected
Sure, ad-blocking software does a great job at blocking ads, but it also blocks some useful and important features of our website. For the best possible site experience please take a moment to disable your AdBlocker.