github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/interfaces/builtin/allegro_vcu.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2021 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package builtin 21 22 // https://www.xilinx.com/support/documentation/ip_documentation/vcu/v1_2/pg252-vcu.pdf 23 // https://github.com/Xilinx/vcu-modules/ 24 const allegroVcuSummary = `allows access to Allegro Video Code Unit` 25 26 // Xilinx offers IP for their devices to decode/encode video streams, by 27 // using /dev/allegroDecodeIP and /dev/allegroIP devices. 28 // These operations should be considered privileged since the driver 29 // assumes trusted input, therefore require manual connection. 30 const allegroVcuBaseDeclarationSlots = ` 31 allegro-vcu: 32 allow-installation: 33 slot-snap-type: 34 - core 35 deny-auto-connection: true 36 ` 37 38 const allegroVcuConnectedPlugAppArmor = ` 39 # Description: Can access the Allegro Video Core Unit, using a kernel 40 # module which directly controls hardware on the device. 41 42 /dev/allegroDecodeIP rw, 43 /dev/allegroIP rw, 44 45 /dev/dmaproxy rw, 46 ` 47 48 var allegroVcuConnectedPlugUDev = []string{ 49 `SUBSYSTEM=="allegro_decode_class", KERNEL=="allegroDecodeIP"`, 50 `SUBSYSTEM=="allegro_encode_class", KERNEL=="allegroIP"`, 51 `SUBSYSTEM=="char", KERNEL=="dmaproxy"`, 52 } 53 54 func init() { 55 registerIface(&commonInterface{ 56 name: "allegro-vcu", 57 summary: allegroVcuSummary, 58 implicitOnCore: true, 59 implicitOnClassic: true, 60 baseDeclarationSlots: allegroVcuBaseDeclarationSlots, 61 connectedPlugAppArmor: allegroVcuConnectedPlugAppArmor, 62 connectedPlugUDev: allegroVcuConnectedPlugUDev, 63 }) 64 }