vivekmiyani / OSX_GVT-D

Guide to pass iGPU to MacOS KVM guest.
94 stars 8 forks source link

Kernel Panic #4

Open vivekmiyani opened 2 years ago

vivekmiyani commented 2 years ago

EFI.zip kernel_panic.txt

Kernel panic when passthrough

_Originally posted by @Awnrt in https://github.com/vivekmiyani/OSX_GVT-D/issues/3#issuecomment-1003433978_

vivekmiyani commented 2 years ago

@Awnrt,

Replace

<key>PciRoot(0x1)/Pci(0x2,0x0)</key>

with

<key>PciRoot(0x0)/Pci(0x2,0x0)</key>
Awnrt commented 2 years ago

@vivekmiyani still a kernel panic

vivekmiyani commented 2 years ago

@Awnrt Can you try this workaround, And recompile the rom for your machine.?

Awnrt commented 2 years ago

@vivekmiyani I am running into this error when compiling

ubuntu@ubuntu:~/i915dev/i915ovmfPkg$ sudo ./build.sh 
Loading previous configuration from /home/ubuntu/i915dev/Conf/BuildEnv.sh
WORKSPACE: /home/ubuntu/i915dev
EDK_TOOLS_PATH: /home/ubuntu/i915dev/edk2/BaseTools
CONF_PATH: /home/ubuntu/i915dev/Conf
make: Entering directory '/home/ubuntu/i915dev/edk2/BaseTools'
make -C Source/C
make[1]: Entering directory '/home/ubuntu/i915dev/edk2/BaseTools/Source/C'
Attempting to detect HOST_ARCH from 'uname -m': x86_64
Detected HOST_ARCH of X64 using uname.
mkdir -p .
make -C Common
make[2]: Entering directory '/home/ubuntu/i915dev/edk2/BaseTools/Source/C/Common'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ubuntu/i915dev/edk2/BaseTools/Source/C/Common'
make -C BrotliCompress
make[2]: Entering directory '/home/ubuntu/i915dev/edk2/BaseTools/Source/C/BrotliCompress'
gcc  -c -I ./brotli/c/include -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -MD -fshort-wchar -fno-strict-aliasing -fwrapv -fno-delete-null-pointer-checks -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-unused-result -nostdlib -g -O2  brotli/c/dec/decode.c -o brotli/c/dec/decode.o
brotli/c/dec/decode.c:2033:41: error: argument 2 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 2033 |     size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from brotli/c/dec/decode.c:7:
./brotli/c/include/brotli/decode.h:204:19: note: previously declared as a variable length array ‘const uint8_t[*decoded_size]’ {aka ‘const unsigned char[*decoded_size]’}
  204 |     const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
brotli/c/dec/decode.c:2034:14: error: argument 4 of type ‘uint8_t *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 2034 |     uint8_t* decoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
In file included from brotli/c/dec/decode.c:7:
./brotli/c/include/brotli/decode.h:206:13: note: previously declared as a variable length array ‘uint8_t[encoded_size]’ {aka ‘unsigned char[encoded_size]’}
  206 |     uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [../Makefiles/footer.makefile:21: brotli/c/dec/decode.o] Error 1
make[2]: Leaving directory '/home/ubuntu/i915dev/edk2/BaseTools/Source/C/BrotliCompress'
make[1]: *** [GNUmakefile:77: BrotliCompress] Error 2
make[1]: Leaving directory '/home/ubuntu/i915dev/edk2/BaseTools/Source/C'
make: *** [GNUmakefile:19: Source/C] Error 2
make: Leaving directory '/home/ubuntu/i915dev/edk2/BaseTools'
Build environment: Linux-5.13.0-25-generic-x86_64-with-glibc2.34
Build start time: 19:10:53, Jan.17 2022

WORKSPACE        = /home/ubuntu/i915dev
PACKAGES_PATH    = /home/ubuntu/i915dev/edk2:/home/ubuntu/i915dev/edk2-platforms
EDK_TOOLS_PATH   = /home/ubuntu/i915dev/edk2/BaseTools
CONF_PATH        = /home/ubuntu/i915dev/Conf
PYTHON_COMMAND   = /usr/bin/python3.9

Processing meta-data Architecture(s)  = X64
Build target     = DEBUG
Toolchain        = GCC5

Active Platform          = /home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.dsc

FLASH_DEFINITION = None
.
Library instances of module [/home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.inf] [X64]:
    BaseLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseLib/BaseLib.inf
    BaseMemoryLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
    DebugLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
    DevicePathLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
    FrameBufferBltLib : /home/ubuntu/i915dev/edk2/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
    MemoryAllocationLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    PcdLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
    PciLib : /home/ubuntu/i915dev/edk2/OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
    UefiBootServicesTableLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
    UefiDriverEntryPoint : /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
    UefiLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiLib/UefiLib.inf
    MemEncryptSevLib : /home/ubuntu/i915dev/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf
    CacheMaintenanceLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
    CpuLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
    PrintLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf
    UefiRuntimeServicesTableLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
    PciCf8Lib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
    PciExpressLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
    IoLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
    SerialPortLib : /home/ubuntu/i915dev/edk2/PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
    DebugPrintErrorLevelLib : /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
