From 152f3531feb4f91a5644e54298eaf351096c3090 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 21 Dec 2021 15:03:58 +0200 Subject: [PATCH] source/pci: add iommu_group/type attribute Add "iommu_group/type" to the list of PCI device attributes that are discovered. The value is the raw value from sysfs (i.e DMA, DMA-FQ or identity). No built-in (automatic) labels are generated based on this, but, the attribute is available for custom label rules to use. Examples of custom rules: - name: "iommu enabled rule" labels: iommu.enabled: "true" matchFeatures: - feature: pci.device matchExpressions: "iommu_group/type": {op: NotIn, value: ["unknown"]} - name: "iommu passthrough rule" labels: iommu.passthrough: "true" matchFeatures: - feature: pci.device matchExpressions: "iommu_group/type": {op: In, value: ["identity"]} --- docs/advanced/customization-guide.md | 2 +- source/pci/utils.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced/customization-guide.md b/docs/advanced/customization-guide.md index b401942e6..f17ae073f 100644 --- a/docs/advanced/customization-guide.md +++ b/docs/advanced/customization-guide.md @@ -515,7 +515,7 @@ The following features are available for matching: | **`network.device`** | instance | | | Physical (non-virtual) network interfaces present in the system | | | **``** | string | Sysfs network interface attribute, available attributes: `name`, `operstate`, `speed`, `sriov_numvfs`, `sriov_totalvfs` | **`pci.device`** | instance | | | PCI devices present in the system -| | | **``** | string | Value of the sysfs device attribute, available attributes: `class`, `vendor`, `device`, `subsystem_vendor`, `subsystem_device`, `sriov_totalvfs` +| | | **``** | string | Value of the sysfs device attribute, available attributes: `class`, `vendor`, `device`, `subsystem_vendor`, `subsystem_device`, `sriov_totalvfs`, `iommu_group/type` | **`storage.device`** | instance | | | Block storage devices present in the system | | | **``** | string | Sysfs network interface attribute, available attributes: `name`, `dax`, `rotational`, `nr_zones`, `zoned` | **`system.osrelease`** | attribute | | | System identification data from `/etc/os-release` diff --git a/source/pci/utils.go b/source/pci/utils.go index 5bc05a674..367e4b1f2 100644 --- a/source/pci/utils.go +++ b/source/pci/utils.go @@ -29,7 +29,7 @@ import ( ) var mandatoryDevAttrs = []string{"class", "vendor", "device", "subsystem_vendor", "subsystem_device"} -var optionalDevAttrs = []string{"sriov_totalvfs"} +var optionalDevAttrs = []string{"sriov_totalvfs", "iommu_group/type"} // Read a single PCI device attribute // A PCI attribute in this context, maps to the corresponding sysfs file