Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Linux 6.7 drivers #332

Open
wants to merge 1,326 commits into
base: master
Choose a base branch
from

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Jan 1, 2025

This is the backport of the DRM drivers from Linux 6.7.

Progress:

Changes in Linux 6.7

You can read this Phoronix article to learn about the changes in the DRM drivers in Linux 6.7:
https://www.phoronix.com/news/Linux-6.7-DRM-Graphics-Drivers

Patches to linuxkpi

This update depends on the following patches to linuxkpi in FreeBSD. They have not been submitted to Phabricator for review yet.

These patches are maintained in the following repository and branch:
https://github.com/dumbbell/freebsd-src/tree/drm-related-linuxkpi-changes

Firmware updates

No updates to firmwares have been prepared as of this writing.

How to test

You need to run a recent FreeBSD 15-CURRENT to test it.

Here are some instructions:

  1. You need to checkout the FreeBSD src branch I mentionned, linuxkpi-updates-for-drm, and compile a kernel from that branch:

    git clone -b drm-related-linuxkpi-changes https://github.com/dumbbell/freebsd-src.git
    cd freebsd-src
    make -j8 buildkernel DEBUG_FLAGS=-g
    
    # This installs the kernel under another name, `kernel.drm`. Thus, you keep the default kernel
    # in case of trouble.
    sudo make installkernel DEBUG_FLAGS=-g INSTKERNNAME=kernel.drm
  2. You need to checkout the branch referenced in this pull request and compile it:

    git clone -b update-to-linux-6.7 https://github.com/dumbbell/drm-kmod.git
    cd drm-kmod
    make -j8 DEBUG_FLAGS=-g SYSDIR=/path/to/freebsd-src-from-step1/sys
    sudo make install DEBUG_FLAGS=-g SYSDIR=/path/to/freebsd-src-from-step1/sys KMODDIR=/boot/kernel.drm
    
  3. Load the relevant driver(s) as you usually do.

fdavid-amd and others added 30 commits January 1, 2025 17:31
On gfx943 APU, EXT_COHERENT should give MTYPE_CC for local and
MTYPE_UC for nonlocal memory.

On NUMA systems, local memory gets the local mtype, set by an
override callback. If EXT_COHERENT is set, memory will be set as
MTYPE_UC by default, with local memory MTYPE_CC.

Add an option in the override function for this case, and
add a check to ensure it is not used on UNCACHED memory.

V2: Combined APU and NUMA code into one patch
V3: Fixed a potential nullptr in amdgpu_vm_bo_update

Signed-off-by: David Francis <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
…aded

avoid to disable gfxhub interrupt when driver is unloaded on gmc 11

Signed-off-by: Kenneth Feng <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Some of the fields that are handled by drm_show_fdinfo() crept back in
when rebasing the patch.  Remove them again.

Fixes: 376c25f8ca47 ("drm/amdgpu: Switch to fdinfo helper")
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: <[email protected]>
Co-developed-by: Umio Yasuno <[email protected]>
Signed-off-by: Umio Yasuno <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Remove unused variables from amdgpu_show_fdinfo

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Umio Yasuno <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
The newly added memset() causes a warning for some reason I could not
figure out:

In file included from arch/x86/include/asm/string.h:3,
                 from drivers/gpu/drm/i915/gt/intel_rc6.c:6:
In function 'rc6_res_reg_init',
    inlined from 'intel_rc6_init' at drivers/gpu/drm/i915/gt/intel_rc6.c:610:2:
arch/x86/include/asm/string_32.h:195:29: error: '__builtin_memset' writing 16 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  195 | #define memset(s, c, count) __builtin_memset(s, c, count)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rc6.c:584:9: note: in expansion of macro 'memset'
  584 |         memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg));
      |         ^~~~~~
In function 'intel_rc6_init':

Change it to an normal initializer and an added memcpy() that does not have
this problem.

