ADD SYSFS INTERFACE FOR SET GET SRM(9)
Add sysfs interface for set/get srm π
okay bestie, welcome to the Kernel API Manual page for Add sysfs interface for set/get srm β short-header vibe: Add sysfs i... set/get srm(9). This whole thing is, like, the ultimate multi-call plot twist: usermode writes once, the kernel does its little dance, and PSP is the final boss. πβ¨ no cap.
NOTE: From the usermodes prospective you only need to call write ONCE, the kernel will automatically call once or twice depending on the size
call: cat file > /sys/class/drm/card0/device/hdcp_srm from usermode no matter what the size is
The kernel can only send PAGE_SIZE at once and since MAX_SRM_FILE(5120) > PAGE_SIZE(4096), srm_data_write can be called multiple times.
sysfs interface doesn't tell us the size we will get so we are sending partial SRMs to psp and on the last call we will send the full SRM. PSP will fail on every call before the last.
This means we don't know if the SRM is good until the last call. And because of this limitation we cannot throw errors early as it will stop the kernel from writing to sysfs
Example 1: Good SRM size = 5096 first call to write 4096 -> PSP fails Second call to write 1000 -> PSP Pass -> SRM is set
Example 2: Bad SRM size = 4096 first call to write 4096 -> PSP fails (This is the same as above, but we don't know if this is the last call)
Solution?: 1: Parse the SRM? -> It is signed so we don't know the EOF 2: We can have another sysfs that passes the size before calling set. -> simpler solution below
Easy Solution: Always call get after Set to verify if set was successful.
Why it works: π
PSP will only update its srm if its older than the one we are trying to load. Always do set first than get.
-ifwe try to "1. SET" a older version PSP will reject it and we can "2. GET" the newer version and save it-ifwe try to "1. SET" a newer version PSP will accept it and we can "2. GET" the same(newer) version back and save it-ifwe try to "1. SET" a newer version and PSP rejects it. That means the format is incorrect/corrupted and we should correct our SRM by getting it from PSP
SEE ALSO π
- Kernel file
./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
mwah π source/version: ./drivers/gpu/drm/amd/display/... Β· date: October 2026 Β· page: Add sysfs i... set/get srm(9)
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms