From c8597a1f9f9eba71a884e38fa2133e556105a0f4 Mon Sep 17 00:00:00 2001
From: Ruslan Bukin
Date: Wed, 29 Jul 2020 22:08:54 +0000
Subject: [PATCH] o Don't include headers from iommu.h, include them from the
header consumers instead; o Order includes properly.
Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25878
---
sys/dev/iommu/iommu.h | 8 --------
sys/dev/iommu/iommu_gas.c | 8 ++++----
sys/dev/ntb/ntb_hw/ntb_hw_intel.c | 2 ++
sys/dev/ntb/ntb_hw/ntb_hw_plx.c | 2 ++
sys/x86/iommu/intel_ctx.c | 10 +++++-----
sys/x86/iommu/intel_drv.c | 16 ++++++++--------
sys/x86/iommu/intel_idpgtbl.c | 4 ++--
sys/x86/iommu/intel_intrmap.c | 11 ++++++-----
sys/x86/iommu/intel_qi.c | 12 ++++++------
sys/x86/iommu/intel_quirks.c | 14 +++++++-------
sys/x86/iommu/intel_utils.c | 6 +++---
11 files changed, 45 insertions(+), 48 deletions(-)
diff --git a/sys/dev/iommu/iommu.h b/sys/dev/iommu/iommu.h
index cf90e7884951..e6ad0569a9ac 100644
--- a/sys/dev/iommu/iommu.h
+++ b/sys/dev/iommu/iommu.h
@@ -34,14 +34,6 @@
#ifndef _SYS_IOMMU_H_
#define _SYS_IOMMU_H_
-#include
-#include
-#include
-#include
-#include
-
-#include
-
/* Host or physical memory address, after translation. */
typedef uint64_t iommu_haddr_t;
/* Guest or bus address, before translation. */
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index 5a6e48850b5b..04d7d9667109 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
#include
#include
#include
@@ -60,6 +59,9 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
+#include
#include
#include
#include
@@ -67,11 +69,9 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
-#include
-#include
#include
#endif
+#include
/*
* Guest Address Space management.
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
index 0a839157a90c..2dfe49cc1fd9 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
@@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
#include
#include
#include
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_plx.c b/sys/dev/ntb/ntb_hw/ntb_hw_plx.c
index e1a65178be81..f3d8af4971a4 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw_plx.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw_plx.c
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
#include
#include
#include
diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c
index edd59e5f2477..234a920d1ded 100644
--- a/sys/x86/iommu/intel_ctx.c
+++ b/sys/x86/iommu/intel_ctx.c
@@ -58,18 +58,18 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
+#include
+#include
#include
#include
#include
#include
-#include
-#include
#include
-#include
#include
-#include
+#include
#include
-#include
static MALLOC_DEFINE(M_DMAR_CTX, "dmar_ctx", "Intel DMAR Context");
static MALLOC_DEFINE(M_DMAR_DOMAIN, "dmar_dom", "Intel DMAR Domain");
diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c
index 9ae8e37d4fa0..17fea13d1387 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -54,11 +54,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
#include
#include
#include
@@ -66,11 +61,16 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
+#include
+#include
+#include
+#include
+#include
#include
#ifdef DEV_APIC
diff --git a/sys/x86/iommu/intel_idpgtbl.c b/sys/x86/iommu/intel_idpgtbl.c
index d85abefc54c4..4c151ffffef8 100644
--- a/sys/x86/iommu/intel_idpgtbl.c
+++ b/sys/x86/iommu/intel_idpgtbl.c
@@ -58,15 +58,15 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
#include
#include
#include
#include
-#include
#include
-#include
+#include
#include
static int domain_unmap_buf_locked(struct dmar_domain *domain,
diff --git a/sys/x86/iommu/intel_intrmap.c b/sys/x86/iommu/intel_intrmap.c
index d2bce59c4c2e..e95d8a8090b3 100644
--- a/sys/x86/iommu/intel_intrmap.c
+++ b/sys/x86/iommu/intel_intrmap.c
@@ -40,24 +40,25 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
#include
-#include
-#include
#include
#include
#include
#include
#include
+#include
+#include
+#include
+#include
#include
#include
#include
-#include
#include
-#include
+#include
#include
-#include
#include
static struct dmar_unit *dmar_ir_find(device_t src, uint16_t *rid,
diff --git a/sys/x86/iommu/intel_qi.c b/sys/x86/iommu/intel_qi.c
index 5377ac448df8..ab2c4d4e80fc 100644
--- a/sys/x86/iommu/intel_qi.c
+++ b/sys/x86/iommu/intel_qi.c
@@ -45,20 +45,20 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
-#include
-#include
-#include
#include
#include
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
#include
#include
-#include
#include
-#include
+#include
#include
static bool
diff --git a/sys/x86/iommu/intel_quirks.c b/sys/x86/iommu/intel_quirks.c
index d0eac82e7298..1a025b3419eb 100644
--- a/sys/x86/iommu/intel_quirks.c
+++ b/sys/x86/iommu/intel_quirks.c
@@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
-#include
-#include
-#include
#include
#include
#include
@@ -57,12 +53,16 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
#include
-#include
#include
-#include
+#include
#include
-#include
typedef void (*dmar_quirk_cpu_fun)(struct dmar_unit *);
diff --git a/sys/x86/iommu/intel_utils.c b/sys/x86/iommu/intel_utils.c
index 7e89465240af..43a00428c46c 100644
--- a/sys/x86/iommu/intel_utils.c
+++ b/sys/x86/iommu/intel_utils.c
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
#include
#include
#include
@@ -59,14 +58,15 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
#include
#include
#include
#include
#include
-#include
#include
-#include
+#include
#include
u_int