Fixes: 4bb9ca7ee074 ("drm/i915/mtl: C6 residency and C state type for MTL SAMedia")
Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Jani Nikula <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 0520b30b219053cd789909bca45b3c486ef3ee09)
Signed-off-by: Jani Nikula <[email protected]>
gen8_ggtt_invalidate() is only needed for limited set of platforms
where GGTT is mapped as WC. This was added as way to fix WC based GGTT in
commit 0f9b91c754b7 ("drm/i915: flush system agent TLBs on SNB") and
there are no reference in HW docs that forces us to use this on non-WC
backed GGTT.

This can also cause unwanted side-effects on XE_HP platforms where
GFX_FLSH_CNTL_GEN6 is not valid anymore.

v2: Add a func to detect wc ggtt detection (Ville)
v3: Improve commit log and add reference commit (Daniel)

Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
Cc: Rodrigo Vivi <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Jonathan Cavitt <[email protected]>
Cc: John Harrison <[email protected]>
Cc: Andi Shyti <[email protected]>
Cc: Ville Syrjälä <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: <[email protected]> # v6.2+
Suggested-by: Matt Roper <[email protected]>
Signed-off-by: Nirmoy Das <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 81de3e296b10a13e5c9f13172825b0d8d9495c68)
Signed-off-by: Jani Nikula <[email protected]>
eDP specification supports HBR3 link rate since v1.4a. Moreover,
C10 phy can support HBR3 link rate for both DP and eDP. Therefore,
do not clamp the supported rates for eDP at 6.75Gbps.

Cc: <[email protected]>

BSpec: 70073 74224

Signed-off-by: Chaitanya Kumar Borah <[email protected]>
Reviewed-by: Mika Kahola <[email protected]>
Signed-off-by: Mika Kahola <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit a3431650f30a94b179d419ef87c21213655c28cd)
Signed-off-by: Jani Nikula <[email protected]>
When i915 perf interface is not available dereferencing it will lead to
NULL dereferences.

As returning -ENOTSUPP is pretty clear return when perf interface is not
available.

Fixes: 2fec539112e8 ("i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call")
Suggested-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Harshit Mogalapalli <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Cc: <[email protected]> # v6.0+
Signed-off-by: Tvrtko Ursulin <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
[tursulin: added stable tag]
(cherry picked from commit 36f27350ff745bd228ab04d7845dfbffc177a889)
Signed-off-by: Jani Nikula <[email protected]>
Not all platforms support RAS.

Fixes: 73582be11ac8 ("drm/amdgpu: bypass RAS error reset in some conditions")
Signed-off-by: Tao Zhou <[email protected]>
Reviewed-by: Yang Wang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Fixes warnings:

drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c:286:45:
warning: '%s' directive output may be truncated writing up to 29 bytes
into a region of size 23 [-Wformat-truncation=]
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c:286:52:
warning: '%s' directive output may be truncated writing up to 29 bytes
into a region of size 23 [-Wformat-truncation=]
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c:72:45: warning:
'%s' directive output may be truncated writing up to 29 bytes into a
region of size 23 [-Wformat-truncation=]
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c:72:52: warning:
'%s' directive output may be truncated writing up to 29 bytes into a
region of size 23 [-Wformat-truncation=]

Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Yang Wang <[email protected]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Drop checking deferred error which can be handled by poison
consumption.

Signed-off-by: Candice Li <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
gpu tlb flush is skipped if reset sem is held, it makes
mes_self_test fail since it involves add_hw_queue/remove_hw_queue
which needs tlb flush functional. Remove mes_self_test in gpu
recover sequence.

This patch is to fix the recover failure in gfx11.

