Jump to content

[AMD] - Kernel Patches - Reduction of Patches used (Big Sur and Monterey Beta 1)


fabiosun

Recommended Posts

  • Supervisor

In this thread we will try to give an indication obtained together with several users on the kernel patches that AMD CPU users can safely use to boot their PCs with the Apple operating system.

 

We will analyze the patches provided by AMD - OSX Github, we will not go backwards because the previous situation is not clear enough to me to talk about it in a more precise and correct way, maybe if some of you want to add a "historical memory" on topic is welcome!

 

We will then start from the patches that can be downloaded from this link:

 

https://github.com/AMD-OSX/AMD_Vanilla

 

download the specific day 07-06-2021 to avoid any changes made on the same patches and therefore not create confusion.

For convenience they are attached to the thread.

I am attaching them as sometimes they are changed each both as find / replace and as denomination in the official comment, sometimes for no apparent reason.

 

So, our patch base will be the official one. It will start from 46 working patches from High Sierra to get up to Monterey beta 1 (Obviously passing through Mojave, Catalina BigSur).

 

o start we focused on the latest systems such as BigSur and Monterey beta 1 but, personally, I started skimming the patches from HighSierra and then refining the skimming in Big Sur, reaching a total number of 14 patches for the Kernel and one for the kext, then became 13 (thanks to @carlo_67 leaf removed) and then to the final number of 11 patches (thanks to @iGPU).

These 11 patches allow full use of Big Sur without any kind of noticeable problem.

I specific and I make this concept more evident, not being transparent and explained in detail the meaning of many patches, it could, in a remote hypothetical case, that a deleted patch maybe serves, for example, with a particular function of OSX or a special combination of operations carried out and programs used

 

