The integrated info v2.3 table in the Atom ROM exposes available options for the VRAM carveout sizes. The carveout size can be changed using the ATCS function code 0xA for BIOS that supports this.
Make these features available as sysfs files, so that users can set the carveout size in a way similar to what a Windows user can do in the "Tuning" tab in the AMD Adrenalin. The newly added sysfs files are: - uma/carveout_options: this a read-only file listing all available carveout options. They are fetched from the Atom ROM on driver initialization. - uma/carveout: this shows the index of the currently selected option, as shown in the uma_carveout_options. Writing a valid option index to this file will change the carveout option on next boot. Note that above files are created only if BIOS indicates support for it, i.e. where the table shows non-zero UMACarveoutIndexMax. Signed-off-by: Yo-Jung Leo Lin (AMD) <[email protected]> --- Changes in v5: - Move uma_info from struct amdgpu_atcs to struct amdgpu_device. - Move implementation of sysfs entry initialization functions from amdgpu_acpi.c to amdgpu_device.c - Adjust function prototypes and how they access uma_info and amdgpu_atcs in accordance with the changes above - Do clean up for uma_info in amdgpu_acpi_uma_option_fini() only if allocation size setting is supported, for uma_info is initialized only when this is supported - Link to v4: https://lore.kernel.org/r/20251201-vram-carveout-tuning-for-upstream-v4-0-9e151363b...@amd.com Changes in v4: - Correct format string and error message in carveout_show() - Sanitize input array index in carveout_show() to fix smatch spectre warning - Fix typos in comments for amdgpu_uma_carveout_option and amdgpu_uma_carveout_info - Link to v3: https://lore.kernel.org/r/20251126-vram-carveout-tuning-for-upstream-v3-0-cf1729c4c...@amd.com Changes in v3: - Change the unit of memory carved in UMA option entry from GB to MB and use uint32_t instead, so that options below 1 GB can be properly recorded. - Rename the sysfs interfaces from "uma_carveout_options" and "uma_carveout" to just "carveout_options" and "carveout", and put them under a new uma/ directory. - Update docs to reflect the naming/location changes to the said sysfs files. - Rebase to latest asdn - Fix LKP build error - Link to v2: https://lore.kernel.org/r/20251114-vram-carveout-tuning-for-upstream-v2-0-4f6bdd480...@amd.com Changes in v2: - Move VBIOS table parsing and sysfs interface creation from atomfirmware initialization code to amdgpu_acpi_init() - Create structs that abstract the uma options - Move the parsed carveout options from atom_context to the amdgpu_atcs - Minor kdoc fixes, as well as adding example output for uma_carveout_options - Link to v1: https://lore.kernel.org/r/20251103-vram-carveout-tuning-for-upstream-v1-0-17e2a7263...@amd.com --- Yo-Jung Leo Lin (AMD) (5): drm/amdgpu: parse UMA size-getting/setting bits in ATCS mask drm/amdgpu: add helper to read UMA carveout info drm/amdgpu: add UMA allocation setting helpers drm/amdgpu: add UMA allocation interfaces to sysfs Documentation/amdgpu: Add UMA carveout details Documentation/gpu/amdgpu/driver-misc.rst | 26 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu.h | 45 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 54 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 77 +++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 167 +++++++++++++++++++++++ drivers/gpu/drm/amd/include/amd_acpi.h | 34 ++++- 7 files changed, 404 insertions(+), 1 deletion(-) --- base-commit: 5de8ce0f3709ad93ca5a579aa45cf1b52d72bc90 change-id: 20251103-vram-carveout-tuning-for-upstream-1d5189688d73 Best regards, -- Yo-Jung Leo Lin (AMD) <[email protected]>