[ 1831.768292] [drm] ring sdma_32769.3.3 was added
[ 1831.768313] [drm] ring gfx_32769.1.1 ib test pass
[ 1831.768337] [drm] ring compute_32769.2.2 ib test pass
[ 1831.768399] amdgpu 0000:c2:00.0: amdgpu: [gfxhub] page fault (src_id:0 ring:24 vmid:8 pasid:32769, for process  pid 0 thread  pid 0)
[ 1831.768434] amdgpu 0000:c2:00.0: amdgpu:   in page starting at address 0x0000aec200000000 from client 10
[ 1831.768456] amdgpu 0000:c2:00.0: amdgpu: GCVM_L2_PROTECTION_FAULT_STATUS:0x00800A30
[ 1831.768473] amdgpu 0000:c2:00.0: amdgpu:      Faulty UTCL2 client ID: CPC (0x5)
[ 1831.768489] amdgpu 0000:c2:00.0: amdgpu:      MORE_FAULTS: 0x0
[ 1831.768501] amdgpu 0000:c2:00.0: amdgpu:      WALKER_ERROR: 0x0
[ 1831.768513] amdgpu 0000:c2:00.0: amdgpu:      PERMISSION_FAULTS: 0x3
[ 1831.768521] amdgpu 0000:c2:00.0: amdgpu:      MAPPING_ERROR: 0x0
[ 1831.768529] amdgpu 0000:c2:00.0: amdgpu:      RW: 0x0
[ 1831.931229] amdgpu 0000:c2:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring sdma_32769.3.3 test failed (-110)
[ 1832.062917] [drm:mes_v11_0_submit_pkt_and_poll_completion.constprop.0 [amdgpu]] *ERROR* MES failed to response msg=3
[ 1832.063107] [drm:amdgpu_mes_remove_hw_queue [amdgpu]] *ERROR* failed to remove hardware queue, queue id = 3

Fixes: e2e3788850b9 ("drm/amdgpu: rework lock handling for flush_tlb v2")
Reported-by: Li Ma <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Yifan Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
fix the high voltage and temperature issue after the driver is unloaded on smu 13.0.0,
smu 13.0.7 and smu 13.0.10
v2 - fix the code format and make sure it is used on the unload case only.

Signed-off-by: Kenneth Feng <[email protected]>
Reviewed-by: Yang Wang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
[why]
If driver does not set unmap latency for KIQ, the default value of KIQ
unmap latency is zero. When do unmap queue, KIQ will return that almost
immediately after receiving unmap command. So, the queue status will be
saved to MQD incorrectly or lost in some chance.

[how]
Set unmap latency when do kiq set resources. The unmap latency is set to
be 1 second that is synchronized with Windows driver.

Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Tong Liu01 <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
The version can't be queried from discovery table.

Signed-off-by: Tao Zhou <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
If the size returned by drm buddy allocator is higher than
the required size, we take the higher size to calculate
the buffer start address. This is required if we couldn't
trim the buffer to the requested size. This will fix the
display corruption issue on APU's which has limited VRAM
size.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2859
Fixes: 0a1844bf0b53 ("drm/buddy: Improve contiguous memory allocation")
Signed-off-by: Arunpravin Paneer Selvam <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
MACO only works if BACO is supported

Signed-off-by: Ma Jun <[email protected]>
Reviewed-by: Kenneth Feng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected] # 6.1.x
remove unused macro HW_REV

Signed-off-by: Yang Wang <[email protected]>
Reviewed-by: Kenneth Feng <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Return 0 as the default min power limit for the asics use
powerplay.

Signed-off-by: Ma Jun <[email protected]>
Reviewed-by: Kenneth Feng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
GFX doorbell range should be set after flr otherwise the gfx doorbell
range will be overlap with MEC.

v2: remove "amdgpu_sriov_vf" and "amdgpu_in_reset" check, and add grbm
select for the case of 2 gfx rings.

Signed-off-by: Lin.Cao <[email protected]>
Acked-by: ZhenGuo Yin <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Switch from mode-1 reset to mode-2 for poison consumption.

Signed-off-by: Tao Zhou <[email protected]>
Reviewed-by: Stanley.Yang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Since they were moved to VRAM, we need to use the IO
variants of memcpy.

Fixes: 1cfb4d612127 ("drm/amdgpu: put MQDs in VRAM")
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
The ATRM ACPI method is for fetching the dGPU vbios rom
image on laptops and all-in-one systems.  It should not be
used for external add in cards.  If the dGPU is thunderbolt
connected, don't try ATRM.

v2: pci_is_thunderbolt_attached only works for Intel.  Use
    pdev->external_facing instead.