DEPEX[i915ovmf] (+i915ovmf) = ['(', 'TRUE', ')']

DEPEX[i915ovmf] (+UefiDriverEntryPoint) = ['(', 'TRUE', ')', 'AND', '(', '{ 0x665E3FF6, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}', 'AND', '{ 0x26BACCB1, 0x6F42, 0x11D4, { 0xBC, 0xE7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}', 'AND', '{ 0x26BACCB2, 0x6F42, 0x11D4, { 0xBC, 0xE7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}', 'AND', '{ 0x1DA97072, 0xBDDC, 0x4B30, { 0x99, 0xF1, 0x72, 0xA0, 0xB5, 0x6F, 0xFF, 0x2A }}', 'AND', '{ 0x27CFAC87, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}', 'AND', '{ 0x27CFAC88, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}', 'AND', '{ 0xb7dfb4e1, 0x052f, 0x449f, { 0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 }}', 'AND', '{ 0xA46423E3, 0x4617, 0x49F1, { 0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 }}', 'AND', '{ 0x26BACCB3, 0x6F42, 0x11D4, { 0xBC, 0xE7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}', 'AND', '{ 0x6441F818, 0x6362, 0x4E44, { 0xB5, 0x70, 0x7D, 0xBA, 0x31, 0xDD, 0x24, 0x53 }}', 'AND', '{ 0x1E5668E2, 0x8481, 0x11D4, { 0xBC, 0xF1, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}', 'AND', '{ 0x665E3FF5, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}', ')']

 done!
Building ... /home/ubuntu/i915dev/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevLib.inf [X64]
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiLib/UefiLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf [X64]
Building ... /home/ubuntu/i915dev/edk2/OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf [X64]
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf [X64]
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf [X64]
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf [X64]
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseLib/BaseLib.inf [X64]
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf [X64]
Building ... /home/ubuntu/i915dev/edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf [X64]
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
Building ... /home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.inf [X64]
"gcc" -MMD -MF /home/ubuntu/i915dev/Build/i915ovmf/DEBUG_GCC5/X64/i915ovmfPkg/i915ovmf/OUTPUT/i915ovmf.obj.deps -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=i915ovmfStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -c -o /home/ubuntu/i915dev/Build/i915ovmf/DEBUG_GCC5/X64/i915ovmfPkg/i915ovmf/OUTPUT/./i915ovmf.obj -I/home/ubuntu/i915dev/i915ovmfPkg -I/home/ubuntu/i915dev/Build/i915ovmf/DEBUG_GCC5/X64/i915ovmfPkg/i915ovmf/DEBUG -I/home/ubuntu/i915dev/edk2/MdePkg -I/home/ubuntu/i915dev/edk2/MdePkg/Include -I/home/ubuntu/i915dev/edk2/MdePkg/Test/UnitTest/Include -I/home/ubuntu/i915dev/edk2/MdePkg/Include/X64 -I/home/ubuntu/i915dev/edk2/MdeModulePkg -I/home/ubuntu/i915dev/edk2/MdeModulePkg/Include -I/home/ubuntu/i915dev/edk2/OvmfPkg -I/home/ubuntu/i915dev/edk2/OvmfPkg/Include -I/home/ubuntu/i915dev/edk2/OvmfPkg/Csm/Include -I/home/ubuntu/i915dev/edk2-platforms/Drivers/OptionRomPkg -I/home/ubuntu/i915dev/edk2-platforms/Drivers/OptionRomPkg/Include /home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.c
Waiting for thread ending...(1)
/home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.c: In function ‘i915ControllerDriverStart’:
/home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.c:669:3: error: expected ‘,’ or ‘;’ before ‘UINTN’
  669 |   UINTN Pages = EFI_SIZE_TO_PAGES((MaxFbSize + 65535) & -65536);
      |   ^~~~~
/home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.c:671:51: error: ‘Pages’ undeclared (first use in this function)
  671 |       (EFI_PHYSICAL_ADDRESS)AllocateReservedPages(Pages);
      |                                                   ^~~~~
/home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.c:671:51: note: each undeclared identifier is reported only once for each function it appears in
make: *** [GNUmakefile:367: /home/ubuntu/i915dev/Build/i915ovmf/DEBUG_GCC5/X64/i915ovmfPkg/i915ovmf/OUTPUT/i915ovmf.obj] Error 1

build.py...
 : error 7000: Failed to execute command
    make tbuild [/home/ubuntu/i915dev/Build/i915ovmf/DEBUG_GCC5/X64/i915ovmfPkg/i915ovmf]

build.py...
 : error F002: Failed to build module
    /home/ubuntu/i915dev/i915ovmfPkg/i915ovmf.inf [X64, GCC5, DEBUG]

- Failed -
Build end time: 19:10:55, Jan.17 2022
Build total time: 00:00:01

btw I don't know if it is important but my ubuntu vm with igpu passthrough works Screenshot from 2022-01-17 18-59-14 Screenshot from 2022-01-17 19-03-21