From 357149f037beef26ff80e4a7e716e7d07a8a312f Mon Sep 17 00:00:00 2001
From: Ruslan Bukin
Date: Sat, 25 Jul 2020 21:37:07 +0000
Subject: [PATCH] o Make the _hw_iommu sysctl node non-static; o Move the dmar
sysctl knobs to _hw_iommu_dmar.
Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25807
---
sys/dev/iommu/iommu.h | 3 +++
sys/dev/iommu/iommu_gas.c | 4 ++--
sys/x86/iommu/intel_utils.c | 10 +++++-----
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/sys/dev/iommu/iommu.h b/sys/dev/iommu/iommu.h
index 781ba00219b5..10d6bb65a564 100644
--- a/sys/dev/iommu/iommu.h
+++ b/sys/dev/iommu/iommu.h
@@ -35,6 +35,7 @@
#define _SYS_IOMMU_H_
#include
+#include
#include
#include
#include
@@ -210,4 +211,6 @@ int iommu_gas_map_region(struct iommu_domain *domain,
int iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start,
iommu_gaddr_t end);
+SYSCTL_DECL(_hw_iommu);
+
#endif /* !_SYS_IOMMU_H_ */
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index a080a617656c..21b22238829c 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -732,9 +732,9 @@ iommu_map_region(struct iommu_domain *domain, struct iommu_map_entry *entry,
return (error);
}
+SYSCTL_NODE(_hw, OID_AUTO, iommu, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "");
+
#ifdef INVARIANTS
-static SYSCTL_NODE(_hw, OID_AUTO, iommu, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
- "");
SYSCTL_INT(_hw_iommu, OID_AUTO, check_free, CTLFLAG_RWTUN,
&iommu_check_free, 0,
"Check the GPA RBtree for free_down and free_after validity");
diff --git a/sys/x86/iommu/intel_utils.c b/sys/x86/iommu/intel_utils.c
index 1a14d2292c65..39ade22ac945 100644
--- a/sys/x86/iommu/intel_utils.c
+++ b/sys/x86/iommu/intel_utils.c
@@ -655,15 +655,15 @@ dmar_timeout_sysctl(SYSCTL_HANDLER_ARGS)
return (error);
}
-static SYSCTL_NODE(_hw, OID_AUTO, dmar, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
- "");
-SYSCTL_INT(_hw_dmar, OID_AUTO, tbl_pagecnt, CTLFLAG_RD,
+static SYSCTL_NODE(_hw_iommu, OID_AUTO, dmar, CTLFLAG_RD | CTLFLAG_MPSAFE,
+ NULL, "");
+SYSCTL_INT(_hw_iommu_dmar, OID_AUTO, tbl_pagecnt, CTLFLAG_RD,
&dmar_tbl_pagecnt, 0,
"Count of pages used for DMAR pagetables");
-SYSCTL_INT(_hw_dmar, OID_AUTO, batch_coalesce, CTLFLAG_RWTUN,
+SYSCTL_INT(_hw_iommu_dmar, OID_AUTO, batch_coalesce, CTLFLAG_RWTUN,
&dmar_batch_coalesce, 0,
"Number of qi batches between interrupt");
-SYSCTL_PROC(_hw_dmar, OID_AUTO, timeout,
+SYSCTL_PROC(_hw_iommu_dmar, OID_AUTO, timeout,
CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0,
dmar_timeout_sysctl, "QU",
"Timeout for command wait, in nanoseconds");