v3: dev_is_removable() seems to be what we want

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
It's only valid on Intel systems with the Intel VSEC.
Use dev_is_removable() instead.  This should do the right
thing regardless of the platform.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
For pptable structs that use flexible array sizes, use flexible arrays.

Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2039926
Reviewed-by: Mario Limonciello <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Reported by coccinelle, the following patch will move the
following 1 element arrays to flexible arrays.

drivers/gpu/drm/radeon/atombios.h:5523:32-48: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:5545:32-48: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:5461:34-44: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4447:30-40: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4236:30-41: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7095:28-45: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:3896:27-37: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:5443:16-25: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:5454:34-43: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4603:21-32: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4628:32-46: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:6285:29-39: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4296:30-36: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4756:28-36: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:4064:22-35: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7327:9-24: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7332:32-53: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7362:26-41: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7369:29-44: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7349:24-32: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/radeon/atombios.h:7355:27-35: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: José Pekkarinen <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
[Why] During suspend, if GFX DPM is enabled and GFXOFF feature is
enabled the system may get hung. So, it is suggested to disable
GFXOFF feature during suspend and enable it after resume.

[How] Update the code to disable GFXOFF feature during suspend and enable
it after resume.

[  311.396526] amdgpu 0000:03:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000
[  311.396530] amdgpu 0000:03:00.0: amdgpu: Fail to disable dpm features!
[  311.396531] [drm:amdgpu_device_ip_suspend_phase2 [amdgpu]] *ERROR* suspend of IP block <smu> failed -62

Acked-by: Yang Wang <[email protected]>
Reviewed-by: Kenneth Feng <[email protected]>
Signed-off-by: Perry Yuan <[email protected]>
Signed-off-by: Kun Liu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
AMD dGPUs have integrated FW that runs as soon as the
device gets power and initializes the board (determines
the amount of memory, provides configuration details to
the driver, etc.).  For direct PCIe attached cards this
happens as soon as power is applied and normally completes
well before the OS has even started loading.  However, with
hotpluggable ports like USB4, the driver needs to wait for
this to complete before initializing the device.

This normally takes 60-100ms, but could take longer on
some older boards periodically due to memory training.

Retry for up to a second.  In the non-hotplug case, there
should be no change in behavior and this should complete
on the first try.

v2: adjust test criteria
v3: adjust checks for the masks, only enable on removable devices
v4: skip bif_fb_en check

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
This was fixed in PMFW before launch and is no longer
required.

Reviewed-by: Yang Wang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected] # 6.1.x
Issues were reported with commit 1cfb4d612127
("drm/amdgpu: put MQDs in VRAM") on an ADLINK Ampere
Altra Developer Platform (AVA developer platform).

Various ARM systems seem to have problems related
to PCIe and MMIO access.  In this case, I'm not sure
if this is specific to the ADLINK platform or ARM
in general.  Seems to be some coherency issue with
VRAM.  For now, just don't put MQDs in VRAM on ARM.

Link: https://lists.freedesktop.org/archives/amd-gfx/2023-October/100453.html
Fixes: 1cfb4d612127 ("drm/amdgpu: put MQDs in VRAM")
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
misyltoad and others added 4 commits January 1, 2025 17:31
…isplays without PSR

The check for sending the vsc infopacket to the display was gated behind
PSR (Panel Self Refresh) being enabled.

The vsc infopacket also contains the colorimetry (specifically the
container color gamut) information for the stream on modern DP.

PSR is typically only supported on mobile phone eDP displays, thus this
was not getting sent for typical desktop monitors or TV screens.

This functionality is needed for proper HDR10 functionality on DP as it
wants BT2020 RGB/YCbCr for the container color space.

Cc: [email protected]
Cc: Harry Wentland <[email protected]>
Cc: Xaver Hugl <[email protected]>
Cc: Melissa Wen <[email protected]>
Fixes: 15f9dfd545a1 ("drm/amd/display: Register Colorspace property for DP and HDMI")
Tested-by: Simon Berz <[email protected]>
Tested-by: Xaver Hugl <[email protected]>
Signed-off-by: Joshua Ashton <[email protected]>
Signed-off-by: Hamza Mahfooz <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Expose sysfs entry mem_busy_percent for GC version
9.4.3 APU system

Signed-off-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Add new gpu_metrics_v1_5 to acquire vcn/jpeg activity
& pcie nak error counters

Signed-off-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Reviewed-by: Le Ma <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Use gpu_metrics_v1_5 for SMUv13.0.6 to fill
gpu metric info

Signed-off-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Reviewed-by: Le Ma <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
@lin72h
Copy link

lin72h commented Jan 1, 2025

Does this mean I can use Intel external GPU? Thank you, as always, for improving the DRM stack.

@dumbbell
Copy link
Member Author

dumbbell commented Jan 1, 2025

I have no idea :-) Do you have a unit to test with?

I only test with an Intel 12th gen iGPU and a Radeon RX 6700 XT dGPU.

@lin72h
Copy link

lin72h commented Jan 2, 2025

@dumbbell Yes, I've ordered an A310 and a DG1 card. They should arrive in a few days. I'll test them and give you some feedback then.

@kenrap
Copy link

kenrap commented Jan 2, 2025

@wulf7 Would these updates add GUC/HUC support for DG2 cards?

@wulf7
Copy link
Contributor

wulf7 commented Jan 2, 2025

@wulf7 Would these updates add GUC/HUC support for DG2 cards?

Intel MEI and PXP drivers are still not ported

@wulf7
Copy link
Contributor

wulf7 commented Jan 2, 2025

Does this mean I can use Intel external GPU? Thank you, as always, for improving the DRM stack.

Probably vmmap_pfn() implementation is required. You may try patch from #315.
Unfortunatelly it didn't help for #315.

@emaste
Copy link
Member

emaste commented Jan 9, 2025

On a Dell Raptor Lake system the driver loads and I can start X but video is corrupted:
image
Zoomed in:
image

@lutzbichler
Copy link

Maybe we (still) need this? We have it in 6.6, but not in this PR.

intel_color.c.txt

@dumbbell
Copy link
Member Author

We don’t have this patch in the master branch (which is at 6.6). Where does this patch come from?

@emaste
Copy link
Member

emaste commented Jan 12, 2025

Maybe we (still) need this? We have it in 6.6, but not in this PR.

intel_color.c.txt

Yes that fixes it

@lutzbichler
Copy link

We don’t have this patch in the master branch (which is at 6.6). Where does this patch come from?

It is probably not the real fix to the problem, but the removal of:

/* FIXME DSB has issues loading LUTs, disable it for now */
return;

in intel_color_prepare_commit (737e4a7) is where I landed when I bisected (my attempt) to update to 6.7. So it seems the fix for Linux alone does not fix it for FreeBSD.

@emaste
Copy link
Member

emaste commented Jan 12, 2025

The FIXME comes from f327ba2 and was removed in 737e4a7

@emaste
Copy link
Member

emaste commented Jan 13, 2025

Panic on Framework Ultra 1 https://termbin.com/snmo

CPU: Intel(R) Core(TM) Ultra 5 125H (2995.20-MHz K8-class CPU)

