Public bug reported: [Impact] On AMD APU platforms with newer BIOS versions, the graphics VRAM allocation mode has been changed from a fixed size to "Auto Mode". Without additional amdgpu driver support, the system has no way to query or modify the UMA (Unified Memory Architecture) carveout size from the OS. This means users and tools like fwupd cannot inspect or adjust the GPU memory allocation, which is important for tuning graphics performance on these APU platforms.
[Fix] Add UMA carveout tuning interfaces to the amdgpu driver. This is implemented across 5 patches: 1. Parse the ATCS capability bits for UMA size getting/setting support (cherry picked from commit 6f3b631e395b) 2. Add a helper to read UMA carveout configuration options from the integrated system information table in Atom ROM (backported from commit 685b7113e0a8, context adapted for oem-6.17) 3. Add helper functions for UMA allocation size setting via ATCS methods (cherry picked from commit 379a3160633a) 4. Expose sysfs interfaces under uma/ directory: a read-only uma/carveout_options file listing all available allocation sizes, and a read-write uma/carveout file for reading/changing the current setting (backported from commit 19ba61ac06d2, context adapted for oem-6.17) 5. Add kernel documentation for the new sysfs attributes (cherry picked from commit 5946dbe1c802) All 5 upstream commits are in mainline kernel v7.0-rc1 Upstream series: https://lore.kernel.org/amd-gfx/20251212-vram-carveout-tuning-for-upstream-v6-0-50c02fd18...@amd.com/ [Test Plan] 1. Boot the system with an AMD APU that supports UMA carveout tuning (BIOS must expose ATCS function 0xA) 2. Verify the sysfs interface is created: $ ls /sys/class/drm/card0/device/uma/ Expected: carveout carveout_options 3. Read available options: $ cat /sys/class/drm/card0/device/uma/carveout_options Expected: A list of indexed options with sizes, e.g.: 0: Minimum (512 MB) 1: (1 GB) ... 4. Read the current carveout index: $ cat /sys/class/drm/card0/device/uma/carveout Expected: A numeric index corresponding to carveout_options 5. Write a new valid index to change the UMA carveout size: $ echo 3 | sudo tee /sys/class/drm/card0/device/uma/carveout $ cat /sys/class/drm/card0/device/uma/carveout Expected: The written index (3) is reflected Without the patches: The uma/ sysfs directory does not exist; there is no way to inspect or change UMA carveout size from the OS. With the patches: The uma/ sysfs directory is present on supported hardware, carveout_options lists available sizes, and writing to carveout successfully changes the allocation (effective on next boot). [Where problems could occur] The patches modify the amdgpu driver's ACPI interaction path, atomfirmware parser, sysfs interface, and the core amdgpu_device struct layout. Several areas could regress: 1. **Struct layout change**: The `amdgpu_kfd_dev kfd` field was moved to the end of `struct amdgpu_device` because it ends in a flexible-array member, and the new `uma_info` field was inserted before it. If any code relies on the relative position of `kfd` or makes assumptions about struct layout, it could break. This would manifest as KFD-related failures or memory corruption. 2. **ATCS ACPI method failures**: If the BIOS ATCS implementation is buggy or returns unexpected data, the write to carveout could fail silently or set an incorrect allocation. This would manifest as incorrect VRAM sizes or boot failures after changing the setting. 3. **Atom ROM parsing**: The atomfirmware parser for the integrated system info table v2.3 could encounter unexpected data on platforms with different VBIOS versions. If `UMACarveoutIndexMax` exceeds `MAX_UMA_OPTION_ENTRIES` (19) or option names are not null-terminated, the parser could truncate data or read garbage. This would show up as missing or garbled entries in carveout_options. 4. **Sysfs race conditions**: Although a mutex (`update_lock`) protects concurrent writes, rapid read/write cycles from userspace could potentially see stale index values between the ACPI call and the index update. 5. **Non-APU systems**: The patches have guards (`AMD_IS_APU` check, ATCS capability check) so they should not affect discrete GPU systems. However, if a discrete GPU system falsely reports ATCS UMA capabilities, the sysfs files would be created incorrectly. [Other Info] fwupd support (https://github.com/fwupd/fwupd/pull/9925) can leverage these sysfs interfaces to provide a GUI for toggling UMA carveout size, but fwupd is not required to enable the kernel feature. ** Affects: hwe-next Importance: Undecided Status: New ** Affects: linux (Ubuntu) Importance: Undecided Status: Fix Released ** Affects: linux-oem-6.17 (Ubuntu) Importance: Undecided Status: Invalid ** Affects: linux (Ubuntu Noble) Importance: Undecided Status: Invalid ** Affects: linux-oem-6.17 (Ubuntu Noble) Importance: Undecided Assignee: AceLan Kao (acelankao) Status: In Progress ** Affects: linux (Ubuntu Resolute) Importance: Undecided Status: Fix Released ** Affects: linux-oem-6.17 (Ubuntu Resolute) Importance: Undecided Status: Invalid ** Tags: jira-somerville-4275 oem-priority somerville ** Also affects: linux-oem-6.17 (Ubuntu Noble) Importance: Undecided Status: New ** Changed in: linux-oem-6.17 (Ubuntu Noble) Assignee: (unassigned) => AceLan Kao (acelankao) ** Changed in: linux-oem-6.17 (Ubuntu Noble) Status: New => In Progress ** Also affects: linux (Ubuntu) Importance: Undecided Status: New ** Also affects: linux (Ubuntu Resolute) Importance: Undecided Status: New ** Also affects: linux-oem-6.17 (Ubuntu Resolute) Importance: Undecided Status: New ** Changed in: linux (Ubuntu Noble) Status: New => Invalid ** Changed in: linux (Ubuntu Resolute) Status: New => Fix Released -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2143873 Title: drm/amdgpu: add UMA carveout tuning interfaces To manage notifications about this bug go to: https://bugs.launchpad.net/hwe-next/+bug/2143873/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
