gitee.com/mysnapcore/mysnapd@v0.1.0/interfaces/builtin/xilinx_dma.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/xdma/v4_1/pg195-pcie-dma.pdf
    23  // https://github.com/Xilinx/dma_ip_drivers/
    24  const xilinxDmaSummary = `allows access to Xilinx DMA IP on a connected PCIe card`
    25  
    26  const xilinxDmaBaseDeclarationPlugs = `
    27    xilinx-dma:
    28      allow-installation: false
    29      deny-auto-connection: true
    30  `
    31  
    32  const xilinxDmaBaseDeclarationSlots = `
    33    xilinx-dma:
    34      allow-installation:
    35        slot-snap-type:
    36          - core
    37      deny-auto-connection: true
    38  `
    39  
    40  // For the most part, applications just need access to the device nodes. However, there
    41  // are some important parameters exposed at /sys/modules/xdma/*
    42  const xilinxDmaConnectedPlugAppArmor = `
    43  # Access to the main device nodes created by the Xilinx XDMA driver
    44  /dev/xdma[0-9]*_{c2h,h2c,events}_[0-9]* rw,
    45  /dev/xdma[0-9]*_{control,user,xvc} rw,
    46  
    47  # If multiple cards are detected, nodes are created under
    48  /dev/xdma/card[0-9]*/** rw,
    49  
    50  # View XDMA driver module parameters
    51  /sys/module/xdma/parameters/* r,
    52  `
    53  
    54  // The xdma subsystem alone should serve as a unique identifier for all relevant devices
    55  var xilinxDmaConnectedPlugUDev = []string{
    56  	`SUBSYSTEM=="xdma"`,
    57  }
    58  
    59  func init() {
    60  	registerIface(&commonInterface{
    61  		name:                  "xilinx-dma",
    62  		summary:               xilinxDmaSummary,
    63  		implicitOnCore:        true,
    64  		implicitOnClassic:     true,
    65  		baseDeclarationPlugs:  xilinxDmaBaseDeclarationPlugs,
    66  		baseDeclarationSlots:  xilinxDmaBaseDeclarationSlots,
    67  		connectedPlugAppArmor: xilinxDmaConnectedPlugAppArmor,
    68  		connectedPlugUDev:     xilinxDmaConnectedPlugUDev,
    69  	})
    70  }