Re: [PATCH 1/3] drm/connector: Convert DRM_MODE_COLORIMETRY to enum

2023-02-04 Thread kernel test robot
Hi Joshua,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm/drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes linus/master v6.2-rc6 next-20230203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Joshua-Ashton/drm-connector-Add-enum-documentation-to-drm_colorspace/20230203-100927
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20230203020744.30745-1-joshua%40froggi.es
patch subject: [PATCH 1/3] drm/connector: Convert DRM_MODE_COLORIMETRY to enum
config: x86_64-randconfig-a005 
(https://download.01.org/0day-ci/archive/20230204/202302041801.feskjrem-...@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project 
f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/146e4b57c07c6b478f24bb7cf2603ab123dcb6f2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Joshua-Ashton/drm-connector-Add-enum-documentation-to-drm_colorspace/20230203-100927
git checkout 146e4b57c07c6b478f24bb7cf2603ab123dcb6f2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/display/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/display/drm_hdmi_helper.c:108:3: error: use of undeclared 
>> identifier 'DRM_MODE_COLORIMETRY_NO_DATA'; did you mean 
>> 'DRM_MODE_COLORIMETRY_OPRGB'?
   [DRM_MODE_COLORIMETRY_NO_DATA] = HDMI_COLORIMETRY_NO_DATA,
^~~~
DRM_MODE_COLORIMETRY_OPRGB
   include/drm/drm_connector.h:441:2: note: 'DRM_MODE_COLORIMETRY_OPRGB' 
declared here
   DRM_MODE_COLORIMETRY_OPRGB,
   ^
   drivers/gpu/drm/display/drm_hdmi_helper.c:115:33: warning: initializer 
overrides prior initialization of this subobject [-Winitializer-overrides]
   [DRM_MODE_COLORIMETRY_OPRGB] = HDMI_COLORIMETRY_OPRGB,
  ^~
   drivers/gpu/drm/display/drm_hdmi_helper.c:100:34: note: expanded from macro 
'HDMI_COLORIMETRY_OPRGB'
   #define HDMI_COLORIMETRY_OPRGB  (C(3) | EC(4) | ACE(0))
   ^~~
   drivers/gpu/drm/display/drm_hdmi_helper.c:108:35: note: previous 
initialization is here
   [DRM_MODE_COLORIMETRY_NO_DATA] = HDMI_COLORIMETRY_NO_DATA,
^~~~
   drivers/gpu/drm/display/drm_hdmi_helper.c:93:35: note: expanded from macro 
'HDMI_COLORIMETRY_NO_DATA'
   #define HDMI_COLORIMETRY_NO_DATA0x0
   ^~~
   1 warning and 1 error generated.


vim +108 drivers/gpu/drm/display/drm_hdmi_helper.c

4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  106  
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  107  static const u32 
hdmi_colorimetry_val[] = {
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21 @108   
[DRM_MODE_COLORIMETRY_NO_DATA] = HDMI_COLORIMETRY_NO_DATA,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  109   
[DRM_MODE_COLORIMETRY_SMPTE_170M_YCC] = HDMI_COLORIMETRY_SMPTE_170M_YCC,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  110   
[DRM_MODE_COLORIMETRY_BT709_YCC] = HDMI_COLORIMETRY_BT709_YCC,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  111   
[DRM_MODE_COLORIMETRY_XVYCC_601] = HDMI_COLORIMETRY_XVYCC_601,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  112   
[DRM_MODE_COLORIMETRY_XVYCC_709] = HDMI_COLORIMETRY_XVYCC_709,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  113   
[DRM_MODE_COLORIMETRY_SYCC_601] = HDMI_COLORIMETRY_SYCC_601,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  114   
[DRM_MODE_COLORIMETRY_OPYCC_601] = HDMI_COLORIMETRY_OPYCC_601,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  115   
[DRM_MODE_COLORIMETRY_OPRGB] = HDMI_COLORIMETRY_OPRGB,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  116   
[DRM_MODE_COLORIMETRY_BT2020_CYCC] = HDMI_COLORIMETRY_BT2020_CYCC,
4fc8cb47fcfdc93 Thomas Zimmermann 2022-04-21  117   
[DRM_MODE_COLORIMETRY_BT2020_RGB] = HDMI_COLORIMETRY_BT2020_RGB,
4fc8cb47fcfd

Patched macOS kexts start Raven iGPU, but GPUVM page fault occurs on the first GFX and SDMA IB submitted by WindowServer. Help?

2023-02-04 Thread Visual (VisualDevelopment)
Table of Contents:
1. Introduction
2. History of WhateverRed
2.1. Wrapping/Redirecting kext logic with Lilu
2.2. VTables and our Reverse Engineering
2.3. Debugging with a black screen
2.4. Firmware injection and other HWLibs troubles
2.5. AMDRadeonX5000 Video Decoding/Encoding and SDMA engine mismatches
2.6. SDMA0 power on via SMC
2.7. SDMA0 Accel channel skipping memory mapping commands
3. Current issue
3.1. VM Protection Faults
3.2. Analysis of the diagnostic dump
3.3. A deeper dive into the protection fault
4. What we know so far
4.1. The VM Blocks and the PDEs/PTEs
4.2. The VM registers
4.3. The PDE/PTE flags
4.4. The translate_further mode
4.5. The VMPTConfig in AMD kexts
4.6. How the entryCount is determined on AMDGPU
4.7. The GPUVM settings on AMDRadeonX5000 vs. AMDGPU
5. What we have tried
5.1. PTE/PDE flags experimentations
5.2. Experimentation with VMPTConfig and related settings
6. How you can help
6.1. Unanswered questions
6.2. Ways to contact us


-- 1. Introduction --
Hello everyone.
We are a small team of 3 people trying to get Hackintoshes (PCs running macOS) 
with AMD (Vega) iGPUs (specifically Raven/Raven2/Renoir and their derivatives, 
such as Picasso) to have graphics acceleration on AMD laptops.
To be precise, we are fixing broken and/or missing logic via patching the 
existing kexts (currently AMDRadeonX5000 for GCN 5 (GFX 9) and AMDRadeonX6000 
for VCN (GFX 10), AMDRadeonX6000Framebuffer for DCN instead of 
AMD1Controller since it is DCE).

The team members are:
- Visual, the Project Owner, is a Greek 17 year old CS student with extensive 
knowledge on Operating System development. He writes most of the kext code and 
provides insight on OS and Driver behaviour when possible.
- NyanCatTW1, the Automation Engineer, is a 17-year-old student who lives in 
Taiwan. The NYCU CSIE admitted him last year. He also does most of the Reverse 
Engineering.
- Allen Chen, the tester with a Renoir laptop, perseverance and some ideas; 
helps with the effort occasionally, currently striving to become NyanCatTW1's 
classmate again, as they were six years ago

Our kext, WhateverRed has successfully gotten the aforesaid kexts to 
deterministically power up and start the IPs/MEs in the GPU, such as GFX and 
SDMA. Attached are partial highlights of a dmesg log from the main testing 
system:

[   27.351538]: netdbg: Disabled via boot arg
[   27.351543]: rad: patching device type table
[   27.351558]: rad: Automagically getting VBIOS from VFCT table
...
[   27.505319]: [3:0:0] [Accel] >>> Calling TTL::initialize()
[   27.505331]: [AMD INFO] TTL Interface: Boot mode Normal.
...
[   27.649777]: [3:0:0] [Accel] <<< TTL::initialize() Completed 
successfully.
...
[   27.662027]: Accelerator successfully registered with controller.
...
[   29.346963]: rad: _SmuRaven_Initialize returned 0x1
[   29.346967]: rad: Sending PPSMC_MSG_PowerUpSdma (0xE) to the SMC
[   29.347052]: rad: _Raven_SendMsgToSmcWithParameter returned 0x1
...
[   29.365343]: rad: powerUpHW: this = 0xff935ca3d000
[   29.377219]: rad: powerUpHW returned 1
[   29.377228]: [3:0:0]: Controller is enabled, finish initialization
[   29.424252]: Adding AGDP mode validate property
[   29.425160]: kPEDisableScreen 1
[   29.425685]: [3:0:0] [FB:0] AmdRadeonFramebuffer::setCursorImage() !!! 
Driver is offline.
[   29.425695]: [3:0:0] [FB:1] AmdRadeonFramebuffer::setCursorImage() !!! 
Driver is offline.


The project is hosted on GitHub (https://github.com/NootInc/WhateverRed) with 
135 stargazers as of 2023-02-04.

Currently, everything seems to go smoothly up to the point WindowServer tries 
-and fails- to make use of the iGPU (See Chapter 3 for details)
We first ran into the issue on 2022-11-27, but as of 2023-02-04, we haven't 
been able to find a way to fix it.
This is why we're asking for help on the amd-gfx mailing list. However, 
considering the complexity of both the project and the issue, we suspect it 
would be necessary to give you a brief review of the project's history, the 
issue we currently are facing, everything we know about the issue, and what we 
have tried first.
It'll be a long ride (about 25 minutes) so feel free to skip right to Chapter 6 
if you don't have the time.

-- 2. History of WhateverRed --
For your interest, we have documented a large portion of our previous work 
here. But feel free to skip to the problem itself (Chapter 3) in case that's 
more practical for you.


-- 2.1 Wrapping/Redirecting kext logic with Lilu --
First of all, it is quite probable that you are wondering how we are even 
debugging these kexts, even modifying them; the answer is Lilu. Lilu allows you 
to hook symbols and replace them with your own logic, and also save the 
original to a different place. This is done possible by looking for the symbol, 
saving the original logic, 

Re: [PATCH 1/3] drm/connector: Convert DRM_MODE_COLORIMETRY to enum

2023-02-04 Thread kernel test robot
Hi Joshua,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm/drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes linus/master v6.2-rc6 next-20230203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Joshua-Ashton/drm-connector-Add-enum-documentation-to-drm_colorspace/20230203-100927
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20230203020744.30745-1-joshua%40froggi.es
patch subject: [PATCH 1/3] drm/connector: Convert DRM_MODE_COLORIMETRY to enum
config: arc-randconfig-r034-20230204 
(https://download.01.org/0day-ci/archive/20230204/202302041649.dswc7gnr-...@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/146e4b57c07c6b478f24bb7cf2603ab123dcb6f2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Joshua-Ashton/drm-connector-Add-enum-documentation-to-drm_colorspace/20230203-100927
git checkout 146e4b57c07c6b478f24bb7cf2603ab123dcb6f2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=arc SHELL=/bin/bash drivers/gpu/drm/display/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/display/drm_hdmi_helper.c:108:10: error: 
>> 'DRM_MODE_COLORIMETRY_NO_DATA' undeclared here (not in a function); did you 
>> mean 'DRM_MODE_COLORIMETRY_OPRGB'?
 108 | [DRM_MODE_COLORIMETRY_NO_DATA] = HDMI_COLORIMETRY_NO_DATA,
 |  ^~~~
 |  DRM_MODE_COLORIMETRY_OPRGB
>> drivers/gpu/drm/display/drm_hdmi_helper.c:108:10: error: array index in 
>> initializer not of integer type
   drivers/gpu/drm/display/drm_hdmi_helper.c:108:10: note: (near initialization 
for 'hdmi_colorimetry_val')


vim +108 drivers/gpu/drm/display/drm_hdmi_helper.c

4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  106  
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  107  static const u32 
hdmi_colorimetry_val[] = {
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21 @108
[DRM_MODE_COLORIMETRY_NO_DATA] = HDMI_COLORIMETRY_NO_DATA,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  109
[DRM_MODE_COLORIMETRY_SMPTE_170M_YCC] = HDMI_COLORIMETRY_SMPTE_170M_YCC,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  110
[DRM_MODE_COLORIMETRY_BT709_YCC] = HDMI_COLORIMETRY_BT709_YCC,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  111
[DRM_MODE_COLORIMETRY_XVYCC_601] = HDMI_COLORIMETRY_XVYCC_601,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  112
[DRM_MODE_COLORIMETRY_XVYCC_709] = HDMI_COLORIMETRY_XVYCC_709,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  113
[DRM_MODE_COLORIMETRY_SYCC_601] = HDMI_COLORIMETRY_SYCC_601,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  114
[DRM_MODE_COLORIMETRY_OPYCC_601] = HDMI_COLORIMETRY_OPYCC_601,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  115
[DRM_MODE_COLORIMETRY_OPRGB] = HDMI_COLORIMETRY_OPRGB,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  116
[DRM_MODE_COLORIMETRY_BT2020_CYCC] = HDMI_COLORIMETRY_BT2020_CYCC,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  117
[DRM_MODE_COLORIMETRY_BT2020_RGB] = HDMI_COLORIMETRY_BT2020_RGB,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  118
[DRM_MODE_COLORIMETRY_BT2020_YCC] = HDMI_COLORIMETRY_BT2020_YCC,
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  119  };
4fc8cb47fcfdc9 Thomas Zimmermann 2022-04-21  120  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


Re: [PATCH 3/3] drm/connector: Deprecate split for BT.2020 in drm_colorspace enum

2023-02-04 Thread kernel test robot
Hi Joshua,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm/drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes linus/master v6.2-rc6 next-20230203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Joshua-Ashton/drm-connector-Add-enum-documentation-to-drm_colorspace/20230203-100927
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20230203020744.30745-3-joshua%40froggi.es
patch subject: [PATCH 3/3] drm/connector: Deprecate split for BT.2020 in 
drm_colorspace enum
reproduce:
# 
https://github.com/intel-lab-lkp/linux/commit/14174503e23d2174ba6089fb4090778513cd202b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Joshua-Ashton/drm-connector-Add-enum-documentation-to-drm_colorspace/20230203-100927
git checkout 14174503e23d2174ba6089fb4090778513cd202b
make menuconfig
# enable CONFIG_COMPILE_TEST, CONFIG_WARN_MISSING_DOCUMENTS, 
CONFIG_WARN_ABI_ERRORS
make htmldocs

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> Documentation/gpu/drm-kms:417: ./include/drm/drm_connector.h:479: WARNING: 
>> Definition list ends without a blank line; unexpected unindent.

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests