From 64b38385790d49cfaca4b93cd347460cdb592c33 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 11 Jan 2022 12:32:45 +0200 Subject: [PATCH] source/pci: detect intel-iommu/version Discover "iommu/intel-iommu/version" sysfs attribute for pci devices. This information is available for custom label rules. An example custom rule: - name: "iommu version rule" labels: iommu.version_1: "true" matchFeatures: - feature: pci.device matchExpressions: "iommu/intel-iommu/version": {op: In, value: ["1:0"]} --- 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 d3f4ef9b1..f7f664d44 100644 --- a/docs/advanced/customization-guide.md +++ b/docs/advanced/customization-guide.md @@ -516,7 +516,7 @@ The following features are available for matching: | | | **`name`** | string | Name of the network interface | | | **``** | string | Sysfs network interface attribute, available attributes: `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`, `iommu_group/type` +| | | **``** | string | Value of the sysfs device attribute, available attributes: `class`, `vendor`, `device`, `subsystem_vendor`, `subsystem_device`, `sriov_totalvfs`, `iommu_group/type`, `iommu/intel-iommu/version` | **`storage.device`** | instance | | | Block storage devices present in the system | | | **`name`** | string | Name of the block device | | | **``** | string | Sysfs network interface attribute, available attributes: `dax`, `rotational`, `nr_zones`, `zoned` diff --git a/source/pci/utils.go b/source/pci/utils.go index 367e4b1f2..4922cad83 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", "iommu_group/type"} +var optionalDevAttrs = []string{"sriov_totalvfs", "iommu_group/type", "iommu/intel-iommu/version"} // Read a single PCI device attribute // A PCI attribute in this context, maps to the corresponding sysfs file