ryantimwilson / rpms / systemd

Forked from rpms/systemd 7 days ago
Clone
Zbigniew Jędrzejewski-Szmek 8d080f
From 69c5d6bea7cc2168a2a483d232aa9a77202173f0 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 8d080f
From: Hans de Goede <hdegoede@redhat.com>
Zbigniew Jędrzejewski-Szmek 8d080f
Date: Tue, 16 Jul 2024 17:46:09 +0200
Zbigniew Jędrzejewski-Szmek 8d080f
Subject: [PATCH] rules: Add uaccess tag to /dev/udmabuf
Zbigniew Jędrzejewski-Szmek 8d080f
Zbigniew Jędrzejewski-Szmek 8d080f
In some cases userspace may need to create dmabuffers from userspace
Zbigniew Jędrzejewski-Szmek 8d080f
on such example is the software ISP part of libcamera which needs to
Zbigniew Jędrzejewski-Szmek 8d080f
allocate dma-buffers for the output of the software ISP.
Zbigniew Jędrzejewski-Szmek 8d080f
Zbigniew Jędrzejewski-Szmek 8d080f
At first the plan was to allow console users access to /dev/dma_heap/*,
Zbigniew Jędrzejewski-Szmek 8d080f
this was discussed with various kernel folks here:
Zbigniew Jędrzejewski-Szmek 8d080f
https://lore.kernel.org/all/bb372250-e8b8-4458-bc99-dd8365b06991@redhat.com/
Zbigniew Jędrzejewski-Szmek 8d080f
Zbigniew Jędrzejewski-Szmek 8d080f
Giving console users access to the dma_heap's was deemed a bad idea
Zbigniew Jędrzejewski-Szmek 8d080f
because memory allocated this way is not accounted in cgroup limits.
Zbigniew Jędrzejewski-Szmek 8d080f
Zbigniew Jędrzejewski-Szmek 8d080f
Giving access to /dev/udmabuf OTOH was deemed acceptable so that
Zbigniew Jędrzejewski-Szmek 8d080f
is what this patch adds.
Zbigniew Jędrzejewski-Szmek 8d080f
Zbigniew Jędrzejewski-Szmek 8d080f
Resolves: #32662
Zbigniew Jędrzejewski-Szmek 8d080f
---
Zbigniew Jędrzejewski-Szmek 8d080f
 rules.d/70-uaccess.rules.in | 2 ++
Zbigniew Jędrzejewski-Szmek 8d080f
 1 file changed, 2 insertions(+)
Zbigniew Jędrzejewski-Szmek 8d080f
Zbigniew Jędrzejewski-Szmek 8d080f
diff --git a/rules.d/70-uaccess.rules.in b/rules.d/70-uaccess.rules.in
Zbigniew Jędrzejewski-Szmek 8d080f
index b82ce04a39d38..e683bb1114461 100644
Zbigniew Jędrzejewski-Szmek 8d080f
--- a/rules.d/70-uaccess.rules.in
Zbigniew Jędrzejewski-Szmek 8d080f
+++ b/rules.d/70-uaccess.rules.in
Zbigniew Jędrzejewski-Szmek 8d080f
@@ -34,6 +34,8 @@ SUBSYSTEM=="sound", TAG+="uaccess", \
Zbigniew Jędrzejewski-Szmek 8d080f
 SUBSYSTEM=="video4linux", TAG+="uaccess"
Zbigniew Jędrzejewski-Szmek 8d080f
 SUBSYSTEM=="dvb", TAG+="uaccess"
Zbigniew Jędrzejewski-Szmek 8d080f
 SUBSYSTEM=="media", TAG+="uaccess"
Zbigniew Jędrzejewski-Szmek 8d080f
+# libcamera software ISP used with some cams requires udmabuf access
Zbigniew Jędrzejewski-Szmek 8d080f
+KERNEL=="udmabuf", TAG+="uaccess"
Zbigniew Jędrzejewski-Szmek 8d080f
 
Zbigniew Jędrzejewski-Szmek 8d080f
 # industrial cameras, some webcams, camcorders, set-top boxes, TV sets, audio devices, and more
Zbigniew Jędrzejewski-Szmek 8d080f
 SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_MIDI}=="1", TAG+="uaccess"