drmn0: __drm_fb_helper_find_sizes: test CRTC 0 primary plane
drmn0: intelfb_create: no BIOS fb, allocating a new one
panic: Assertion base != 0 failed at /home/user/freebsd/sys/modules/drm-kmod/drivers/gpu/drm/drm_os_freebsd.c:86
cpuid = 6
time = 1736772151
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe010ac92490
vpanic() at vpanic+0x136/frame 0xfffffe010ac925c0
panic() at panic+0x43/frame 0xfffffe010ac92620
register_fictitious_range() at register_fictitious_range+0xc9/frame 0xfffffe010ac92650
intelfb_create() at intelfb_create+0x542/frame 0xfffffe010ac92760
__drm_fb_helper_initial_config_and_unlock() at __drm_fb_helper_initial_config_and_unlock+0x5b2/frame 0xfffffe010ac92800
intel_fbdev_initial_config_async() at intel_fbdev_initial_config_async+0x1a/frame 0xfffffe010ac92820
intel_display_driver_register() at intel_display_driver_register+0x63/frame 0xfffffe010ac92860
i915_driver_register() at i915_driver_register+0x65/frame 0xfffffe010ac92880
i915_driver_probe() at i915_driver_probe+0xb06/frame 0xfffffe010ac928c0
linux_pci_attach_device() at linux_pci_attach_device+0x43f/frame 0xfffffe010ac92910
device_attach() at device_attach+0x42b/frame 0xfffffe010ac92960
bus_generic_driver_added() at bus_generic_driver_added+0xa0/frame 0xfffffe010ac92980
devclass_driver_added() at devclass_driver_added+0x2f/frame 0xfffffe010ac929b0
devclass_add_driver() at devclass_add_driver+0x138/frame 0xfffffe010ac929f0
_linux_pci_register_driver() at _linux_pci_register_driver+0xc1/frame 0xfffffe010ac92a20
i915kms_evh() at i915kms_evh+0x28e/frame 0xfffffe010ac92a50
module_register_init() at module_register_init+0xb6/frame 0xfffffe010ac92a80
linker_load_module() at linker_load_module+0xc79/frame 0xfffffe010ac92d80
kern_kldload() at kern_kldload+0x16e/frame 0xfffffe010ac92dd0
sys_kldload() at sys_kldload+0x59/frame 0xfffffe010ac92e00
amd64_syscall() at amd64_syscall+0x163/frame 0xfffffe010ac92f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe010ac92f30
--- syscall (304, FreeBSD ELF64, kldload), rip = 0x2acd570fbb9a, rsp = 0x2acd5417b6f8, rbp = 0x2acd5417bc70 ---

(For me the 6.6 port did not work on this machine, so no info on whether this is a regression.)

@lutzbichler
Copy link

Isn´t this the same as #324?

@emaste
Copy link
Member

emaste commented Jan 13, 2025

Isn´t this the same as #324?

It looks like it, yes - will test shortly.

@dumbbell
Copy link
Member Author

We don’t have this patch in the master branch (which is at 6.6). Where does this patch come from?

It is probably not the real fix to the problem, but the removal of:

/* FIXME DSB has issues loading LUTs, disable it for now */
return;

Ok, I see. I was looking for a FreeBSD-specific change and missed the fact that it was an upstream change. Thanks!

Christian König and others added 3 commits January 13, 2025 19:19
Use managed memory allocation for this. That allows us to not keep
track of all the files any more.

v2: keep drm_debugfs_cleanup(), but rename to drm_debugfs_unregister(),
    we still need to cleanup the symlink

Signed-off-by: Christian König <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Andi Shyti <[email protected]>
Remove a few hidden compound_head() calls by converting the returned page
to a folio once and using the folio APIs.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
If the shared memory object is larger than the DRM object that it backs,
we can overrun the page array.  Limit the number of pages we install
from each folio to prevent this.

Signed-off-by: "Matthew Wilcox (Oracle)" <[email protected]>
Reported-by: Oleksandr Natalenko <[email protected]>
Tested-by: Oleksandr Natalenko <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/
Fixes: 3291e09a4638 ("drm: convert drm_gem_put_pages() to use a folio_batch")
Cc: [email protected] # 6.5.x
Signed-off-by: Maxime Ripard <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
@emaste
Copy link
Member

emaste commented Jan 13, 2025

Isn´t this the same as #324?

Yes, it is the same issue; I've left a comment there. We need to implement some more functionality for Meteor Lake (MTL); I wonder if it would be possible to use the upstream routines more directly (other than drm-kmod being in ports).

Matthew Wilcox (Oracle) and others added 2 commits January 13, 2025 23:54
Remove one of the last remaining users of pagevec.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Differences were reviewed using e.g.:

    diff -Nau -pX scripts/diffignore \
      drm-kmod/drivers/gpu/drm/ \
      linux/drivers/gpu/drm/

    diff -Naur -pX scripts/diffignore \
      drm-kmod/drivers/gpu/drm/amd/amdgpu/ \
      linux/drivers/gpu/drm/amd/amdgpu/

    diff -Naur -pX scripts/diffignore \
      drm-kmod/drivers/gpu/drm/i915/ \
      linux/drivers/gpu/drm/i915/

    diff -Naur -pX scripts/diffignore \
      drm-kmod/include/drm/ \
      linux/include/drm/
