Skip to content

drm/amdgpu: fix non-posted dumb-buffer SIGBUS and spurious HDMI vendor infoframe warning - #4068

Draft
RyanTheTide wants to merge 3 commits into
mainfrom
fix/amdgpu-nonposted-dumb-and-infoframe
Draft

RyanTheTide wants to merge 3 commits into
mainfrom
fix/amdgpu-nonposted-dumb-and-infoframe

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Summary

Fixes two bugs observed on J413 (7.3.0-aurora-fleet94) with the EG02 RX 7900 XTX (1002:744c) attached:

  1. plymouth-start.service (plymouthd) SIGBUS (BUS_ADRERR) on boot:

    • Coredump (core.plymouthd.0.c4a4833a...) showed flush_head() (drm.so) calling memcpy() into /dev/dri/card2 (x0=0xffff425a93c0 inside 0xffff41bd0000-0xffff429e0000).
    • Behind a non-posted VRAM BAR (IORESOURCE_MEM_NONPOSTED), amdgpu_bo_fault_reserve_notify() moves unpinned CPU-faulted VRAM BOs to GTT and returns VM_FAULT_SIGBUS if the BO is pinned. On discrete GPUs where display scanout requires VRAM (!(amdgpu_display_supported_domains() & AMDGPU_GEM_DOMAIN_GTT)), a dumb buffer pinned for scanout can never be safely CPU-mapped.
    • Return -EPERM from amdgpu_mode_dumb_mmap() when BAR 0 is non-posted and display scanout cannot use GTT, matching the existing AMDGPU_GEM_CREATE_NO_CPU_ACCESS refusal. Plymouth logs Could not map GEM object ...: Operation not permitted, skips card2 cleanly, and keeps the boot splash alive on appledrm. Kernel fbdev (drm_fbdev_ttm vmap), Mesa (amdgpu_gem_mmap_ioctl), APUs with GTT scanout, and posted PCIe hosts are unaffected.
  2. Spurious Failed to setup vendor infoframe on connector HDMI-A-1: -22 warning:

    • drm_hdmi_vendor_infoframe_from_display_mode() returns -EINVAL whenever !connector->display_info.has_hdmi_infoframe (e.g. HDMI sinks without an HDMI 1.4 VSDB).
    • Guard the call in fill_stream_properties_from_drm_display_mode() on info->has_hdmi_infoframe; timing_out->hdmi_vic is already initialized to 0.

Risk

Low, two-way: isolated to amdgpu_mode_dumb_mmap() under IORESOURCE_MEM_NONPOSTED (VRAM-only scanout) and the HDMI vendor infoframe call when !info->has_hdmi_infoframe. Revert cleanly restores prior behavior.

Testing

  • scripts/checkpatch.pl --strict --git origin/main..HEAD: 0 errors, 0 warnings, 0 checks on both commits (6bc6d238e75c, 381bbc470bb2).
  • arm64 LLVM=1 W=1 build of drivers/gpu/drm/amd/amdgpu/amdgpu_gem.o and drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.o: clean (0 warnings).
  • Hardware row: pending (draft until EG02 RX 7900 XTX is reattached to J413/J713 for an exact-head boot verifying 0 plymouthd coredumps and 0 Failed to setup vendor infoframe warnings).

Behind a non-posted VRAM BAR (IORESOURCE_MEM_NONPOSTED),
amdgpu_bo_fault_reserve_notify() moves unpinned CPU-faulted VRAM BOs to
GTT and returns VM_FAULT_SIGBUS if the BO is pinned. On discrete GPUs
where display scanout requires VRAM (amdgpu_display_supported_domains()
excludes GTT), a userspace DRM dumb buffer pinned for scanout cannot be
safely CPU-mapped: clients such as plymouthd succeed at
DRM_IOCTL_MODE_MAP_DUMB and then crash with SIGBUS (BUS_ADRERR) in
flush_head() memcpy.

Return -EPERM from amdgpu_mode_dumb_mmap() when BAR 0 is non-posted and
display scanout does not support GTT, matching the existing
AMDGPU_GEM_CREATE_NO_CPU_ACCESS refusal. Kernel fbdev (drm_fbdev_ttm
vmap), Mesa (amdgpu_gem_mmap_ioctl), APUs with GTT scanout, and posted
PCIe hosts are unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…oframe

drm_hdmi_vendor_infoframe_from_display_mode() returns -EINVAL whenever
connector->display_info.has_hdmi_infoframe is false (for example, HDMI
sinks whose EDID does not advertise an HDMI 1.4 VSDB).
fill_stream_properties_from_drm_display_mode() calls it unconditionally
for HDMI signals and emits a spurious 'Failed to setup vendor infoframe
on connector ...: -22' warning.

Guard the call on info->has_hdmi_infoframe; timing_out->hdmi_vic is
already initialized to 0.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Draft sweep 12-05: merged main @ f02bd68 (a89e7ea, clean; main has not touched either file). arm64 LLVM W=1 builds of amdgpu_gem.o and amdgpu_dm_connector.o clean. No review asks open. Still a draft only for the exact-head hardware row, which needs the RX 7900 XTX physically back in the EG02 on the J413/J713 (the enclosure currently holds the GTX 1080 for the Pascal work); the row is queued in HWROWS-QUEUE.

This branch has not been deployed

No deployments
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.

1 participant