** Description changed: [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. + On AMD APU systems with BIOS configured to "Auto Mode" for GPU VRAM allocation, + users have no way to inspect or tune the UMA (Unified Memory Architecture) carveout size from the OS. This is a feature gap for Dell systems that use AMD APU platforms(CY26 AMD Modularity platforms with GPT APU). + + The UMA carveout size determines how much system memory is dedicated to + the integrated GPU. With the BIOS "Auto Mode" change, the OS-level + interface to read and set this value was missing entirely — the + /sys/.../uma/ sysfs directory was not enumerated, leaving users and + system management tools (such as fwupd) unable to inspect or change the + GPU memory allocation without rebooting into BIOS. [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: + Add UMA carveout tuning interfaces to the amdgpu driver via a new sysfs directory + `uma/` exposed under the GPU device's sysfs path. This includes: + - Parse the ATCS mask to detect UMA size get/set capability + (upstream: 6f3b631e395b971c7320830920185a7a2b44090f) + - Add helper to read UMA carveout configuration from the integrated system + information table in atomfirmware + (upstream: 685b7113e0a8087f683d61dad1dc1be78e6c57aa) + - Add helper functions to set UMA carveout size via ATCS methods + (upstream: 379a3160633a469da240f40948464f20582c11e9) + - Add helpers to set/get unique IDs per device type (prerequisite refactor) + (upstream: 589ea8a1fd6cc4d194f5472f358dbdcee954a2dc) + - Reorganize sysfs init/fini calls (no functional change, prerequisite cleanup) + (upstream: aa6674f2da055da0629a62eb8debe774515645df) + - Add `uma/carveout` (r/w) and `uma/carveout_options` (r/o) sysfs interfaces + (upstream: 19ba61ac06d2a4f1e58f92879b54a998ab23b4b1) + - Fix GCC-14 -Wflex-array-member-not-at-end warnings in amdkfd (build hygiene) + (upstream: 1e6d36e15b8873fc3ade8b714d35d69efd5e1427) + - Add documentation for the new sysfs interfaces + (upstream: 5946dbe1c802efef3b12a4eecab1471f725f4ca9) + + All upstream commits are targeted for mainline kernel v7.0. The patch series is + available at: 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). + On an AMD APU system (Dell systems with CY26 AMD Modularity / GPT APU), verify + that the UMA sysfs interface is exposed and functional: + 1. Check that the uma/ directory is present: + $ ls /sys/devices/pci0000:00/*/0000:*/uma/ + Expected: carveout carveout_options + + 2. Read the available carveout options: + $ cat /sys/devices/pci0000:00/*/0000:*/uma/carveout_options + Expected: A list of indexed size options (e.g. 0: Minimum (512 MB), 8: Medium (8 GB), 16: High (16 GB)) + + 3. Read the current setting: + $ cat /sys/devices/pci0000:00/*/0000:*/uma/carveout + Expected: A numeric index (e.g. 0) + + 4. Change the carveout size (takes effect on next boot): + $ echo 6 > /sys/devices/pci0000:00/*/0000:*/uma/carveout + $ cat /sys/devices/pci0000:00/*/0000:*/uma/carveout + Expected: 6 + + 5. Reboot and verify in BIOS that Memory Available has changed to match the + selected option (e.g. index 6 = 6 GB GPU memory). + + Without the patch: The uma/ sysfs directory does not exist. + With the patch: The uma/ directory is present, options are readable, and setting + a new value causes BIOS to reflect the updated GPU memory allocation 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. + It may break AMD APU systems that use the ATCS ACPI interface. - [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. + The new ATCS parsing code reads capability bits from the ATCS mask to determine + whether UMA size get/set is supported. If the capability detection logic incorrectly identifies a platform as supporting UMA carveout tuning when it does not, attempting to call the ATCS set method could result in ACPI errors or system instability. + Conversely, if the atomfirmware parsing of the integrated system information table fails on certain BIOS versions, the uma/ sysfs directory may be silently absent or expose incorrect carveout option values, misleading users about available GPU memory configurations. + + The reorganized sysfs init/fini calls (no functional change commit) could also + introduce issues if the ordering of sysfs group registration/deregistration is subtly different from the original — a mis-ordered teardown could cause use-after-free or sysfs removal failures on driver unload or GPU reset.
-- 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