@dumbbell
Copy link
Member Author

I resolved any diff with Linux 6.7, all committed in a single commit at the end of the branch. The associated freebsd-src branch was updated as the same time.

I will continue to use the branch as my daily driver with the amdgpu driver.

I will take some time to test the i915 driver too, it’s just that it is impractical: wifi does not work for me (Framework 13, Intel 12th gen) and with the laptop plugged into the dock, I break my neck to see the laptop’s screen :-)

@kenrap
Copy link

kenrap commented Jan 14, 2025

I can offer some i915 driver testing from your PR branch here if desired.

Update:
Just gonna throw this in here since I couldn't find anything about and might be useful to know.

I'm getting some errors from building ea3fdd3 using a poudriere jail build from freebsd/freebsd-src@bec5a3c. Is there already a fix for this?

--- ttm_pool.o ---
/wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-ea3fdd3c21c00019770c71cf16cbff21e69d94ef/drivers/gpu/drm/ttm/ttm_pool.c:879:16: error: call to undeclared function 'shrinker_alloc'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
  879 |         mm_shrinker = shrinker_alloc(0, "drm-ttm_pool");
      |                       ^
/wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-ea3fdd3c21c00019770c71cf16cbff21e69d94ef/drivers/gpu/drm/ttm/ttm_pool.c:879:14: error: incompatible integer to pointer conversion assigning to 'struct shrinker *' from 'int' [-Wint-conversion]
  879 |         mm_shrinker = shrinker_alloc(0, "drm-ttm_pool");
      |                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-ea3fdd3c21c00019770c71cf16cbff21e69d94ef/drivers/gpu/drm/ttm/ttm_pool.c:887:2: error: call to undeclared function 'shrinker_register'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
  887 |         shrinker_register(mm_shrinker);
      |         ^
/wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-ea3fdd3c21c00019770c71cf16cbff21e69d94ef/drivers/gpu/drm/ttm/ttm_pool.c:909:2: error: call to undeclared function 'shrinker_free'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
  909 |         shrinker_free(mm_shrinker);
      |         ^
4 errors generated.
*** [ttm_pool.o] Error code 1

@emaste
Copy link
Member

emaste commented Jan 14, 2025

Yes the patch in #324 avoids that panic, at the cost of display corruption while in the console (as mentioned there).

When trying to start X I get another panic:

...
WARNING: Device driver ttydev has set "memattr" inconsistently (drv 1 pmap 6).
WARNING: Device driver ttydev has set "memattr" inconsistently (drv 1 pmap 6).
WARNING: Device driver ttydev has set "memattr" inconsistently (drv 1 pmap 6).
WARNING: Device driver ttydev has set "memattr" inconsistently (drv 1 pmap 6).
WARNING: Device driver ttydev has set "memattr" inconsistently (drv 1 pmap 6).
panic: smr_entered_load: Assertion SMR_ENTERED((smr)) failed at /home/user/freebsd/sys/kern/subr_pctrie.c:146
cpuid = 3
time = 1736787411
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0115fcaa70
vpanic() at vpanic+0x136/frame 0xfffffe0115fcaba0
panic() at panic+0x43/frame 0xfffffe0115fcac00
pctrie_lookup_unlocked() at pctrie_lookup_unlocked+0x12d/frame 0xfffffe0115fcac20
vm_page_lookup_unlocked() at vm_page_lookup_unlocked+0x14/frame 0xfffffe0115fcac30
vm_fault() at vm_fault+0xbdc/frame 0xfffffe0115fcad60
vm_fault_trap() at vm_fault_trap+0x65/frame 0xfffffe0115fcada0
trap_pfault() at trap_pfault+0x27b/frame 0xfffffe0115fcae10
trap() at trap+0x51e/frame 0xfffffe0115fcaf30
calltrap() at calltrap+0x8/frame 0xfffffe0115fcaf30
--- trap 0xc, rip = 0x8280b475a, rsp = 0x82128b838, rbp = 0x82128b8d0 ---
Uptime: 1m29s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.