In the spoiler we will put all the names of the patches officially used and declared in the patches plist of AMD-OSX GitHub, for the uninitiated, the basic entries and comments in the plist are the point where in XNU some parts of the kernel are searched and then replaced through the find / replace technique (and above all a specific competence on the subject. to decompile the kernel this is the command:

 

otool -tV /Users/fabio/Desktop/kernel_12 > ~//kernel.txt

 

The explanation of how to find patch locations is not a topic covered in this thread, but the comment and the decompiled kernel are a good clue and start.

 

Official AMD OSX Patches as of 06-07-2021 (valid for all OSX up to Monterey beta 1 and for CPUs defined with 17H-19H)

 

Spoiler

0 algrey - Disable _i386_switch_lbrs - 11.0/12.0

1 algrey - Disable _i386_lbr_init - 11.0/12.0

2 algrey - _i386_init_slave - Remove wrmsr 0x1c8 - 11.0/12.0

3 algrey - Disable _i386_lbr_native_state_to_mach_thread_state  - 11.0

4 Goldfish64 - Disable _i386_filtered_lbr_state_to_mach_thread_state - 12.0

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

6 XLNC - Disable _x86_validate_topology - 10.13/10.14/10.15/11.0/12.0

7 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 0 - 10.15/10.16/12.0

8 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 0 - 10.13/10.14

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

10 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

12 NoOne - Skip _cpuid_cores_per_package test - 10.15/11.0/12.0

13 algrey - Skip _cpuid_cores_per_package test - 10.13/10.14

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

15 algrey - _cpuid_set_generic_info - Set microcode=186 - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

17 algrey - _cpuid_set_generic_info - Disable check to allow leaf7 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

19 Goldfish64 - Bypass GenuineIntel check panic - 12.0

20 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 10.13/10.14/10.15/11.3

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

22 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 12.0

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

24 XLNC - jmp to calculations and set cpuid_cores_per_package - 12.0

25 algrey - cores and threads calculations - 10.15/10.16

26 XLNC - cores and threads calculations #1 - 12.0

27 XLNC - cores and threads calculations #2 - 12.0

28 algrey - cores and logicals count #1 - 10.13

29 algrey - cores and logicals count #1 - 10.14

30 algrey - cores and logicals count #2 - 10.13/10.14

31 algrey - cores and logicals count #3 - 10.13

32 algrey - cores and logicals count #3 - 10.14

33 algrey - cores and logicals count #4 - 10.13

34 algrey - cores and logicals count #4 - 10.14

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

36 algrey - Remove Penryn check to execute default case - 10.14

37 algrey - Remove Penryn check to execute default case - 10.13/10.15/11.0/12.0

38 algrey - Get DID and VID from MSR - 10.13/10.14/10.15/11.0/12.0

39 algrey - Skip msr_flex_ratio test and get FSBFrequency from EFI - 10.13/10.14/10.15/11.0/12.0

40 algrey - Remove version check and panic - 10.13/10.14

41 XLNC - Remove version check and panic - 10.15/11.0/12.0

42 algrey - Skip checks and prevent panic - 10.15/11.0/12.0

43 algrey - Skip checks and prevent panic - 10.13/10.14

44 algrey - _mtrr_update_action fix PAT - 10.13/10.14/10.15/11.0/12.0

45 Shaneee - _mtrr_update_action fix PAT - 10.13/10.14/10.15/11.0/12.0

 

Now we will take the same patches posted in the spoiler above and we will select only the useful ones to start any version of Big Sur, helping us with the wording present in the comments of the same patches.

 

Official AMD OSX Patches as of 06-07-2021 (only valid for Big Sur and CPUs defined with 17H-19H)

 

Spoiler

0 algrey - Disable _i386_switch_lbrs - 11.0/12.0

1 algrey - Disable _i386_lbr_init - 11.0/12.0

2 algrey - _i386_init_slave - Remove wrmsr 0x1c8 - 11.0/12.0

3 algrey - Disable _i386_lbr_native_state_to_mach_thread_state  - 11.0

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

6 XLNC - Disable _x86_validate_topology - 10.13/10.14/10.15/11.0/12.0

7 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 0 - 10.15/10.16/12.0

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

12 NoOne - Skip _cpuid_cores_per_package test - 10.15/11.0/12.0

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

15 algrey - _cpuid_set_generic_info - Set microcode=186 - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

17 algrey - _cpuid_set_generic_info - Disable check to allow leaf7 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

20 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 10.13/10.14/10.15/11.3

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

25 algrey - cores and threads calculations - 10.15/10.16

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

37 algrey - Remove Penryn check to execute default case - 10.13/10.15/11.0/12.0

38 algrey - Get DID and VID from MSR - 10.13/10.14/10.15/11.0/12.0

39 algrey - Skip msr_flex_ratio test and get FSBFrequency from EFI - 10.13/10.14/10.15/11.0/12.0

41 XLNC - Remove version check and panic - 10.15/11.0/12.0

42 algrey - Skip checks and prevent panic - 10.15/11.0/12.0

44 algrey - _mtrr_update_action fix PAT - 10.13/10.14/10.15/11.0/12.0

45 Shaneee - _mtrr_update_action fix PAT - 10.13/10.14/10.15/11.0/12.0

 

We arrive at a total of 25 patches that inserted in the appropriate section of the config.plist will start all the versions of Big Sur from 11.0 to 11.5 beta 4 present today Now, it is clear that up to now there hasn't been all this great work, but let's say that for a user who only uses BigSur it would be a good cleanup of their config.plist As a side note I remember that TRX40 users do not need 44/45 patches (PAT fixes) also thanks to the tests carried out by the user @Pavo months ago.

 

Now the interesting part for the moment confirmed by all TRX40 users except some who need the CPU Topology patch, but it could also be no longer necessary using a combination of quirks, I ask @Arrakis and @Ploddlesto intervene in this regard also on the subject whether or not to use the DummyPowermanagement quirk. On MSI motherboards is not needed, on Gigabytes and on the x570 platform it would seem so. In the following spoiler the patches that until a few days ago were useful to me and to many users also X570 to work with OSX Big Sur:

 

Official AMD OSX Patches - first reduction (only valid for Big Sur and CPUs defined with 17H-19H):

 

Spoiler

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

17 algrey - _cpuid_set_generic_info - Disable check to allow leaf7 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

20 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 10.13/10.14/10.15/11.3

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

25 algrey - cores and threads calculations - 10.15/10.16

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

37 algrey - Remove Penryn check to execute default case - 10.13/10.15/11.0/12.0

38 algrey - Get DID and VID from MSR - 10.13/10.14/10.15/11.0/12.0

41 XLNC - Remove version check and panic - 10.15/11.0/12.0

 

Quirks:

396504328_Screenshot2021-07-06at11_24_35AM.png.ad701f158557be02834fa9f21cd83acd.png

 

1464196472_Screenshot2021-07-06at2_04_47PM.png.202a4540a7084dbd807d1316414d81dc.png

So a nice huge cut of necessary patches!

We went from 25 patches to 15!

 

With a test carried out by @carlo_67it was possible to further refine this list by removing the patch:

algrey - _cpuid_set_generic_info - Disable check to allow leaf7 - 10.13/10.14/10.15/11.0/12.0

 

to get 14 patches for the kernel and for the BigSur boot

 

Official AMD OSX Patches - second reduction (valid only for Big Sur and CPUs defined with 17H-19H)

 

Spoiler

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

20 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 10.13/10.14/10.15/11.3

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

25 algrey - cores and threads calculations - 10.15/10.16

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

37 algrey - Remove Penryn check to execute default case - 10.13/10.15/11.0/12.0

38 algrey - Get DID and VID from MSR - 10.13/10.14/10.15/11.0/12.0

41 XLNC - Remove version check and panic - 10.15/11.0/12.0

 

Quirks:

880829399_Screenshot2021-07-06at11_24_35AM.png.3c75eccd8fc8769344a9031b3b53b96f.png

 

558498314_Screenshot2021-07-06at2_04_47PM.png.a2e46be5d497260a8726e197758622c5.png

 

Now, I remember that the reduced set of patches has been described and discussed several times even with users with Gigabyte motherboards such as @Arrakis con who understood at the time that there was a need to keep the patch in the list:

XLNC - Disable _x86_validate_topology - 10.13/10.14/10.15/11.0/12.0

now XLNC but at the time I believe it was called Algrey.

link below:

 

 

set of patches was constantly being published, and still is, in my EFi in the main thread dedicated to the TRX40 platform:

 

Having said that thanks to the work of @iGPU it was possible to remove two further patches:

 

37 algrey - Remove Penryn check to execute default case - 10.13/10.15/11.0/12.0

38 algrey - Get DID and VID from MSR - 10.13/10.14/10.15/11.0/12.0

 

So from 25 patches we went to the 12 shown in the spoiler below:

 

AMD OSX Patches ufficiali terza riduzione (valide solo per Big Sur e per le CPU definite con 17H-19H)

 

Spoiler

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

20 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 10.13/10.14/10.15/11.3

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

25 algrey - cores and threads calculations - 10.15/10.16

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

41 XLNC - Remove version check and panic - 10.15/11.0/12.0

 

Quirks:

1350677685_Screenshot2021-07-06at11_27_08AM.png.dfe2d2e86fee3d1f61bff993617d2bcf.png

 

469643336_Screenshot2021-07-06at2_07_17PM.png.3d86c41d35fe254b436fdc3a666ddab3.png

 

Not bad right?

We will shortly publish the quirks necessary to have the necessary and (perhaps) sufficient conditions for everyone to use the reductions proposed in this article

 

Obviously we thank all the editors of the official AMD-OSX Github and even more obviously we will appreciate their intervention to clarify the need for further officially recommended patches.

 

AMD_Vanilla-opencore.zip

Screenshot 2021-07-06 at 11.27.08 AM.png

 

We can discuss on General/international forum area about it, also to contribute to improve this and for other ideas

Thank you

 

 

Link to comment
Share on other sites

  • Supervisor

In this section we will continue by providing the minimum set of patches useful for starting systems from Big Sur 11.4 to Monterey 12 b1. We will not do all the history as in the post above but we will get to the core only starting from the patches downloadable from the AMD GitHub - OSX.

 

Official AMD OSX Patches as of 06-07-2021 (only valid for Big Sur and CPUs defined with 17H-19H)

 

Spoiler

0 algrey - Disable _i386_switch_lbrs - 11.0/12.0

1 algrey - Disable _i386_lbr_init - 11.0/12.0

2 algrey - _i386_init_slave - Remove wrmsr 0x1c8 - 11.0/12.0

3 algrey - Disable _i386_lbr_native_state_to_mach_thread_state  - 11.0

4 Goldfish64 - Disable _i386_filtered_lbr_state_to_mach_thread_state - 12.0

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

6 XLNC - Disable _x86_validate_topology - 10.13/10.14/10.15/11.0/12.0

7 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 0 - 10.15/10.16/12.0

8 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 0 - 10.13/10.14

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

10 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

12 NoOne - Skip _cpuid_cores_per_package test - 10.15/11.0/12.0

13 algrey - Skip _cpuid_cores_per_package test - 10.13/10.14

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

15 algrey - _cpuid_set_generic_info - Set microcode=186 - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

17 algrey - _cpuid_set_generic_info - Disable check to allow leaf7 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

19 Goldfish64 - Bypass GenuineIntel check panic - 12.0

20 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 10.13/10.14/10.15/11.3

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

22 algrey - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 12.0

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

24 XLNC - jmp to calculations and set cpuid_cores_per_package - 12.0

25 algrey - cores and threads calculations - 10.15/10.16

26 XLNC - cores and threads calculations #1 - 12.0

27 XLNC - cores and threads calculations #2 - 12.0

28 algrey - cores and logicals count #1 - 10.13

29 algrey - cores and logicals count #1 - 10.14

30 algrey - cores and logicals count #2 - 10.13/10.14

31 algrey - cores and logicals count #3 - 10.13

32 algrey - cores and logicals count #3 - 10.14

33 algrey - cores and logicals count #4 - 10.13

34 algrey - cores and logicals count #4 - 10.14

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

36 algrey - Remove Penryn check to execute default case - 10.14

37 algrey - Remove Penryn check to execute default case - 10.13/10.15/11.0/12.0

38 algrey - Get DID and VID from MSR - 10.13/10.14/10.15/11.0/12.0

39 algrey - Skip msr_flex_ratio test and get FSBFrequency from EFI - 10.13/10.14/10.15/11.0/12.0

40 algrey - Remove version check and panic - 10.13/10.14

41 XLNC - Remove version check and panic - 10.15/11.0/12.0

42 algrey - Skip checks and prevent panic - 10.15/11.0/12.0

43 algrey - Skip checks and prevent panic - 10.13/10.14

44 algrey - _mtrr_update_action fix PAT - 10.13/10.14/10.15/11.0/12.0

45 Shaneee - _mtrr_update_action fix PAT - 10.13/10.14/10.15/11.0/12.0

 

So to get to the minimum set of patches used now successfully on sTRX4 systems:

 

Official AMD OSX Patches as of 06-07-2021 (only valid for Big Sur and CPUs defined with 17H-19H)

 

Spoiler

5 algrey - _commpage_populate - Remove rdmsr - 10.13/10.14/10.15/11.0/12.0

9 algrey - _cpuid_set_cache_info - Set cpuid to 0x8000001D instead 4 - 10.13/10.14/10.15/11.0/12.0

10 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 12.0

11 algrey - _cpuid_set_cache_info - Don't set cpuid_cores_per_package - 10.13/10.14/10.15/11.0

14 algrey - _cpuid_set_generic_info - Remove wrmsr - 10.13/10.14/10.15/11.0/12.0

16 algrey - _cpuid_set_generic_info - Set flag=1 - 10.13/10.14/10.15/11.0/12.0

18 algrey - _cpuid_set_info - GenuineIntel to AuthenticAMD - 10.13/10.14/10.15/11.0/12.0

19 Goldfish64 - Bypass GenuineIntel check panic - 12.0

21 DhinakG - _cpuid_set_cpufamily - Force CPUFAMILY_INTEL_PENRYN - 11.3b1

23 algrey - jmp to calculations and set cpuid_cores_per_package - 10.15/11.0

XLNC - jmp to calculations and set cpuid_cores_per_package - 12.0

25 algrey - cores and threads calculations - 10.15/10.16

26 XLNC - cores and threads calculations #1 - 12.0

27 XLNC - cores and threads calculations #2 - 12.0

35 algrey - _i386_init - Remove rdmsr (x3) - 10.13/10.14/10.15/11.0/12.0

41 XLNC - check and panic - 10.15/11.0/12.0

42 algrey - Skip checks and prevent panic - 10.15/11.0/12.0

 

 

Quirks sTRX4:

 

493285785_Screenshot2021-07-06at3_42_56PM.png.0c0f19f0a4882d777c17af6458d415ee.png

 

1475798409_Screenshot2021-07-06at3_43_35PM.png.f16f4cd64794ecc6faf0c795fd81587d.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.