acidanthera / bugtracker

Acidanthera Bugtracker
382 stars 44 forks source link

Installer not working with 5700XT (pikera) #901

Closed peteha closed 4 years ago

peteha commented 4 years ago

Z390 - ASUS-Z390F i9 9900k 5700XT OC 0.5.8 Latest - Lilu 1.4.4 and Whatevergreen - 1.3.9

When clean install using 5700XT installer fails with crash. Installer Log 6-May-2020.txt

Removed pikera mod and used RX580 worked perfectly.

After install switched out RX580 to 5700XT and re-added pikera. Runs fine.

vit9696 commented 4 years ago

The issue happens in GPUInfo framework (/System/Library/PrivateFrameworks/GPUInfo.framework/Versions/A/GPUInfo). get_gpu_EFIATYROM(__GPUWranglerGPU*, __CFDictionary*) function (__Z17get_gpu_EFIATYROMP16__GPUWranglerGPUP14__CFDictionary) is accessing ATY,Rom# property, which seems to be present but of different type. Basically the code looks as follows:

CFDataRef theData = (CFDataRef)GPUWranglerGPUCopyProperty(a1, 0LL, "ATY,Rom#");
if (theData != NULL) {
  /* other code */
  const char *str = (const char *)CFDataGetBytePtr(theData);
  size_t strLen = strlen(str); ///< crash here, str is 0x7c8
  /* other code */
}

The problem is that ATY,Rom# has CFStringRef type, and thus CFDataGetBytePtr returns some trash (0x7c8), which therefore crashes the whole thing.

The reason ATY,Rom# is set as data is because AMDRadeonX6000Framebuffer.kext in AMDRadeonX6000_AmdRadeonController::reportControllerProperties() function (__ZN34AMDRadeonX6000_AmdRadeonController26reportControllerPropertiesEv) actually sets it as a string when not present:

  if (fProvider->getProperty_1("ATY,Rom#") == NULL) {
    const char *romName = vbiosHandler->getRomName();
    if (romName == NULL)
      romName = "NOT-DETECTED-???";
    /* virtual bool setProperty(const char * aKey, const char * aString); */
    fProvider->setProperty("ATY,Rom#", romName);
  }

The string will not be present when a GPU without Apple EFI ROM is used and thus this code will be in use. Filed FB7694132.

As a temporary measure add the following kernel patch in OpenCore:

Find: 41 54 59 2C 52  6F 6D 23 00
Replace: 41 4D 44 2C 52  6F 6D 23 00
Identifier: com.apple.kext.AMDRadeonX6000Framebuffer
Count: 1
blazvizjak commented 4 years ago

I'm very new to this so sorry for a stupid question, but using ProperTree does this patch need to be written as data? What should I put for Mask and ReplaceMask?

blazvizjak commented 4 years ago

@peteha Were you successful in applying this patch? If so ... can you just paste that patch from config.plist maybe? Thank you!

yurique commented 4 years ago

I tried applying this patch: image

But it didn't help me. Getting the same Thread 0 Crashed at get_gpu_EFIATYROM(__GPUWranglerGPU*, __CFDictionary*) + 665 -> _platform_strlen + 18

yurique commented 4 years ago

@vit9696 sorry for @'ing you, but maybe you can help? :)

vit9696 commented 4 years ago

Try injecting ATY,Rom# via DeviceProperties with any value in this case.

yurique commented 4 years ago

@vit9696 thanks a LOT! This has worked :)

image

rutgerfarry commented 4 years ago

Hey guys I'm having the same issue with my 5700XT. @yurique how did you get the correct PciRoot(.... for your GPU? Am not sure how to get this value from Windows. Is this the right spot to be looking or am I totally off? Thanks! AMD Radeon RX 5700 XT Properties 5_24_2020 8_55_20 PM

vit9696 commented 4 years ago

Yes, that's the thing, just slightly awkwardly named, there are no commas between bytes in PCI, the separator is # instead of /, and the case is wrong. Windows always does things its own way I guess. It seems you have the following path:

PciRoot(0x0)/Pci(0x3,0x1)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)

I am not quite sure it points to the right device (e.g. the last Pci may be extra), and whether the byte order is correct in the second node (could be Pci(0x1,0x3) instead).

It is much easier to boot to macOS recovery and just run gfxutil to be honest.

yurique commented 4 years ago

@rutgerfarry I used the OpenCore Configurator for this.

It automatically added some properties, but put some weird character into the model value - OpenCore booted just fine, but ProperTree was not happy about it (I removed the symbol in text editor).

image

image

image

image

rutgerfarry commented 4 years ago

Thanks @vit9696 and @yurique! I'd been trying so many different fixes, but this is the one that actually ended up working. Would love to further understand what is happening here and perhaps add it to the Opencore Desktop Guide to help others having this issue... or would a fix like this be added to Whatevergreen in the future?

blazvizjak commented 4 years ago

@yurique or @rutgerfarry how did you get the AAPL, slot name value? I don't have a working hackintosh to run OpenCore Configurator on it :/

yurique commented 4 years ago

@blazvizjak I used OpenCore configurator, and it populated those three properties automatically when I selected the graphics card from the list of devices (AAPL,slot_name, device_type and model). I only added ATY,Rom# manually.

blazvizjak commented 4 years ago

OK since I can't runt OpenCore configurator on hackintosh machine I've booted to macOS recovery and ran gfxutil and copied value for GFX0 which was: PciRoot(0x0)/Pci(0x3,0x1)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0) and "deducted" AAPL,slot-name to be: Internal@0,3,1/0,0/0,0/0 which seemed to do the trick.

johanlantz commented 4 years ago

Sorry for posting on a closed thread but I am just ordering the pieces for my Hackintosh and currently the MSI AMD Radeon RX 5700 XT Mech might be the only card small enough to fit in the itx case I have selected.

So, I basically wonder:

  1. khronokernel added this under an MSI comment. Does this mean only MSI 5700 cards were affected?
  2. I understand from the comments from @blazvizjak and @yurique that a solution was found. Is this solution still a manual thing or has it been soved by weg or OS updates over the last 2 months?
  3. Is it correct that this only happens at install time, so using the igpu during installation and then pluggin in the card is also an option (unless this is already resolved)?

Thanks for any input, still learning here and trying to get the specs right 😄

mateossh commented 4 years ago

@johanlantz from what I understand:

  1. All AMD Navi from MSI are affected (RX 5000 series).
  2. I don't know what "weg" means, but a few days ago I was installing Catalina 10.15.5 and I had to apply patches from comments above (I have MSI RX 5700 MECH something).
  3. From my observations: 3.1 when you boot installer, it doesn't load AMDRadeonX6000Framebuffer.kext (I saw in OpenCore logs that kext patching failed while booting installer), but when you boot system from hard drive it does load and patch; 3.2 installer will crash in the end if you don't inject ATY,Rom#.

To be honest I use config with both kext patch and injecting ATY,Rom# and everything works fine

johanlantz commented 4 years ago

@mateossh Thank you so much for the answer. My parts are on the way and I had to select the exact same card as you have due to space reasons in the case.

I am just beginning to learn about opencore so this will be my first Hackintosh project.

So, I take it that with the fixes described here you got your installation working.

Do you mind if I ask you about your impressions of the MSI XT 5700 Mech otherwise in macOS? Does it work as you expected?

Toslim84 commented 4 years ago

Stuck on the same issue here (very first ryzentosh with MSI RX 5700 MECH). Btw can anyone help me on how can I found [ ATY,Rom# ] on windows platform?

vandroiy2013 commented 4 years ago

This is not a support forum! Locked.